From 3ac8e0f994839f3c972033bcb12421081ebeb683 Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 28 Sep 2021 22:50:56 +0200 Subject: zsh: move includes to XDG compliant locations .config/zsh/{functions,includes}/*: Move functions and includes to XDG compliant locations. .zshrc: Include functions and other includes from XDG compliant locations. Remove use of prepend-sudo function. --- .config/zsh/includes/unixpool | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 .config/zsh/includes/unixpool (limited to '.config/zsh/includes/unixpool') diff --git a/.config/zsh/includes/unixpool b/.config/zsh/includes/unixpool new file mode 100644 index 0000000..e2edade --- /dev/null +++ b/.config/zsh/includes/unixpool @@ -0,0 +1,125 @@ +# host based zshrc +# unixpool + +HISTFILE=$HOME/.zhistory +unset MAILCHECK + +## PATH and exports +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=${PATH}:/sbin +PATH=${PATH}:/usr/sbin +#PATH=/store/s4/android/android-sdk-linux_86/tools:$PATH +#PATH=/store/s4/android/android-sdk-linux_86/platform-tools:$PATH + +#Remove /usr/bin/X11: if it shows up in $PATH +autoload -U regexp-replace +regexp-replace PATH '/usr/bin/X11:' '' + +export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.26/jre + +## aliases +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'" +#alias pyadm="/net/adm/pyadm-64ready/start.py" +alias synergys='synergys -c .config/synergy-$HOST.conf' + +# 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 + + +## FUNCTIONS +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" +} + +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/runge | grep -c From` $n; done | sort -nr +} -- cgit v1.2.3-54-g00ecf