# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest Change: Sat Jan 26 11:55:04 CET 2008
+# Latest change: Wed Aug 06 14:17:12 CEST 2008 [mika]
################################################################################
# source ~/.zshrc.global {{{
if [[ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ]] ; then
print 'Warning: global zsh config has not been read.' >&2
print ' prepare for possible errors!' >&2
+ print '' >&2
+ print 'See our refcard for info on how to get the complete configuration:' >&2
+ print ' <http://grml.org/zsh/grml-zsh-refcard.pdf>' >&2
fi
# }}}
# searching
#f4# Search for newspostings from authors
agoogle() { ${=BROWSER} "http://groups.google.com/groups?as_uauthors=$*" ; }
-#f4# Search Debian Bug Tracking System by BugID in mbox format
-debbug() {
+#f4# Search Debian Bug Tracking System
+debbug() {
setopt localoptions extendedglob
if [[ $# -eq 1 ]]; then
case "$1" in
return 1
fi
}
-#f4# Search Debian Bug Tracking System
+#f4# Search Debian Bug Tracking System by BugID in mbox format
debbugm() { bts show --mbox $1 } # provide bugnummer as "$1"
#f4# Search DMOZ
dmoz() { ${=BROWSER} http://search.dmoz.org/cgi-bin/search\?search=${1// /_} }
fi
}
+# Function Usage: uopen $URL/$file
+#f5# Download a file and display it locally
+uopen() {
+ if ! [[ -n "$1" ]] ; then
+ print "Usage: uopen \$URL/\$file">&2
+ return 1
+ else
+ FILE=$1
+ MIME=$(curl --head $FILE | grep Content-Type | cut -d ' ' -f 2 | cut -d\; -f 1)
+ MIME=${MIME%$'\r'}
+ curl $FILE | see ${MIME}:-
+ fi
+}
# Function Usage: doc packagename
#f5# \kbd{cd} to /usr/share/doc/\textit{package}
*.tgz) tar -ztf $1 ;;
*.zip) unzip -l $1 ;;
*.bz2) bzless $1 ;;
+ *.deb) dpkg-deb --fsys-tarfile $1 | tar -tf - -- ;;
*) echo "'$1' Error. Please go away" ;;
esac
else
fi
}
+# function ansi-colors()
+#f5# Display ANSI colors
+ansi-colors() {
+ typeset esc="\033[" line1 line2
+ echo " _ _ _40 _ _ _41_ _ _ _42 _ _ 43_ _ _ 44_ _ _45 _ _ _ 46_ _ _ 47_ _ _ 49_ _"
+ for fore in 30 31 32 33 34 35 36 37; do
+ line1="$fore "
+ line2=" "
+ for back in 40 41 42 43 44 45 46 47 49; do
+ line1="${line1}${esc}${back};${fore}m Normal ${esc}0m"
+ line2="${line2}${esc}${back};${fore};1m Bold ${esc}0m"
+ done
+ echo -e "$line1\n$line2"
+ done
+}
+
# suidfind() { ls -latg $path | grep '^...s' }
#f5# Find all files in \$PATH with setuid bit set
suidfind() { ls -latg $path/*(sN) }
}
#f5# Get specific git diff
-git-get-plaindiff() {
+git-get-plaindiff () {
if [[ -z $GITTREE ]] ; then
- GITTREE='linux/kernel/git/torvalds/linux-2.6.git'
+ GITTREE='linux/kernel/git/torvalds/linux-2.6.git'
fi
- if ! [[ -z $1 ]] ; then
- wget "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O $1.diff
+ if [[ -z $1 ]] ; then
+ echo 'Usage: git-get-plaindiff '
else
- echo 'Usage: git-get-plaindiff '
+ echo -n "Downloading $1.diff ... "
+ # avoid "generating ..." stuff from kernel.org server:
+ wget --quiet "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O /dev/null
+ wget --quiet "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O $1.diff \
+ && echo done || echo failed
fi
}
+
# http://strcat.de/blog/index.php?/archives/335-Software-sauber-deinstallieren...html
#f5# Log 'make install' output
mmake() {
# modifications in ~/.zshrc.local
xsource "${HOME}/.zshrc.local"
-# ...and remove utility functions again.
-xunfunction
-
# }}}
### doc strings for external functions from files