-
Notifications
You must be signed in to change notification settings - Fork 0
/
commonrc
152 lines (129 loc) · 4.95 KB
/
commonrc
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
## .commonrc
## settings that are shared between zsh and bash
umask 077
commonrc_deps=(bc)
for d in $commonrc_deps ; do
test -x "$(which $d 2>/dev/null)" || echo "commonrc: missing dep '$d'"
done
export EDITOR=vim
# per-OS settings
case "$(uname -s)" in
Linux)
LS_OPTIONS="--color=auto"
eval "$(dircolors)"
;;
esac
## aliases
alias ..="cd ../"
alias back='cd $OLDPWD'
alias b=back
alias c="clear"
alias e="exit"
alias ls="ls $LS_OPTIONS"
alias tmux='tmux -2' # enable 256-color support
alias pasteit="curl -F 'sprunge=<-' http://sprunge.us"
alias tf=terraform
alias tg=terragrunt
alias travis-docker='docker run -it -v $(pwd):/project --rm skandyla/travis-cli'
alias ap="ansible-playbook"
alias apv="pass ansible/vault | ansible-playbook --vault=/bin/cat"
alias av="pass ansible/vault | ansible --vault=/bin/cat"
alias ave="pass ansible/vault | EDITOR=vim ansible-vault edit --vault=/bin/cat"
alias pssh="pssh -o StrictHostKeyChecking=no"
alias psudo="pssh --extra-args '-t -t'"
alias imgrename="exiv2 rename -F -r '%Y%m%d-%H%M%S'"
alias gitlog="git log --pretty=format:'%C(yellow)%h %Cred%aI %Cblue%an%Cgreen%d %Creset%s%n%b' --date=short --stat"
alias kunhealthy="kgpwide -A | egrep -v 'Completed|1/1|2/2|3/3|4/4|5/5|6/6|7/7' | tee >&2 | wc -l"
## k8s aliases
#[ -f ~/.kubectl-aliases/.kubectl-aliases ] && source ~/.kubectl-aliases/.kubectl-aliases
#function kubectl() { test $0 != kubectl && echo "+ kubectl $@" ; command kubectl $@; }
alias ktoolbox='kubectl run ktoolbox-$(echo $USER | tr . -)-$(date +"%s") -l app=ktoolbox-${USER} --rm -i --tty --image psuswe/ktoolbox --restart=Never -- /bin/bash'
alias ksiege='kubectl run ksiege-${USER}-$(date +"%s") -l app=ksiege-${USER} --rm -i --tty --image jcabillot/siege --restart=Never --command=true -- /bin/bash'
alias kg='kubectl get'
alias kd='kubectl describe'
alias kgoyaml='kubectl get -oyaml'
alias kgpv='kubectl get persistentvolume'
alias kdpv='kubectl describe persistentvolume'
alias updater-sso-login='aws sso login --profile login-updater'
if [[ "$HOME" == *"/afs/"* ]] ; then
alias keybase="keybase --socket-file /tmp/${USER}_keybase.socket" # no sockets in AFS
fi
## AWS
alias aws-login-live='aws --profile live sso login && export AWS_PROFILE="live"'
alias aws-login-construct='aws --profile construction sso login && export AWS_PROFILE="construction"'
# news server
export NNTPSERVER='news.psu.edu'
export ARCHBIN="${HOME}/bin/$(uname -s 2>/dev/null)-$(uname -m 2>/dev/null)"
## PATH
export PATH=$HOME/bin:$ARCHBIN:$HOME/.npm-global/bin:$HOME/.local/bin:/usr/heimdal/bin:/usr/heimdal/sbin:/usr/sbin:/sbin:$PATH
## add Go workspace bin dir
if [ -x "$(which go 2>&1)" ] ; then
_GOPATH="$(go env GOPATH)"
export GOPATH=${_GOPATH:-$HOME/go}
export PATH=$GOPATH/bin:$PATH
export GOPRIVATE="git.psu.edu"
fi
## kubectl krew
export PATH="$HOME/.krew/bin:$PATH"
## node.js yarn
if [ -d "$HOME/.yarn/bin" ] ; then
export PATH="$HOME/.yarn/bin:$PATH"
fi
## Scala build tool
if [ -d "$HOME/sbt/latest/bin" ] ; then
export PATH="$HOME/sbt/latest/bin:$PATH"
fi
## Zoom
if [ -d "$HOME/zoom" ] ; then
export PATH="$PATH:$HOME/zoom"
fi
## nodejs local install prefix
export NPM_CONFIG_PREFIX=~/.npm-global
## Java
if [ "$(uname -s)" = "Linux" ] ; then
export JAVA_HOME=$(readlink -f /usr/bin/java | sed -e "s|bin/java||;s|jre/$||")
export CLASSPATH="$JAVA_HOME/lib"
fi
## GPG stuff
#export PINENTRY="$HOME/bin/my-pinentry" # wrapper
#export PINENTRY_USER_DATA="curses" # default to pinentry-curses
if [ -x "$(which gpg-agent)" ] ; then
gav=$(gpg-agent --version | head -1 | awk '{ print $NF }')
test=$(echo ${gav:0:3}'<'2.1 | bc -l 2>/dev/null)
if [ "$test" = "1" ] ; then
# We only need all this cruft if we are running something older than 2.1
gpgenvfile="$HOME/.gnupg/gpg-agent.env"
if [[ -e "$gpgenvfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$gpgenvfile" | cut -d: -f 2) 2>/dev/null; then
eval "$(cat "$gpgenvfile")"
else
eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$gpgenvfile" --pinentry-program $PINENTRY)"
fi
export GPG_AGENT_INFO # the env file does not contain the export statement
export SSH_AUTH_SOCK # enable gpg-agent for ssh
fi
fi
export GPG_TTY=$(tty)
# password-store options
export PASSWORD_STORE_X_SELECTION="primary"
## system-local settings
test -f $HOME/.localrc && source $HOME/.localrc
## vscode
if [ ! -x "$(which code >/dev/null 2>/dev/null)" ] && [ -x "$(which code-oss 2>/dev/null)" ] ; then
alias code=code-oss
fi
## docker aliases
alias tqsl="docker run --rm -v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME:/home/tsql \
-e DISPLAY=unix$DISPLAY \
--name tsql \
quay.io/acobaugh/tsql"
alias az="docker run --rm -it -v ${HOME}/.azure:/root/.azure mcr.microsoft.com/azure-cli az"
## WINIT_HIDPI_FACTOR for alacritty, per hostname
case "$(hostname)" in
zirzla|xaxis)
export WINIT_HIDPI_FACTOR=1.0
# this was renamed at some point, and people don't care about backwards compatibility
export WINIT_X11_SCALE_FACTOR=$WINIT_HIDPI_FACTOR
;;
esac
## vim: syntax=sh