From 5e67ee3a053f11c2a4d8461b720d1d6da9f9b269 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sat, 1 Aug 2015 18:36:26 +0200 Subject: [PATCH] Import Desktop zshconfig --- aliases/GNU/kFreeBSD.zsh | 1 + aliases/cip.zsh | 4 ++ aliases/default.zsh | 14 ++++ aliases/home.zsh | 5 ++ functions/cip/addpackage | 5 ++ functions/cip/sunray_resolution | 45 ++++++++++++ functions/default/flashkill | 6 ++ functions/default/rcut | 4 ++ functions/home/deb.li | 5 ++ functions/home/send-key | 4 ++ includes/cip.zsh | 1 + zshrc | 123 ++++++++++++++++++++++++++++++++ 12 files changed, 217 insertions(+) create mode 100644 aliases/GNU/kFreeBSD.zsh create mode 100644 aliases/cip.zsh create mode 100644 aliases/default.zsh create mode 100644 aliases/home.zsh create mode 100644 functions/cip/addpackage create mode 100644 functions/cip/sunray_resolution create mode 100755 functions/default/flashkill create mode 100644 functions/default/rcut create mode 100644 functions/home/deb.li create mode 100644 functions/home/send-key create mode 100644 includes/cip.zsh create mode 100644 zshrc diff --git a/aliases/GNU/kFreeBSD.zsh b/aliases/GNU/kFreeBSD.zsh new file mode 100644 index 0000000..e97dddc --- /dev/null +++ b/aliases/GNU/kFreeBSD.zsh @@ -0,0 +1 @@ +alias battery="/usr/sbin/acpiconf -i 0" diff --git a/aliases/cip.zsh b/aliases/cip.zsh new file mode 100644 index 0000000..c4f2b9b --- /dev/null +++ b/aliases/cip.zsh @@ -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 index 0000000..423f8d3 --- /dev/null +++ b/aliases/default.zsh @@ -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 index 0000000..0b067cf --- /dev/null +++ b/aliases/home.zsh @@ -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 index 0000000..e0081e8 --- /dev/null +++ b/functions/cip/addpackage @@ -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 index 0000000..d0f66bf --- /dev/null +++ b/functions/cip/sunray_resolution @@ -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 index 0000000..4f2b61a --- /dev/null +++ b/functions/default/flashkill @@ -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 index 0000000..a9f315b --- /dev/null +++ b/functions/default/rcut @@ -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 index 0000000..19e0896 --- /dev/null +++ b/functions/home/deb.li @@ -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 index 0000000..8028938 --- /dev/null +++ b/functions/home/send-key @@ -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 index 0000000..083fe23 --- /dev/null +++ b/includes/cip.zsh @@ -0,0 +1 @@ +path=($path /local/bin) diff --git a/zshrc b/zshrc new file mode 100644 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 'e' backward-word +bindkey 'f' forward-word +bindkey '' down-line-or-search +bindkey '' up-line-or-search +bindkey '[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" -- 2.39.2