aboutsummaryrefslogtreecommitdiffstats
path: root/.zsh.after/unixpool.sh
blob: 82556928359303659585a89db0ffd78f2a35f480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# 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'

#TODO: add pacman to apt-get conversion for all pacman aliases
alias paclid="sudo pacman -Qi | sed '/^Depends On/,/^Required By/{ s/^Required By.*$//; H; d }; /^Name/!d; /^Name/{ n;x;}'| sed '/^$/s//==================================================================================/'"
alias pacsize="pacman -Qi | awk '/^Name/ {pkg=\$3} /Size/ {print \$4\$5,pkg}' | sort -n"	#All packages by size
alias pacall="sudo pacman -Qi | awk '/^Name/ {pkg=\$3} /Version/ {ver=\$3} /Size/ {size=\$4\$5} {print pkg,ver,size}' | uniq"	#All packages uniquely with name, version, size
#alias pacremorph='sudo pacman -Rs $(pacman -Qtdq)'	#Remove all orphaned packages
alias pacup='sudo apt-get update && sudo apt-get upgrade' #'sudo pacman -Syu'	# Synchronize with repositories before upgrading packages that are out of date on the local system.
alias pac='sudo apt-get install ' #'sudo pacman -S'	# Install specific package(s) from the repositories
alias pacu='sudo pacman -U'	# Install specific package not from the repositories but from a file 
alias pacre='sudo apt-get remove '  #'sudo pacman -R'	# Remove the specified package(s), retaining its configuration(s) and required ##dependencies
alias pacrem='sudo apt-get purge '  #'sudo pacman -Rns'	# Remove specified package(s), its configuration(s) and unneeded depends
alias pacsearch="pacman -Sl | cut -d' ' -f2 | grep "	# Search through all available packages in repo
#alias pacname='dpkg -l|grep Name|grep '  #'sudo pacman -Qi|grep Name|grep ' #Search through names of packages by string
alias pacri='sudo apt-get update && sudo apt-cache show '  #'pacman -Si'	# Display information about a given package in the repositories
alias pacrs='sudo apt-get update && sudo apt-cache search '  #'pacman -Ss'	# Search for package(s) in the repositories
alias pacli='dpkg -l ' #'pacman -Qi'	# Display information about a given package in the local database
alias pacls='dpkg -l|grep '  #'pacman -Qs'	# Search for package(s) in the local database
alias pacorph='sudo pacman -Qdt'	# Search for orphan packages
alias paclist='dpkg -L' #'sudo pacman -Ql'	# List installed files of a given package
alias pacg='pacman -Sg'	#List all groups or all packages in specified group
alias pacclean='sudo pacman -Sc'	# Remove all packages from local repository, not installed atm, remove all unused repos
alias pacconf='sudo find /etc -name "*.pac*" -type f -print'	# Search for .pacnew and .pacsave files
alias pacfile='dpkg -S ' #'sudo pacman -Qo'	# Find out what package a give file belongs to
alias pacupd='sudo apt-get update'  #'sudo pacman -Sy && sudo abs'     # Update and refresh the local package and ABS databases against repositories
alias pacdep='sudo pacman -S --asdeps'        # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy'                # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
alias packup='comm -23 <(pacman -Qeq|sort) <(pacman -Qmq|sort) > $HOME/Dropbox/sync/archlinux/pkglist-$HOST' # Backup the current list of non-local packages
alias pacret='sudo pacman -S $(< $HOME/Dropbox/sync/archlinux/pkglist-$HOST)' # Install from the backup list
alias pacredown='sudo pacman -S $(comm -23 <(pacman -Qeq) <(pacman -Qmq))' # Redownload all installed packages (minus AUR)
alias pacdis='rm -f $HOME/Dropbox/sync/archlinux/non-pkg-$HOST; sudo pacman-disowned > $HOME/Dropbox/sync/archlinux/non-pkg-$HOST' # Getting a list of files not owned by any package
alias packimp='sudo pacman-key -r '	#Import a key ID to the pacman keyring
alias packsign='sudo pacman-key --lsign-key '	#Sign a key ID after importing it to the keyring
alias packref='sudo pacman-key --refresh-keys'	#Refresh the list of master keys

##Yaourt aliases
alias yaup='yaourt -Syu --devel --aur'          # Updates all locally installed repository, AUR and git packages
alias yadb='yaourt -B $HOME/Dropbox/sync/archlinux'            # Backs up the yaourt database
alias ya='sudo apt-get -t testing install '  # Install packages from AUR/Testing


# 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/konni | grep -c From` $n; done | sort -nr
}