summaryrefslogtreecommitdiff
path: root/etc/functions
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-05-19 19:33:01 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-05-19 19:33:01 +0200
commit42562531389e9998c83a1c05a1551244e4457f55 (patch)
tree726751aa9e3eae2e7df7d68fbb813bdca38ef3fa /etc/functions
initial commit
Diffstat (limited to 'etc/functions')
-rw-r--r--etc/functions62
1 files changed, 62 insertions, 0 deletions
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
+}