+ # After resuming from suspend, system is paging heavilly, leading to very bad interactivity.
+ # taken from $LINUX-KERNELSOURCE/Documentation/power/swsusp.txt
+ [ -r /proc/1/maps ] && deswap() {
+ print 'Reading /proc/[0-9]*/maps and sending output to /dev/null, this might take a while.'
+ cat $(sed -ne 's:.* /:/:p' /proc/[0-9]*/maps | sort -u | grep -v '^/dev/') > /dev/null
+ print 'Finished, running "swapoff -a; swapon -a" may also be useful.'
+ }
+
+ # print hex value of a number
+ hex() {
+ [ -n "$1" ] && printf "%x\n" $1 || { print 'Usage: hex <number-to-convert>' ; return 1 }
+ }
+
+ # calculate (or eval at all ;-)) with perl => p[erl-]eval
+ # hint: also take a look at zcalc -> 'autoload zcalc' -> 'man zshmodules | less -p MATHFUNC'
+ peval() {
+ [ -n "$1" ] && CALC="$*" || print "Usage: calc [expression]"
+ perl -e "print eval($CALC),\"\n\";"
+ }
+ functions peval &>/dev/null && alias calc=peval
+
+ # brltty seems to have problems with utf8 environment and/or font Uni3-Terminus16 under
+ # certain circumstances, so work around it, no matter which environment we have
+ brltty() {
+ if [ -z "$DISPLAY" ] ; then
+ consolechars -f /usr/share/consolefonts/default8x16.psf.gz
+ command brltty "$@"
+ else
+ command brltty "$@"
+ fi
+ }
+
+ # Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
+ # bash() {
+ # NO_SWITCH="yes" command bash "$@"
+ # }
+ # restart () {
+ # exec $SHELL $SHELL_ARGS "$@"
+ # }
+
+# }}}
+
+# log out? set timeout in seconds {{{
+# TMOUT=1800
+# do not log out in some specific terminals:
+# if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]]; then
+# unset TMOUT
+# fi