Import Desktop zshconfig
authorChristoph Egger <christoph@christoph-egger.org>
Sat, 1 Aug 2015 16:36:26 +0000 (18:36 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Sat, 1 Aug 2015 16:36:26 +0000 (18:36 +0200)
12 files changed:
aliases/GNU/kFreeBSD.zsh [new file with mode: 0644]
aliases/cip.zsh [new file with mode: 0644]
aliases/default.zsh [new file with mode: 0644]
aliases/home.zsh [new file with mode: 0644]
functions/cip/addpackage [new file with mode: 0644]
functions/cip/sunray_resolution [new file with mode: 0644]
functions/default/flashkill [new file with mode: 0755]
functions/default/rcut [new file with mode: 0644]
functions/home/deb.li [new file with mode: 0644]
functions/home/send-key [new file with mode: 0644]
includes/cip.zsh [new file with mode: 0644]
zshrc [new file with mode: 0644]

diff --git a/aliases/GNU/kFreeBSD.zsh b/aliases/GNU/kFreeBSD.zsh
new file mode 100644 (file)
index 0000000..e97dddc
--- /dev/null
@@ -0,0 +1 @@
+alias battery="/usr/sbin/acpiconf -i 0"
diff --git a/aliases/cip.zsh b/aliases/cip.zsh
new file mode 100644 (file)
index 0000000..c4f2b9b
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/zsh
+
+alias q3='/local/q3/bin/q3 +connect faui0sr1 +set r_fullscreen 0 +set r_customheight "1200" +set r_customwidth "1920" +set r_mode "-1"'
+alias xlock="/local/bin/xlock -logoutAuto -1 -logoutButton -1"
diff --git a/aliases/default.zsh b/aliases/default.zsh
new file mode 100644 (file)
index 0000000..423f8d3
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/zsh
+
+
+# Normal aliases
+alias l="ls --color=auto"
+alias mp="mplayer"
+alias dir="ls --color=auto"
+alias ..make="make -C .."
+alias man="LANG=\"C\" man"
+
+# Global aliases
+alias -g DNA='&>/dev/null'
+alias -g DN2='2>/dev/null'
+
diff --git a/aliases/home.zsh b/aliases/home.zsh
new file mode 100644 (file)
index 0000000..0b067cf
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/zsh
+
+alias start-wlan="sudo iwconfig wlan0 key s:4711708576427 essid 'FRITZ!Box WLAN 3050' && sudo ifup wlan0"
+alias debsign="debsign -k4008C6F9\!"
+alias wb="ssh -t grieg.debian.org wb"
diff --git a/functions/cip/addpackage b/functions/cip/addpackage
new file mode 100644 (file)
index 0000000..e0081e8
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/zsh
+
+path=(/local/${1}/bin $path)
+export PATH
+
diff --git a/functions/cip/sunray_resolution b/functions/cip/sunray_resolution
new file mode 100644 (file)
index 0000000..d0f66bf
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/zsh
+# License: GPLv3+
+
+RES=('1280x1024' '1920x1200')
+
+if [[ -n ${1} ]]; then
+       typeset -A RESMAP
+       RESMAP=('02.150' '2'
+               '02.133' '2')
+       read -A ROOM <<< $(${HOME}/bin/cipmap.sh -l|grep ${USER})
+       # Note: Alter the number below such that it reflects the
+       #       position of the Room-ID in the cipmap.sh output
+       #       for your user; counting from right to left.
+       ROOM=${ROOM[-2]}
+
+       NEXT=${RESMAP[${ROOM}]}
+       NEXT=${NEXT:-1}
+else
+       read -A CURRENT <<< $(grep '*' - < <(xrandr))
+       CURRENT=${CURRENT[1]}
+
+       for INDEX in {1..${#RES}}; do
+               if [[ "${CURRENT}" == "${RES[${INDEX}]}" ]]; then
+                       if [[ ${INDEX} -lt ${#RES} ]]; then
+                               NEXT=$(( INDEX+1 ))
+                       else
+                               NEXT=1
+                       fi
+                       break
+               fi
+       done;
+fi
+
+# Try to set new resolution.
+TRIES=1; RUN=1
+while [[ ${TRIES} -lt 33 && ${RUN} -eq 1 ]]; do
+       if xrandr -s ${RES[${NEXT}]} > /dev/null; then
+               RUN=0;
+       else
+               print -- 'Error: Failed setting resolution!'
+               print -- "       Current: ${CURRENT} - Next: ${RESOLUTIONS[${NEXT}]}"
+               sleep .1
+               (( TRIES++ ))
+       fi
+done
diff --git a/functions/default/flashkill b/functions/default/flashkill
new file mode 100755 (executable)
index 0000000..4f2b61a
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/zsh
+
+for i in `ps aux | grep flash | awk '{ print $2 }'`
+do
+  kill $i
+done
diff --git a/functions/default/rcut b/functions/default/rcut
new file mode 100644 (file)
index 0000000..a9f315b
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/zsh
+
+rev | cut "$@" | rev
+
diff --git a/functions/home/deb.li b/functions/home/deb.li
new file mode 100644 (file)
index 0000000..19e0896
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/zsh
+
+hash=$(ssh alioth.debian.org '~bzed/godebian-client/add_url' "$@")
+echo "http://deb.li/$hash"
+
diff --git a/functions/home/send-key b/functions/home/send-key
new file mode 100644 (file)
index 0000000..8028938
--- /dev/null
@@ -0,0 +1,4 @@
+for i in keyserver.siccegge.de keyring.debian.org wwwkeys.ch.pgp.net
+do
+    gpg --keyserver $i --send-keys $1
+done
diff --git a/includes/cip.zsh b/includes/cip.zsh
new file mode 100644 (file)
index 0000000..083fe23
--- /dev/null
@@ -0,0 +1 @@
+path=($path /local/bin)
diff --git a/zshrc b/zshrc
new file mode 100644 (file)
index 0000000..a6df101
--- /dev/null
+++ b/zshrc
@@ -0,0 +1,123 @@
+#!/bin/zsh
+
+setopt auto_cd extended_glob auto_pushd pushd_ignore_dups
+setopt hist_ignore_all_dups append_history extended_history hist_reduce_blanks
+setopt correct complete_in_word
+setopt prompt_subst transient_rprompt
+
+HISTFILE=~/.histfile
+HISTSIZE=10000
+SAVEHIST=12000
+DOMAIN=`hostname -f`
+
+eval `dircolors`
+eval `lesspipe`
+
+export EDITOR="emacsclient -a '' -nw"
+export PAGER=less
+
+export LESS_TERMCAP_mb=$'\e[01;31m'
+export LESS_TERMCAP_md=$'\e[01;31m'
+export LESS_TERMCAP_me=$'\e[0m'
+export LESS_TERMCAP_se=$'\e[0m'
+export LESS_TERMCAP_so=$'\e[01;44;33m'
+export LESS_TERMCAP_ue=$'\e[0m'
+export LESS_TERMCAP_us=$'\e[01;32m'
+
+autoload -Uz compinit
+autoload -Uz vcs_info
+autoload -Uz colors
+
+compinit
+vcs_info
+colors
+
+zmodload -i zsh/complist
+
+zstyle :compinstall filename '/home/christoph/.zshrc'
+zstyle ':completion:*' menu select=3
+zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2|_uni|_debian)(N) /dev/null)"}%%[# ]*}//,/ })'
+zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
+
+bindkey -e
+bindkey '\ee' backward-word 
+bindkey '\ef' forward-word
+bindkey '\e[B' down-line-or-search
+bindkey '\e[A' up-line-or-search
+bindkey '\e[28~' run-help
+
+
+
+setWindowTitle(){
+    echo -e '\033]0;'$1'\007'
+}
+
+precmd () {
+    vcs_info
+    setWindowTitle ${USER}@${HOST}
+}
+
+config=("default" "`uname -s`")
+
+case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in
+       (*.debian.org)
+               export EMAIL=christoph@debian.org
+               config=($config debian)
+               ;;
+       (faui49*.uni-erlangen.de)
+        export EMAIL=Christoph.Egger@cs.fau.de
+               config=($config i4lab)
+               ;;
+       (faui0*.informatik.uni-erlangen.de|faui48*.informatik.uni-erlangen.de)
+           export EMAIL=siccegge@cs.fau.de
+               config=($config cip)
+               ;;
+       (*.siccegge.de)
+               export MAIL=christoph@christoph-egger.org
+               config=($config home)
+               ;;
+esac
+
+PROMPT=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# '
+RPROMPT='${vcs_info_msg_0_}'
+
+export DEBEMAIL='christoph@debian.org'
+export DEBFULLNAME='Christoph Egger'
+export DEB_BUILD_OPTIONS="parallel=$(getconf _NPROCESSORS_ONLN)"
+
+
+for ftype in aliases includes
+do
+       for location in $config
+       do
+               if [ -f ~/.zsh/${ftype}/${location}.zsh ]
+               then
+                       source ~/.zsh/${ftype}/${location}.zsh
+               fi
+       done
+done
+
+
+
+karma () {
+       gpg --fingerprint $1 >> ${HOME}/karma
+       printf '\n-----\n\n' >> ${HOME}/karma
+}
+
+gpgrefresh () {
+    gpg --refresh-keys 2>&1 | grep -v 'nicht geƤndert'
+}
+
+sponsor() {
+    pkgname=`echo $i | rcut -d '/' -f 1  | cut -d '_' -f 1`
+    apt-get --download-only -t unstable $pkgname
+    dget $i
+}
+
+path=(${HOME}/bin $path)
+fpath=(${HOME}/.zsh/functions/$CONFIG ${HOME}/.zsh/functions/default $fpath)
+
+export PATH
+export FPATH
+
+alias wb="ssh -t buildd.debian.org wb"