summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-05-21 16:33:25 +0200
committerPatrick Simianer <p@simianer.de>2017-05-21 16:33:25 +0200
commitd046586dc26e103dc972167524d75069097669ee (patch)
treed3dc90293dc88d48d24352e0c8227d516fa678fa
parentc2d8d631320a26ce4ec6f327cdf7a15a262afd0f (diff)
zsh
-rw-r--r--zsh/.zlogin10
-rw-r--r--zsh/.zshrc82
2 files changed, 62 insertions, 30 deletions
diff --git a/zsh/.zlogin b/zsh/.zlogin
index a6fa972..74561c3 100644
--- a/zsh/.zlogin
+++ b/zsh/.zlogin
@@ -1,5 +1,7 @@
-if [[ -z $DISPLAY ]] && (( $EUID != 0 )) {
- [[ ${TTY/tty} != $TTY ]] && (( ${TTY:8:1} <= 3 )) &&
- startx 1>/tmp/xsession-errors 2>&1 &
-}
+if [[ $(uname) == "Linux" ]]; then
+ if [[ -z $DISPLAY ]] && (( $EUID != 0 )) {
+ [[ ${TTY/tty} != $TTY ]] && (( ${TTY:8:1} <= 3 )) &&
+ startx 1>/tmp/xsession-errors 2>&1 &
+ }
+fi
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 5083153..a7ae67c 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -22,15 +22,21 @@ zstyle ':completion:*' menu select=2
zstyle :compinstall filename '~/.zshrc'
zstyle '*' hosts # do not use /etc/hosts
ZDIR=~/.zsh/
+_HOST_TYPE=$(uname)
# #############################################################################
# exports
# #############################################################################
umask 0077
-export PATH=~/.local/bin:~/scripts:$PATH
+
+export PATH=~/.local/bin:~/.local/sbin:$PATH
export PATH=/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
+if [[ -d ~/nlp_scripts ]]; then
+ export PATH=~/nlp_scripts:$PATH
+fi
+
export EDITOR='vim -p'
export LC_ALL=en_US.UTF-8
@@ -53,9 +59,13 @@ export CFLAGS="-march=native -mtune=native"
export CXXFLAGS="$CFLAGS"
export CCACHE_PATH=/usr/bin
-case `whoami` in
- root)
- export PATH=/home/pks/.local/bin:$PATH
+case $_HOST_TYPE in
+ Linux)
+ case `whoami` in
+ root)
+ export PATH=/home/pks/.local/bin:$PATH
+ ;;
+ esac
;;
esac
@@ -103,7 +113,7 @@ case `hostname` in
HOSTCOLOR_BG=white
HOSTCOLOR_FG=black
;;
- bogues|curry|iverson|nowitzki|oneal|ming|*.uberspace.de)
+ bogues*|curry*|iverson*|nowitzki*|oneal*|ming*|jordan*|*.uberspace.de)
HOSTCOLOR_BG=magenta
HOSTCOLOR_FG=black
;;
@@ -170,7 +180,20 @@ esac
# aliases
# #############################################################################
-alias ls='ls -h --color=auto'
+case $_HOST_TYPE in
+ Darwin)
+ alias ls='ls -h -G'
+ export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
+ alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
+ if [[ -d /Library/TeX/texbin/ ]]; then
+ export PATH=/Library/TeX/texbin:$PATH
+ fi
+ ;;
+ Linux)
+ alias ls='ls -h --color=auto'
+ ;;
+esac
+
alias l='ls'
alias la='ls -lA'
alias ll='ls -l'
@@ -195,36 +218,35 @@ alias thumb='convert -resize 200x200'
alias qmv='qmv -evim -fdo'
alias radio='mocp ~/.moc/radio.m3u'
-alias wifi_list='sudo iwlist wlan0 scan'
+alias muxn='tmux new -s'
+alias muxl='tmux list-sessions'
+alias muxa='tmux attach -t'
+
+alias easy_install_home='easy_install --install-dir=$HOME/.local/lib/python/site-packages'
+alias pip_home='pip install -t $HOME/.local/"'
+alias npm_install_home='npm install -g --prefix ~/.local/lib/node'
+alias castnow_home='castnow --myip 192.168.0.100 --address 192.168.0.4'
+
+alias my_ip='echo "$(curl 'https://api.ipify.org' 2>/dev/null)"'
+
+alias t_timeline='while true; do clear; t timeline -n 13 -C icon; sleep 600; done'
+if [[ $_HOST_TYPE == "Linux" ]]; then
+alias cal='while true; do clear; echo; khal calendar; sleep 600; done'
+alias wifi_list='sudo iwlist wlan0 scan'
alias always_on='xset dpms 0 0 0'
alias vgaoff='xrandr --output VGA1 --off && xrandr --output LVDS1 --mode 1024x768'
alias vgaclone='xrandr --output VGA1 --mode 1024x768'
alias vgaext='xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --rotate right'
alias vga21='xrandr --output VGA1 --mode 1600x1200 --rate 60 --rotate right && xrandr --output LVDS1 --off'
alias vga22w='xrandr --output VGA1 --mode 1680x1050 --rate 60 --rotate left && xrandr --output LVDS1 --off'
-
alias reboot='sudo shutdown -r now'
alias halt='sudo shutdown -h now'
-
alias lp2p='/usr/bin/lp -o sides=two-sided-long-edge'
alias lp4p='/usr/bin/lp -o sides=two-sided-short-edge -o number-up=2'
alias lp8p='/usr/bin/lp -o sides=two-sided-short-edge -o number-up=4 -o landscape'
alias lpimg='/usr/bin/lp -o fit-to-page'
-
-alias muxn='tmux new -s'
-alias muxl='tmux list-sessions'
-alias muxa='tmux attach -t'
-
-alias easy_install_home='easy_install --install-dir=$HOME/.local/lib/python/site-packages'
-alias pip_home='pip3 install --install-option="--install-purelib=~/.local/lib/python/site-packages"'
-alias npm_install_home='npm install -g --prefix ~/.local/lib/node'
-alias castnow_home='castnow --myip 192.168.0.100 --address 192.168.0.4'
-
-alias my_ip='echo "$(curl 'https://api.ipify.org' 2>/dev/null)"'
-
-alias cal='while true; do clear; echo; khal calendar; sleep 600; done'
-alias t_timeline='while true; do clear; t timeline -n 13 -C icon; sleep 600; done'
+fi
# #############################################################################
# functions
@@ -232,7 +254,7 @@ alias t_timeline='while true; do clear; t timeline -n 13 -C icon; sleep 600; don
diff ()
{
- if hash colordiff 2>/dev/null; then
+ if [[ -x $(which colordiff 2>/dev/null) ]]; then
colordiff "$@"
else
diff "$@"
@@ -241,7 +263,7 @@ diff ()
irb ()
{
- if hash pry 2>/dev/null; then
+ if [[ -x $(which pry 2>/dev/null) ]]; then
pry "$@"
else
irb "$@"
@@ -260,7 +282,10 @@ tln ()
watch_pdflatex ()
{
- ls $@ | entr pdflatex --interaction=batchmode $1.tex
+ echo $1
+ ls $@ | entr pdflatex --interaction=batchmode $1
+ echo "tell application \"Preview\" to activate" | osascript -
+ echo "tell application \"iTerm2\" to activate" | osascript -
}
pdfprevfile ()
@@ -268,3 +293,8 @@ pdfprevfile ()
pdftoppm $1 -f 1 -l 1 -singlefile -png
}
+getcert ()
+{
+ openssl s_client -showcerts -connect $1 <dev/null > $2
+}
+