diff options
Diffstat (limited to '.zsh.after')
-rw-r--r-- | .zsh.after/aliases.sh | 36 | ||||
-rw-r--r-- | .zsh.after/aliases.zsh | 68 | ||||
-rw-r--r-- | .zsh.after/export.zsh | 6 | ||||
-rw-r--r-- | .zsh.after/functions.zsh | 182 | ||||
-rw-r--r-- | .zsh.after/key-bindings.zsh | 22 | ||||
-rw-r--r-- | .zsh.after/prompt.zsh | 1 | ||||
-rw-r--r-- | .zsh.after/unixpool.sh | 116 | ||||
-rw-r--r-- | .zsh.after/unixpool.zsh | 5 |
8 files changed, 436 insertions, 0 deletions
diff --git a/.zsh.after/aliases.sh b/.zsh.after/aliases.sh new file mode 100644 index 0000000..d6946c7 --- /dev/null +++ b/.zsh.after/aliases.sh @@ -0,0 +1,36 @@ +# < ALIASES +## ANDROID + alias logcats='adb logcat QMI-RIL:S QMI_FW:S QC-QDI:S QC-NETMGR:S QC-time-services:S LocSvc_api_v02:S LocSvc_utils_q:S LocSvc_utils_ll:S LocSvc_eng:S LocSvc_adapter:S GpsLocationProvider:S AK8975:S dalvikvm:S dalvikvm-heap:S alsa_ucm:S rmt_storage:S ALSAModule:S Adreno200-EGLSUB:S NetworkManagementSocketTagger:S LocationManagerService:S Sensors:S AudioStreamOutALSA:S' + alias fastbootx="fastboot -i 0x0fce" + alias vlog="vim \$(ls -1tr *.log | tail -n 1)" + +## CUSTOM COMMANDS + alias lsmnt='mount | grep \/dev\/sd' + +## HELP + alias helpdd='echo dd if=bla | pv -s 10M | dd of=blob' + +## PACMAN/APT-GET + alias Syu='sudo pacman -Syu' + alias S='sudo pacman -S $@' + alias apt-get='sudo apt-get -o Acquire::http::Pipeline-Depth=0' + +## SHELL + alias .='source' + alias ls='ls --group-directories-first --color=auto' + alias l='ls' + alias lt='ls -tr' + alias ll='ls -l' + alias llh='ls -lh' + alias llt='ls -ltr' + alias la='ls -A' + alias lla='ls -lA' + alias grep='grep --color=auto --exclude-dir=.git' + alias psgrep='ps xa | grep $1' + + alias beep="xset b 100 400 50; echo -e '\a'; xset b off" + +## SHORTCUTS + alias ncm=ncmpcpp + alias cu_omnomnom='cu -s 115200 -l ttyUSB0' +# ALIASES > diff --git a/.zsh.after/aliases.zsh b/.zsh.after/aliases.zsh new file mode 100644 index 0000000..afed6ff --- /dev/null +++ b/.zsh.after/aliases.zsh @@ -0,0 +1,68 @@ +# < ZSH ALIASES +## SOURCE ALIASES +#[ -e $HOME/.zsh.after/aliases.sh ] && source $HOME/.zsh.after/aliases.sh +## EXTENSIONS +alias -s pdf='mupdf' +alias -s ps='mupdf' +alias -s jpg='feh' +alias -s png='feh' +alias -s gif='viewnior' +alias -s gz='tar xvfz' +alias -s tgz='tar xvfz' +alias -s bz2='tar xvfj' +alias -s tbz='tar xvfj' +alias -s tlz='tar --lzma -xvf' +alias -s rar='unrar x' +alias -s tex='mkpdf' + +[ -e ~/Dropbox/sync/archlinux ] && source ~/Dropbox/sync/archlinux/handies.bashrc && source ~/Dropbox/sync/archlinux/color.bashrc && source ~/Dropbox/sync/archlinux/pacman.bashrc && source ~/Dropbox/sync/archlinux/systemd.bashrc + +alias cpx="xclip -selection clipboard" + +#load bluetooth headphone module for pulseaudio +alias bthp="pactl load-module module-bluetooth-device address='00:1B:66:01:6C:D1'" +#dir aliases +alias cd.sdu="cd /etc/systemd/system" +alias cd.sds="cd /usr/lib/systemd/system" +alias cd.courses="cd /home/dave/Dropbox/tu-berlin/courses" +alias cd.cks="cd /home/dave/Dropbox/tu-berlin/courses/SE\ Klanganalyse\ und\ Synthese/project" +alias cd.cksp="cd /home/dave/Dropbox/tu-berlin/courses/SE\ Klanganalyse\ und\ Synthese/paper" +alias cd.atlab="cd /home/dave/Dropbox/tu-berlin/courses/PR\ Audiotechnik" +alias cd.atue="cd /home/dave/Dropbox/tu-berlin/courses/UE\ Audiotechnik\ 2" +alias cd.semin="cd /home/dave/Dropbox/tu-berlin/courses/SE\ Minimal\ music\ and\ art" +alias cd.sere="cd /home/dave/Dropbox/tu-berlin/courses/SE\ Digital\ reenactments\ of\ scores\ originally\ requiring\ analog\ electronics" +alias cd.seti="cd /home/dave/Dropbox/tu-berlin/courses/SE\ Time\ and\ space\ perceptions\ in\ sound\ installations" +alias cd.archlinux="cd /home/dave/Dropbox/software/archlinux" +alias cd.syncarchlinux="cd /home/dave/Dropbox/sync/archlinux" +alias cd.scpref="cd /home/dave/.config/SuperCollider" + +#program aliases +alias octave="octave --silent --braindead" +alias matlabc="matlab -nodesktop -nosplash" +alias "dropbox restart"="dropbox stop && dropbox start" + +#nmcli aliases +alias nmup="sudo nmcli con up id" + +#ssh aliases +alias pool='ssh pool -Y' +alias sshtunnel="ssh -ND 44350 -v -p 46399 dave@frqb.zapto.org" # tunnel through home +alias frqtun="ssh -ND 44350 -v frq" +alias scp=scp + +#wake on lan aliases +alias woldave_in='wol -i dave 00:15:f2:e0:e0:c6' +alias woldave_ex='wol -p X -i frqb.zapto.org 00:15:f2:e0:e0:c6' + +#truecrypt mount aliases +alias tc.fav='truecrypt -t --protect-hidden=no -k="" --auto-mount=favorites' +alias tc.v='truecrypt -t --mount --fs-options=users,uid=$(id -u),gid=$(id -g),fmask=0113,dmask=0002 --protect-hidden=no -k="" /dev/disk/by-id/ata-ST9500325AS_6VE457TN /mnt/photos' +alias tc.m='truecrypt -t --mount --fs-options=users,uid=$(id -u),gid=$(id -g),fmask=0113,dmask=0002 --protect-hidden=no -k="" /dev/disk/by-id/ata-ST9500325AS_6VE152RS /mnt/music' +alias tc.d='truecrypt -t -d' + +## OVERRIDES + alias du='du -h' + unalias vim + unalias brew +# unalias scp +# ZSH ALIASES > diff --git a/.zsh.after/export.zsh b/.zsh.after/export.zsh new file mode 100644 index 0000000..81f117c --- /dev/null +++ b/.zsh.after/export.zsh @@ -0,0 +1,6 @@ +export REPORTTIME=30 +export PAGER="less -j4" + +## let RVM ignore global ruby +export rvm_ignore_gemrc_issues=1 + diff --git a/.zsh.after/functions.zsh b/.zsh.after/functions.zsh new file mode 100644 index 0000000..1a87ab5 --- /dev/null +++ b/.zsh.after/functions.zsh @@ -0,0 +1,182 @@ +# < FUNCTIONS + +## BACKUP + function etcbackup() { + BACKUPDIR=$HOME/dropbox/backup + HOSTNAME=$(hostname) + FILE=$1 + + if [ -f $FILE ] + then + FILENAME=$(echo $FILE | sed 's/\///' | sed 's/\//_/g') + cp -v $FILE $BACKUPDIR/$HOSTNAME/$FILENAME + else + echo $FILE does not exist + fi + } + +## COMPRESSION + function tar_tgz { + tar cvfz $1.tgz $1 + } + function tar_tbz { + tar cvfj $1.tbz $1 + } + function tar_tlz { + tar --lzma -cvf $1.tlz $1 + } + +## DOTFILES + function update_dot() { + for i in $HOME/dropbox/dot/[a-zA-Z]*; + do + if [ -f $i ]; + then + echo file $i + base=`basename $i` + dst=$HOME/.$base + bak=$HOME/.${base}_bak + + case $base in + vimrc|zshrc|*tgz) + echo nothing $i + ;; + *) + if [ -L $dst ]; + then + rm $dst + else + mv $dst $bak + fi + ln -s $i $dst + ;; + esac + + else + if [ -d $i ]; + then + echo dir $i + base=`basename $i | sed 's/_/\//'` + dst=$HOME/.$base + bak=$HOME/.${base}_bak + + case $base in + "vim") + echo nothing $i + ;; + *) + if [ -e $dst ]; + then + if [ -L $dst ]; + then + rm $dst + else + mv $dst $bak + fi + fi + ln -s $i $dst + ;; + esac + else + echo unknown $i + fi + fi + done + } + +## PDF/LATEX + function mkpdf() + { + pdflatex -shell-escape $1 + # latex --output-format=pdf $1 + name=`echo $1 | sed 's/.tex//'` + EXT=(aux log) + for i in $EXT; + do + rm -v $name.$i + done + } + + function gsmerge() + { + target=$1 + echo "target: $target" + sleep 1 + shift + + /usr/bin/gs \ + -sDEVICE=pdfwrite \ + -dCompatibilityLevel=1.4 \ + -dNOPAUSE \ + -dBATCH \ + -sPAPERSIZE=a4 \ + -sOUTPUTFILE=$target $* + } + + function gsmerge_medium() + { + target=$1 + echo "target: $target" + sleep 1 + shift + + /usr/bin/gs \ + -sDEVICE=pdfwrite \ + -dPDFSETTINGS=/ebook \ + -dCompatibilityLevel=1.4 \ + -dNOPAUSE \ + -dBATCH \ + -sPAPERSIZE=a4 \ + -sOutputFile=$target $* + } + +## USABILITY + function lvim() + { + noglob vim $(echo $1 | awk -F":" '{ print $1" +"$2 }' ) + } + + function mkcd() + { + mkdir $1 + cd $1 + } + + function cpwd() + { + pwd >! /tmp/pwd + } + + function ppwd() + { + cd "`cat /tmp/pwd`" + } + + function cp2wd() + { + cp $@ "`cat /tmp/pwd`" + } + +function publish() { + [ -f $1 ] || return + + DIR=`dirname $1` + FILE=`basename $1` + mute pushd $DIR + scp $FILE pool:public_html/ + echo "http://www-pool.math.tu-berlin.de/~runge/$FILE" + echo "http://www-pool.math.tu-berlin.de/~runge/$FILE"|xcp + mute popd +} + +function securium { + port=44350 + chromium --proxy-server="socks://localhost:$port" & + exit +} + +## ZSH + refresh() { + source $HOME/.zshrc + } +# FUNCTIONS > diff --git a/.zsh.after/key-bindings.zsh b/.zsh.after/key-bindings.zsh new file mode 100644 index 0000000..300b3c7 --- /dev/null +++ b/.zsh.after/key-bindings.zsh @@ -0,0 +1,22 @@ +## OVERRIDE KEY-BINDINGS +bindkey -s '\e,' '..\n' # [Esc-,] - run command: .. (up directory) +bindkey '\e.' insert-last-word # [Esc-.] - insert last word +#bindkey '^[Oc' forward-word # [Ctrl-RightArrow] - move forward one word +#bindkey '^[OC' forward-word # [Ctrl-RightArrow] - move forward one word +#bindkey '^[Od' backward-word # [Ctrl-LeftArrow] - move backward one word +#bindkey '^[OD' backward-word # [Ctrl-LeftArrow] - move backward one word + +## URXVT & TMUX +case $TERM in + rxvt-unicode-256color) + bindkey '^[Oc' forward-word # [Ctrl-RightArrow] - move forward one word + bindkey '^[Od' backward-word # [Ctrl-LeftArrow] - move backward one word + ;; + screen-256color) + bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - tmux: move forward one word + bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - tmux: move backward one word + ;; +esac + +## NEW KEY-BINDINGS +bindkey '^K' kill-line diff --git a/.zsh.after/prompt.zsh b/.zsh.after/prompt.zsh new file mode 100644 index 0000000..2efeb64 --- /dev/null +++ b/.zsh.after/prompt.zsh @@ -0,0 +1 @@ +PROMPT="${__PROMPT_SKWP_COLORS[3]}%n%f@${__PROMPT_SKWP_COLORS[2]}%m%f ${__PROMPT_SKWP_COLORS[5]}%2c%f "'${vcs_info_msg_0_}'"$ " diff --git a/.zsh.after/unixpool.sh b/.zsh.after/unixpool.sh new file mode 100644 index 0000000..0a171bd --- /dev/null +++ b/.zsh.after/unixpool.sh @@ -0,0 +1,116 @@ +# host based zshrc +# unixpool + +#HISTFILE=$HOME/.zhistory + +# set pulseaudio server to s4 +if [ -f "`which pax11publish`" ]; +then + if [ ! $SSH_CLIENT ]; + then + if [ `pax11publish | grep -c s4` -eq 0 ]; + then + echo pulseaudio server set + pax11publish -S s4 -e + else + echo pulseaudio active + fi + fi +fi + +#export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.16/jre + +alias synergys='synergys -c .synergy-$HOST.conf' + +function music_update() { + echo "updating zip files" + for i in */*; + do + name=`echo $i | sed 's/\ /_/g' | sed 's/\//-/g'` + if [ ! -e $name.zip ]; + then + echo "packing $i as $name.zip" + zip -r $name.zip $i + fi + done + echo "done" +} + +PATH=${PATH}:/net/local64/bin +PATH=${PATH}:/net/adm/bin +PATH=${PATH}:/net/adm/scripts +PATH=${PATH}:/net/adm/xadm + +PATH=${PATH}:/homes/wheel/wheel/bin + +#PATH=/store/s4/android/android-sdk-linux_86/tools:$PATH +#PATH=/store/s4/android/android-sdk-linux_86/platform-tools:$PATH + +function makantine() { + wget http://personalkantine.personalabteilung.tu-berlin.de/pdf/MA-aktuell.pdf -O /tmp/makantine.$$.pdf >&/dev/null + xpdf -cont -z page /tmp/makantine.$$.pdf + rm -f /tmp/makantine.$$.pdf +} + +function pxeln() { + local instmode host oldumask bopts="" isrc="" + while [ -n "$1" ]; do + if [[ "$1" == -o* ]]; then + [ -z "$bopts" ] && bopts="bootopts=${1:2}" || bopts="${bopts},${1:2}"; + else + if [ -z "$instmode" ]; then instmode="$1"; + elif [ -z "$host" ]; then host="$1"; + else echo "Ignoring superfluous argument \"$1\"."; + fi + fi + + shift + done + if [[ -z "$instmode" || -z "$host" ]]; then + echo -e "Missing argument!\nSyntax: pxeln {mode} {host}\n(use tab completion for available modes)" >/dev/stderr + return 1 + fi + local IP=$(egrep "^[^,]*,${host}," /net/adm/access/HWlist |cut -d, -f1|cut -d. -f4) + local M="01-$(egrep " $IP " /net/adm/access/MAClist 2>/dev/null|sed -e "s/^|[^|]*| \([0-9a-f:]*\) |/\1/" -e "y/:/-/")" + if [[ ${#M} -ne 20 ]]; then + echo "Unknown host." >/dev/stderr + return 1 + fi + shift 2 + oldumask=$(umask -p) + umask 0022 + local instmodetl=$(tr [:upper:] [:lower:]<<<$instmode) + if [ -s /homes/ext15a/tftpboot/pxelinux.cfg/${instmode}.sed ]; then + if [ -e /homes/ext15a/tftpboot/pxelinux.cfg/$M ]; then + rm -f /homes/ext15a/tftpboot/pxelinux.cfg/$M + echo "$host: former PXE diversion removed." + fi + sed /homes/ext15a/tftpboot/pxelinux.cfg/_template \ + -f /homes/ext15a/tftpboot/pxelinux.cfg/${instmode}.sed \ + > /homes/ext15a/tftpboot/pxelinux.cfg/$M + echo -n "$host: elected for ${instmode}" + if [ -n "$bopts" ]; then + sed -i -e "/bootmode=${instmodetl}/ s/$/ ${bopts}/" /homes/ext15a/tftpboot/pxelinux.cfg/$M + echo -n " (with extra boot options: \"$bopts\")" + fi + echo "." + elif [ "$instmode" == "remove" ]; then + rm -f /homes/ext15a/tftpboot/pxelinux.cfg/$M + echo "$host: PXE diversion removed." + else + echo "Unknown PXE mode." >/dev/stderr + fi + $oldumask + return 0 +} + +function mailhighscore() { + for i in /homes/wheel/*; do n=`basename $i`; echo `grep $n /var/spool/mail/konni | grep -c From` $n; done | sort -nr +} +alias lp_ps1_100='lp -q 100 -d ps1' +alias lp_ps2_100='lp -q 100 -d ps2' +alias QW='xterm -geometry 84x41-0+0 -T '\''QWatch'\'' -fn 5x8 -e /homes/misc/lpviewer/lpdisp' +alias QWbig='xterm -geometry 84x41-0+0 -T '\''QWatch'\'' -e /homes/misc/lpviewer/lpdisp' +alias QWbighere='/homes/misc/lpviewer/lpdisp' +alias QWdisplay="watch 'for n in {1..3}; do scli -c \"show printer display\" ps\$n-pool; done'" + diff --git a/.zsh.after/unixpool.zsh b/.zsh.after/unixpool.zsh new file mode 100644 index 0000000..592abb0 --- /dev/null +++ b/.zsh.after/unixpool.zsh @@ -0,0 +1,5 @@ +case "$HOST" in + s4|s5|c*) + . $HOME/.zsh.after/unixpool.sh + ;; +esac |