1 # Globbing is simple? Sure .. See zshexpn(1) /Glob Qualifiers for details and
11 * executable plain files (0100)
12 % device files (character or block special)
13 %b block special files
14 %c character special files
15 r owner-readable files (0400)
16 w owner-writable files (0200)
17 x owner-executable files (0100)
18 A group-readable files (0040)
19 I group-writable files (0020)
20 E group-executable files (0010)
21 R world-readable files (0004)
22 W world-writable files (0002)
23 X world-executable files (0001)
24 s setuid files (04000)
25 S setgid files (02000)
26 t files with the sticky bit (01000)
27 print *(m-1) # Dateien, die vor bis zu einem Tag modifiziert wurden.
28 print *(a1) # Dateien, auf die vor einem Tag zugegriffen wurde.
29 print *(@) # Nur Links
30 print *(Lk+50) # Dateien die ueber 50 Kilobytes grosz sind
31 print *(Lk-50) # Dateien die kleiner als 50 Kilobytes sind
32 print **/*.c # Alle *.c - Dateien unterhalb von \$PWD
33 print **/*.c~file.c # Alle *.c - Dateien, aber nicht 'file.c'
34 print (foo|bar).* # Alle Dateien mit 'foo' und / oder 'bar' am Anfang
35 print *~*.* # Nur Dateien ohne '.' in Namen
36 chmod 644 *(.^x) # make all non-executable files publically readable
37 print -l *(.c|.h) # Nur Dateien mit dem Suffix '.c' und / oder '.h'
38 print **/*(g:users:) # Alle Dateien/Verzeichnisse der Gruppe >users<
39 echo /proc/*/cwd(:h:t:s/self//) # Analog zu >ps ax | awk '{print $1}'<"
42 # colorizing the output of make
43 if [[ -x ~/bin/makefilter ]]
45 make() { command make "$@" |& makefilter }
48 # check if ~/.errorlogs/ exist (otherwise create it) and create a
49 # ``logfile'' e. g. ``makelog-vim-6.3''
52 [[ ! -d ~/.errorlogs ]] && mkdir ~/.errorlogs
53 =make -n install > ~/.errorlogs/${PWD##*/}-makelog
56 # Search for the argument in the system libraries
59 nm -go /usr/lib/lib*.a /usr/lobal/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"":[[:xdigit:]]\{8\} . .*$1"
65 FILES=(*~(N) .*~(N) \#*\#(N) *.o(N) a.out(N) *.core(N) *.cmo(N) *.cmi(N) .*.swp(N))
67 if [[ $NBFILES > 0 ]]; then
70 echo -n "Remove this files? [y/n] "
75 echo ">> $PWD purged, $NBFILES files removed"
77 echo "Ok. .. than not.."
82 # display a of possible passwords.
83 function makepasswords()
86 my @a = ("a".."z","A".."Z","0".."9",(split //, q{#@,.<>$%&()*^}));
88 print join "", map { \$a[rand @a] } (1..rand(3)+7);
93 # AUTOMATIC ls on chpwd *if* directly isn't too big.
94 # Not really needed ;o)
97 # integer ls_lines="$(ls -C | wc -l)"
98 # if [ $ls_lines -eq 0 ]; then
99 # echo No files found: Empty Directory
100 # elif [ $ls_lines -le 18 ]; then
102 # echo "\e[1;32m --[ Items: `ls -l | wc -l` \e[1;32m]--"
104 # echo Directory Exceeds Limits.
108 # ssh-add -- wrap ssh-add to default to adding all identities in
113 if [[ $# -eq 0 ]] ; then
114 for i in id_dsa id_rsa identity ; do
115 if [[ -f $HOME/.ssh/$i ]] ; then
116 files=($files $HOME/.ssh/$i)
122 command ssh-add $files
125 # Name (``hash -d'') all the subdirectories in given directory
126 # $ mkdir -p foo/{bar,foo,fnord,recursion}
132 # recursion=foo/recursion
133 function quick-hash()
141 # print current settings of LC_*
146 print LC_CTYPE=$LC_CTYPE
147 print LC_NUMERIC=$LC_NUMERIC
148 print LC_TIME=$LC_TIME
149 print LC_COLLATE=$LC_COLLATE
150 print LC_MONETARY=$LC_MONETARY
151 print LC_MESSAGES=$LC_MESSAGES
152 print LC_PAPER=$LC_PAPER
153 print LC_NAME=$LC_NAME
154 print LC_ADDRESS=$LC_ADDRESS
155 print LC_TELEPHONE=$LC_TELEPHONE
156 print LC_MEASUREMENT=$LC_MEASUREMENT
157 print LC_IDENTIFICATION=$LC_IDENTIFICATION
159 # a clock in the prompt.
168 # COL=$[COL-$#STRING]
169 # x=$(echo $PREBUFFER | wc -l )
171 # echo -n "
\e7
\e[$x;A
\e[$COL;G
\e[0;37;44m-- $STRING --
\e[0m
\e8"
174 # invoke this every time when u change .zshrc to recompile it.
177 autoload -U zrecompile
178 [ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
179 [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
180 [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
181 [ -f ~/.zshrc.zwc.old ] && rm -f ~/.zshrc.zwc.old
182 [ -f ~/.zcompdump.zwc.old ] && rm -f ~/.zcompdump.zwc.old
186 # Search for links in a directory and format the output
187 # Note: '~/.fnord.awk' is a *very* simple script based on >awk<.
189 # | $ cat ~/bin/fnord.awk
192 # | regexp = regexp "((http|ftp)://)"
193 # | regexp = regexp "[-0-9A-Za-z#%&+./:;?_~]"
194 # | regexp = regexp "*[-0-9A-Za-z#%&+/:;?_~]"
197 # | while (match($0, regexp))
199 # | print substr($0, RSTART, RLENGTH)
200 # | $0 = substr($0, RSTART + RLENGTH)
205 function URL-search()
209 echo "Usage : $0 directory"
210 echo "Example : $0 ~/Mail"
211 echo "Example : $0 directory | \$PAGER"
212 echo "Example : $0 directory > logfile"
214 egrep -r -h -i '((ftp|https|http|www):.*)' $1 | awk -f ~/bin/fnord.awk | sort | uniq
219 function cvsd() { cvs diff -N $* |& $PAGER }
220 function cvsl() { cvs log $* |& $PAGER }
221 function cvsr() { rcs2log $* | $PAGER }
222 function cvss() { cvs status -v $* }
223 function cvsq() { cvs -nq update }
224 function cvsa() { cvs add $* && cvs com -m 'initial checkin' $* }
226 # Display the permissions in octal from given file. Not really needed.
227 # Use http://www.strcat.de/hacks/perm-oktal.pl instead
228 # function perm-oktal()
230 # echo $1 | perl -e 'chomp($s=<>);$p=(stat($s))[2] & 07777;printf "$s -> %04o\n",$p'
234 # *narf* .. 'translate' looks up fot a word in a file with language-to-language
235 # translations (field separator should be " : "). A typical wordlist looks
237 # | english-word : german-transmission
238 # It's also only possible to translate english to german but not reciprocal.
239 # Use the following oneliner to turn back the sort order:
240 # $ awk -F ':' '{ print $2" : "$1" "$3 }' \
241 # /usr/local/lib/words/en-de.ISO-8859-1.vok > ~/.translate/de-en.ISO-8859-1.vok
245 -[dD]*) translate -l de-en $2
247 -[eE]*) translate -l en-de $2
250 echo "Usage: $0 { -D | -E }"
251 echo " -D == German to English"
252 echo " -E == English to German"
256 # Some quick Perl-hacks aka /useful/ oneliner
257 function bew() { perl -e 'print unpack "B*","'$1'"' ; perl -e 'print "\n"' }
258 function web() { perl -e 'print pack "B*","'$1'"' ; perl -e 'print "\n"' }
259 function hew() { perl -e 'print unpack "H*","'$1'"' ; perl -e 'print "\n"' }
260 function weh() { perl -e 'print pack "H*","'$1'"' ; perl -e 'print "\n"' }
261 function pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
262 function getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
263 function gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
264 function getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
265 function getforms () { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
266 function getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
267 function getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
268 function showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
269 function vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
270 function vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }
272 # set the DISPLAY to where i'm logged from or - if an argument is specified -
273 # to the value of the argument
278 DISPLAY=$(who am i | awk '{print $6}' | tr -d '()'):0
285 # adds a directory to the PATH, without making duplicate entries
286 function add_to_path()
290 echo "Usage: $0 directory"
294 for i in ${(s.:.)PATH}
296 SPACEPATH=( $SPACEPATH $i )
299 if [[ -d "$1" ]]; then; SPACEPATH=( $SPACEPATH "$1" ); fi
300 PATH="`echo $SPACEPATH`"
307 # Shameless stolen from Sven Guckes (<http://www.guckes.net/setup/zshrc.mine>)
308 # _lap foo -- list all programs with prefix "foo":
313 echo "Usage: $0 program"
314 echo "Example: $0 zsh"
315 echo "Lists all occurrences of program in the current PATH."
317 ls -l ${^path}/*$1*(*N)
321 # A life without 'diff'? Unimaginably!!!!11!
322 function mdiff() { diff -udrP "$1" "$2" > diff.`date "+%Y-%m-%d"`."$1" }
323 function udiff() { diff -urd $* | egrep -v "^Only in |^Binary files " }
324 function cdiff() { diff -crd $* | egrep -v "^Only in |^Binary files " }
326 # List / Search / Browse in a archive without unpack
327 function lynxbzgrep() { lynx -force_html -dump =(bzip2 -cd $1) | grep -i $2 }
328 function browse-archive() { lynx -force_html <( gzip -cd $1 ) }
330 # show/search signatures ;-)
331 # random-signature.pl can be found at
332 # <http://www.strcat.de/hacks/random-signature.pl>
335 if [[ $# = 0 ]]; then
336 random-signature.pl; < ~/.signature
338 agrep -d "^-- $" $@ ~/.sigs/own-stuff
343 function mcd() { mkdir "$1"; cd "$1" }
346 # $ -r-xr-xr-x 1 root bin 167936 Oct 4 2002 /bin/ls
348 # $ -r-xr-xr-x 1 root bin 167936 Oct 4 2002 /bin/ls
349 function pls() { ls -l =$1 }
352 function cl() { cd $1 && ls -a }
354 # Use vim to convert plaintext to HTML
355 function 2html() { vim -n -c ':so $VIMRUNTIME/syntax/2html.vim' -c ':wqa' $1 > /dev/null 2> /dev/null }
357 # Often needed (if i rape '$LS_COLORS' again *g*)
361 echo -e "\t 40\t 41\t 42\t 43\t 44\t 45\t 46\t 47"
362 for fore in 30 31 32 33 34 35 36 37; do
365 for back in 40 41 42 43 44 45 46 47; do
366 line1="${line1}${esc}${back};${fore}m Normal ${esc}0m"
367 line2="${line2}${esc}${back};${fore};1m Bold ${esc}0m"
369 echo -e "$line1\n$line2"
373 # Usage: simple-extract <file>
374 # Description: extracts archived files (maybe)
380 *.tar.bz2) bzip2 -v -d $1 ;;
381 *.tar.gz) tar -xvzf $1 ;;
384 *.bz2) bzip2 -d $1 ;;
386 *.gz) gunzip -d $1 ;;
387 *.tar) tar -xvf $1 ;;
388 *.tgz) gunzip -d $1 ;;
389 *.tbz2) tar -jxvf $1 ;;
391 *.Z) uncompress $1 ;;
392 *) echo "'$1' Error. Please go away" ;;
395 echo "'$1' is not a valid file"
399 # Usage: smartcompress <file> (<type>)
400 # Description: compresses files or a directory. Defaults to tar.gz
405 tgz | tar.gz) tar -zcvf$1.$2 $1 ;;
406 tbz2 | tar.bz2) tar -jcvf$1.$2 $1 ;;
407 tar.Z) tar -Zcvf$1.$2 $1 ;;
408 tar) tar -cvf$1.$2 $1 ;;
409 gz | gzip) gzip $1 ;;
410 bz2 | bzip2) bzip2 $1 ;;
412 echo "Error: $2 is not a valid compression type"
416 smartcompress $1 tar.gz
420 # Usage: show-archive <archive>
421 # Description: view archive without unpack
427 *.tar.gz) gunzip -c $1 | tar -tf - -- ;;
429 *.tgz) tar -ztf $1 ;;
430 *.zip) unzip -l $1 ;;
432 *) echo "'$1' Error. Please go away" ;;
435 echo "'$1' is not a valid archive"
439 # find process and kill it
440 morons() { reply=(`ps ax | grep -v COMMAND |perl -nle '@a=split(" ",$_,9);$_=$a[4];s/[()]//g;s/.*\///g;print'`) }
441 compctl -K morons pskill pkill
445 if [[ $1 == "" || $3 != "" ]]; then
446 print "Usage: $0 processname [signal]" && return 1
448 [[ $2 != "" ]] && signal=$2
449 set -A pids $(command ps wwaux | grep $1 | grep -v "grep $1" | awk '{ print $2 }')
450 if [[ ${#pids} -lt 1 ]]; then
451 print "No matching processes for »$1«" && return 1
453 if [[ ${#pids} -gt 1 ]]; then
454 print "${#pids} processes matched: $pids"
455 read -q "?Kill all? [y/n] " || return 0
457 if kill -$signal $pids; then
458 echo "Killed $1 pid $pids with SIG$signal"
462 # Use 'view' to read manpages, if u want colors, regex - search, ...
464 # It's shameless stolen from <http://www.vim.org/tips/tip.php?tip_id=167>
465 function vman() { man $* | col -b | view -c 'set ft=man nomod nolist' - }
469 # | $ (cd $PORTS_DIR && make print-index ~/.ports)
470 # | $ grep -i "^Port.*xchat-" -B1 -A8 .ports
472 # | Port: xchat-1.8.11
474 # | Info: X-Chat is an X11 IRC client
475 # | Maint: Damien Couderc <couderc@openbsd.org>
477 # | L-deps: gdk_pixbuf::graphics/gdk-pixbuf iconv.2::converters/libiconv intl.1:gettext->=0.10.38:devel/gettext
478 # | B-deps: :devel/gmake bzip2-*:archivers/bzip2 gettext->=0.10.38:devel/gettext
479 # | R-deps: gettext->=0.10.38:devel/gettext libiconv-*:converters/libiconv
482 if [ "${OS}" = openbsd ]; then
486 -p) =grep -i "^Port.*$2" -B1 -A8 ~/.ports
488 -i) =grep -i "^Info.*$2" -B1 -A5 ~/.ports
491 echo "Usage: $0 {-i | -p } string }"
492 echo " -i (Info) Search parse Info:"
493 echo " -p (Port) Search parse Port:"
498 # Exchange ' ' for '_' in filenames.
501 for _spaced in "${@:+"$@"}"; do
502 if [ ! -f "${_spaced}" ]; then
505 _underscored=$(echo ${_spaced} | tr ' ' '_');
506 if [ "${_underscored}" != "${_spaced}" ]; then
507 mv "${_spaced}" "${_underscored}";
512 # summarized google, ggogle, mggogle, agoogle and fm
516 -g) ${BROWSER:-lynx} "http://www.google.com/search?q="$2""
518 -u) ${BROWSER:-lynx} "http://groups.google.com/groups?q="$2""
520 -m) ${BROWSER:-lynx} "http://groups.google.com/groups?selm="$2""
522 -a) ${BROWSER:-lynx} "http://groups.google.com/groups?as_uauthors="$2""
524 -c) ${BROWSER:-lynx} "http://search.cpan.org/search?query="$2"&mode=module"
526 -f) ${BROWSER:-lynx} "http://freshmeat.net/search/?q=$2§ion=projects"
528 -F) ${BROWSER:-lynx} "http://www.filewatcher.com/?q="$2""
530 -s) ${BROWSER:-lynx} "http://sourceforge.net/search/?type=soft&q="$2""
533 echo "Usage: $0 {-g | -u | -m | -a | -f | -c | -F}"
534 echo " -g: Searching for keyword in google.com"
535 echo " -u: Searching for keyword in groups.google.com"
536 echo " -m: Searching for message-id in groups.google.com"
537 echo " -a: Searching for Authors in groups.google.com"
538 echo " -c: Searching for Modules on cpan.org."
539 echo " -f: Searching for projects on Freshmeat."
540 echo " -F: Searching for packages on FileWatcher."
541 echo " -s: Searching for software on Sourceforge."
545 # Quick&dirty hack to read heise-news (<http://www.heise.de/>
550 if [[ -s tmp/heise.rdf ]]
554 wget -q -O - http://heise.de/newsticker/heise.rdf |\
555 sed -e '/title/!d;s, <title>\(.*\)</title>,\1,' -e '/heise online/d' ;
559 # make screenshot of current desktop (use 'import' from ImageMagic)
560 # See man date(1) and man import(1) for details.
561 # Note: If you don't have 'import', install ImageMagick and stop
565 [[ ! -d ~/shots ]] && mkdir ~/shots
566 cd ~/shots ; sleep 5 ; import -window root -depth 8 -quality 80 `date "+%Y-%m-%d%--%H:%M:%S"`.png
567 # cd ~/shots && sleep 5; import -window root `date "+%Y-%m-%d%--%H:%M:%S"`.jpg
576 echo "Usage: $0 foo.gif"
577 echo "Purpose: change a GIF file to a PNG file"
579 output=`basename $1 .gif`.png
586 # search for various types or README file in dir and display them in $PAGER
587 # function readme() { $PAGER -- (#ia3)readme* }
591 files=(./(#i)*(read*me|lue*m(in|)ut)*(ND))
595 print 'No README files. Please lart \$MAINTAINER!'
599 # find all suid files in $PATH
600 function suidfind() { ls -latg ${(s.:.)PATH} | grep '^...s' }
602 # See above but this is /better/ ... anywise ..
603 # Note: Add $USER and 'find' with "NOPASSWD" in your /etc/sudoers or run it
607 sudo find / -type f \( -perm -4000 -o -perm -2000 \) -ls > ~/.suid/suidfiles.`date "+%Y-%m-%d"`.out 2>&1
608 sudo find / -type d \( -perm -4000 -o -perm -2000 \) -ls > ~/.suid/suiddirs.`date "+%Y-%m-%d"`.out 2>&1
609 sudo find / -type f \( -perm -2 -o -perm -20 \) -ls > ~/.suid/writefiles.`date "+%Y-%m-%d"`.out 2>&1
610 sudo find / -type d \( -perm -2 -o -perm -20 \) -ls > ~/.suid/writedirs.`date "+%Y-%m-%d"`.out 2>&1
614 setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" }
616 # if [ Now-Playing == "relaxmusic" ];then .. ;-)
622 echo " .=])' (; ([ PANTS OFF!"
629 # Add directory to a bookmark-list
630 # % bmadd # add directory to bookmark list
631 # % bmls # show list of bookmark list
632 # % bmvi # edit bookmark list
633 # % bm $NUMBER # change directory to $NUMBER bookmark
636 bmls() { cat $BMRC | sort -n}
642 for bmname in `bm_path_list`
644 if [ "$bmname" = "$bmdir" ]; then
645 echo "$bmdir is already in bm list"
649 if [ -z $newid ]; then
650 maxid=`cat $BMRC | cut -f 1 | sort -n -r | head -1`
651 if [ "$maxid" -ge 1 ]; then
652 newid=`expr 0$maxid + 1`
657 echo "$newid\t$bmdir" >> $BMRC
661 local bmdir=`bm_get $num`
662 if [ -z "$bmdir" ]; then
664 [ -z "$num" ] || echo "$num is not in bm list"
670 local bmdir=`cat $BMRC | egrep "^${1}[[:space:]]" | cut -f 2`
678 # Temporary (interactive) removes. Alternative to this u can use
679 # http://www.strcat.de/hacks/rm-replacements.shar
682 [[ -z ${SHITDIR} ]] && print "No ${SHITDIR} defined." && return 1
683 [[ ! -d ${SHITDIR} ]] && mkdir ${SHITDIR}
697 # a small check to see which DIR is located on which server/partition.
698 # stolen and modified from Sven's zshrc.forall
701 for dir in ${(s.:.)PATH};
703 (cd $dir; echo "-<$dir>"; du -shx .; echo);
707 # Create a archive for my homepage (<http://strcat.neessen.net/>)
710 cd ~/homepage/dotfiles/zsh
711 cp ~/.zlogin ~/homepage/dotfiles/zsh/zlogin
712 cp ~/.zlogout ~/homepage/dotfiles/zsh/zlogout
713 cp ~/.zshrc ~/homepage/dotfiles/zsh/zshrc
714 cp ~/.zsh/z* ~/homepage/dotfiles/zsh/
715 cd ~/homepage/dotfiles/zsh/
716 rm ~/homepage/dotfiles/zsh/zshdevel.old
718 gzip --best ~/homepage/dotfiles/zsh/dot-zsh.tar
722 # FIXME: works not so as i like
723 #--------------------------------------------------
724 # function verify() {
731 # shortname=`basename $1`
732 # md5 "$shortname" > "~/.checksums/$shortname.md5sum"
733 # echo "Verified $shortname to $shortname.md5sum"
735 # echo "Can not find $1"
739 #--------------------------------------------------
742 # Find (and print) all symbolic links without a target within the
743 # current directorytree (i. e. ll symlinks that dont point to files,
744 # directories, sockets, devices, or named pipes).
745 # Note: all three functions works but the last is nicer
746 # function brlinks() { for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i }
747 # function brlinks() { print -l **/*(@-^./=%p) }
748 function brlinks() { print -l **/*(-@) }
751 # function show_print () {
752 # for argument in "${@}"
754 #for ((i = 1; i <= ${#1} ;i++)) {
755 # print -n "${argument[i]}"
763 # display some informations
767 print "Date..: "$(date "+%Y-%m-%d %H:%M:%S")""
768 print "Shell.: Zsh $ZSH_VERSION (PID = $$, $SHLVL nests)"
769 print "Term..: $TTY ($TERM), $BAUD bauds, $COLUMNS x $LINES cars"
770 print "Login.: $LOGNAME (UID = $EUID) on $HOST"
771 print "System: $(cat /etc/[A-Za-z]*[_-][rv]e[lr]*)"
772 print "Uptime:$(uptime)"
776 # a fucking lazy poor man clock..
777 # check time every minute
779 # show time every 15 minutes
782 # if [ `date +'%M'` = '00' ] ||
783 # [ `date +'%M'` = '15' ] ||
784 # [ `date +'%M'` = '30' ] ||
785 # [ `date +'%M'` = '45' ]
787 # echo Time: `date +'%H:%M'`
792 if [ ${OS} = linux-gnu ]; then
795 make clean && make dep && make modules && make modules_install && make bzImage
801 if [ $# -ne 3 ] ; then
803 echo "$0 MAJOR MINOR SUBMINOR"
807 latest=`echo -e "GET /kdist/finger_banner HTTP/1.0\n" | netcat www.kernel.org 80 | sed -ne "/^
\r$/,//p"`
809 echo "current versions: $latest"
811 echo -n 'Used release is: '
815 SERVER=http://www.de.kernel.org/pub/linux/kernel/
816 KERNEL=$SERVER/v$1.$2/linux-$1.$2.$3.tar.bz2
817 SIGN=$SERVER/v$1.$2/linux-$1.$2.$3.tar.bz2.sign
818 echo 'starting download'
822 echo 'checking signature:'
823 gpg --verify `basename $SIGN $KERNEL` &&
832 cdrdao read-cd --device $DEVICE --driver generic-mmc audiocd.toc
833 cdrdao read-cddb --device $DEVICE --driver generic-mmc audiocd.toc
834 echo " * Would you like to burn the cd now? (yes/no)"
837 [ "$input" = "yes" ]; then
838 echo " ! Burning Audio CD"
842 echo " ! Invalid response."
849 cdrdao write --device $DEVICE --driver generic-mmc audiocd.toc
850 echo " * Should I remove the temporary files? (yes/no)"
852 if [ "$input" = "yes" ]; then
853 echo " ! Removing Temporary Files."
858 echo " ! Invalid response."
865 for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
866 for i in *.mp3; do mv "$i" `echo $i | tr ' ' '_'`; done
867 for i in *.mp3; do mpg123 -w `basename $i .mp3`.wav $i; done
869 for i in *.wav; do sox $i.wav -r 44100 $i.wav resample; done
874 echo " * Volume name "
876 echo " * ISO Name (ie. tmp.iso)"
878 echo " * Directory or File"
880 mkisofs -o ~/$iso -A $volume -allow-multidot -J -R -iso-level 3 -V $volume -R $files
883 # rmmodcomplete() looks for modules in memory, for use with "rmmod".
884 rmmodcomplete () { reply=(`/sbin/lsmod|cut -f1 -d" "|grep -v Module`) }
885 compctl -K rmmodcomplete rmmod
887 # insmodcomplete() looks for modules to use with "insmod" or
889 function insmodcomplete() { reply=(`find /lib/modules/$(uname -r)/* ! -type d -printf "%f\n"|sed "s/\.o$//"`) }
890 compctl -K insmodcomplete insmod modprobe
894 # Complete a howto-filename or FAQ-name (see howto script below).
895 # Use like "howto zsh[TAB]".
896 function howtocomplete() { reply=(`howto --find "$1"`) }
897 compctl -U -K howtocomplete howto
898 p0rncomplete() { reply=(`p0rn --find "$1"`) }
899 compctl -U -K p0rncomplete p0rn
901 # a quick hack for GNU Emacs && emacsclient
904 if [ "$1" = "" ]; then
905 echo "No file specified you have, think before you must."
907 if emacsclient -n "$1" >/dev/null 2>&1; then
908 echo "Alrite, opened $1 in the Holy Emacs."
910 echo "There's no Holy Emacs running here.. starting.."
916 # Show days since given birthday
919 if [ "$*" = "" ]; then
920 echo "Use $0 day month year"
921 echo "Example: $0 "12 aug 1999""
924 print $(( (`date +%s -d ${2:="now"}` - `date +%s -d ${1:=$BIRTHDAY}` )/60/60/24 ))
928 # generate thumbnails ;)
929 function genthumbs ()
931 rm -rf thumb-* index.html
935 <title>Images</title>
938 for f in *.(gif|jpeg|jpg|png)
940 convert -size 100x200 "$f" -resize 100x200 thumb-"$f"
941 echo " <a href=\"$f\"><img src=\"thumb-$f\"></a>" >> index.html
945 </html>" >> index.html