summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-11-22 09:15:07 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-11-22 09:15:07 +0100
commit88ed4809398dce676ba516e2016f8b51d53b4720 (patch)
tree1073cd866eb10ac2b5111a8784403ccbff5e9246
parent244de02d830c9a42bd423715b3c8031ade2fa702 (diff)
function cleanup
-rw-r--r--etc/.zshrc32
-rw-r--r--etc/functions/extract24
-rw-r--r--etc/functions/gtd-all10
-rw-r--r--etc/functions/gtd-move22
-rw-r--r--etc/functions/hugin3
-rw-r--r--etc/functions/mkcd13
-rw-r--r--etc/functions/world-readable1
7 files changed, 32 insertions, 73 deletions
diff --git a/etc/.zshrc b/etc/.zshrc
index 98a07d8..e6c5777 100644
--- a/etc/.zshrc
+++ b/etc/.zshrc
@@ -185,6 +185,38 @@ function ondemand powersave performance conservative userspace {
sudo cpufreq-set -c 0 -g ${0}
}
+function extract {
+ if [[ -f ${1} ]] {
+ case ${1} in
+ *.tar*) tar xvf ${*} ;;
+ *.ace) unace e ${1} ;;
+ *.rar) unrar x ${1} ;;
+ *.deb) ar -x ${1} ;;
+ *.bz2) bunzip2 ${1} ;;
+ *.lzh) lha x ${1} ;;
+ *.gz) gunzip ${1} ;;
+ *.tar) tar xvf ${*} ;;
+ *.zip) unzip ${1} ;;
+ *.Z) uncompress ${1} ;;
+ *.cpio) cpio --no-absolute-filenames -idv < ${1} ;;
+ *.lzma) unlzma ${1} ;;
+ *) echo "Unknown archive type: ${1}"; return 2 ;;
+ esac
+ } else {
+ echo "No such file: ${1}"
+ return 1
+ }
+}
+
+function mkcd {
+ mkdir -p ${1}
+ cd ${1}
+}
+
+function world-readable {
+ chmod -R a+rX .
+}
+
# }}}
# {{{ ZLE
diff --git a/etc/functions/extract b/etc/functions/extract
deleted file mode 100644
index 53fdc87..0000000
--- a/etc/functions/extract
+++ /dev/null
@@ -1,24 +0,0 @@
-## vim:ft=zsh
-## Extract archives
-## Usage: extr <file>
-
-if [[ -f ${1} ]] {
- case ${1} in
- *.tar*) tar xvf ${*} ;;
- *.ace) unace e ${1} ;;
- *.rar) unrar x ${1} ;;
- *.deb) ar -x ${1} ;;
- *.bz2) bunzip2 ${1} ;;
- *.lzh) lha x ${1} ;;
- *.gz) gunzip ${1} ;;
- *.tar) tar xvf ${*} ;;
- *.zip) unzip ${1} ;;
- *.Z) uncompress ${1} ;;
- *.cpio) cpio --no-absolute-filenames -idv < ${1} ;;
- *.lzma) unlzma ${1} ;;
- *) echo "Unknown archive type: ${1}"; return 2 ;;
- esac
-} else {
- echo "No such file: ${1}"
- return 1
-}
diff --git a/etc/functions/gtd-all b/etc/functions/gtd-all
deleted file mode 100644
index e768ad7..0000000
--- a/etc/functions/gtd-all
+++ /dev/null
@@ -1,10 +0,0 @@
-## vim:ft=zsh
-## concatenate all GTD databases
-## usage: gtd-all [devtodo options]
-typeset prefix=~/var/gtd
-typeset database
-
-for database in ${prefix}/*(.N); {
- echo "\n${database:t}"
- todo --database ${database} ${*}
-}
diff --git a/etc/functions/gtd-move b/etc/functions/gtd-move
deleted file mode 100644
index a20502c..0000000
--- a/etc/functions/gtd-move
+++ /dev/null
@@ -1,22 +0,0 @@
-## vim:ft=zsh
-## Helper for my gtd system
-## Usage: gtd-move <old-database> <index> <new-database>
-## Copyright (C) 2008 by Daniel Friesel <derf@finalrewind.org>
-## License: WTFPL <http://sam.zoy.org/wtfpl>
-
-if [[ ${#*} != 3 ]] {
- echo "Usage: gtd-move <from-database> <item> <to-database>"
- return
-}
-
-typeset prefix="${HOME}/var/gtd"
-typeset format='display=%T'
-typeset from=${1}
-typeset itemno=${2}
-typeset to=${3}
-typeset IFS=$'\n'
-typeset -a item
-
-item=$(todo --database ${prefix}/${from} --format ${format} ${itemno})
-todo --database ${prefix}/${to} --priority medium --add ${item}
-todo --database ${prefix}/${from} --remove ${itemno}
diff --git a/etc/functions/hugin b/etc/functions/hugin
deleted file mode 100644
index cf0aa9d..0000000
--- a/etc/functions/hugin
+++ /dev/null
@@ -1,3 +0,0 @@
-mkdir ~/tmp
-MAKEFLAGS= command hugin
-rm -rv ~/tmp
diff --git a/etc/functions/mkcd b/etc/functions/mkcd
deleted file mode 100644
index e91719a..0000000
--- a/etc/functions/mkcd
+++ /dev/null
@@ -1,13 +0,0 @@
-## vim:ft=zsh
-## create a directory, then change into it
-typeset -i ls=0
-typeset dir=${1}
-
-if [[ -z ${dir} ]] {
- echo "Usage: mkcd <directory name>" > /dev/stderr
- return 1
-}
-if [[ -d ${dir} ]] ls=1
-mkdir -p ${dir}
-cd ${dir}
-if ((ls)) ls --color=auto
diff --git a/etc/functions/world-readable b/etc/functions/world-readable
deleted file mode 100644
index 7963223..0000000
--- a/etc/functions/world-readable
+++ /dev/null
@@ -1 +0,0 @@
-chmod -R a+rX .