From 42562531389e9998c83a1c05a1551244e4457f55 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 19 May 2008 19:33:01 +0200 Subject: initial commit --- etc/functions | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 etc/functions (limited to 'etc/functions') diff --git a/etc/functions b/etc/functions new file mode 100644 index 0000000..4a7c82c --- /dev/null +++ b/etc/functions @@ -0,0 +1,62 @@ +## Functions +## vim:ft=zsh +# builtin function for archives, see $ZDIR/alias_suffix +extr () { + if [[ -f "$1" ]]; then + case "$1" in + *.tar.bz2) tar xjvf "$1" ;; + *.tar.gz) tar xvzf "$1" ;; + *.ace) unace e "$1" ;; + *.rar) unrar x "$1" ;; + *.deb) ar -x "$1" ;; + *.bz2) bzip2 -d "$1" ;; + *.lzh) lha x "$1" ;; + *.gz) gunzip -d "$1" ;; + *.tar) tar xvf "$1" ;; + *.tgz) gunzip -d "$1" ;; + *.tbz2) tar jxvf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.shar) sh "$1" ;; + *) echo "I don't know the archive type of '"$1"' :(" ;; + esac + else + echo "Hm. Seems '"$1"' is not a valid file." + fi +} + +# self-explaining, I think +l () { + if [[ -f "$1" ]]; then + case "$1" in + *.bz2) bzless "$1" ;; + *.gz) zless "$1" ;; + *) less "$1" ;; + esac + else + echo "No such file, dude." + fi +} + +cdl () { + cd "$1"; + ls; +} + +world-readable () { + chmod -R a+rX . +} + +chpwd () { + pstags='' + [ -f .todo ] && pstags+='todo ' + [ -f .fehindex.jpg ] && pstags+='feh ' + [ -d .hg ] && pstags+='hg ' + [ -d .git ] && pstags+='git ' + [ -d .svn ] && pstags+='svn ' + source $ZDIR/prompt +} + +plonkhost () { + sudo iptables -I INPUT -s "$1" -j DROP +} -- cgit v1.2.3