comparison .bash_aliases @ 198:6e7913283c7a

Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
author Steve Huston <huston@srhuston.net>
date Wed, 30 Sep 2020 11:21:14 -0400
parents 954d25f20123
children 7d3fe7399566
comparison
equal deleted inserted replaced
197:954d25f20123 198:6e7913283c7a
1 # $Id$
2
3 # Aliases are read from this file; no real reason to separate them out except 1 # Aliases are read from this file; no real reason to separate them out except
4 # for readability. 2 # for readability.
5 3
6 # Some settings which are architecture dependent 4 # Some settings which are architecture dependent
7 case `uname` in 5 case `uname` in
46 # Export some of those above for the benefit of future shells 44 # Export some of those above for the benefit of future shells
47 export DFSTAT MDATE 45 export DFSTAT MDATE
48 46
49 # SSH aliases 47 # SSH aliases
50 alias bh='ssh csesbh2.princeton.edu' 48 alias bh='ssh csesbh2.princeton.edu'
49 cert() {
50 # SSH key signing with Vault for administration
51 export VAULT_ADDR='https://ajax.rc.princeton.edu:8200'
52 ssh-add -d $HOME/.ssh/rc_vault_key-cert.pub > /dev/null 2>&1
53 if vault login -method=radius username=vi-srh; then
54 vault write -field=signed_key ssh-client-signer/sign/root public_key=@$HOME/.ssh/rc_vault_key.pub > $HOME/.ssh/rc_vault_key-cert.pub
55 ssh-add -t 36000 $HOME/.ssh/rc_vault_key
56 else
57 echo Failed to login to vault, aborting
58 fi
59 }
51 alias dh='ssh srhuston.net' 60 alias dh='ssh srhuston.net'
52 alias j='ssh joshua.srhuston.net' 61 alias j='ssh joshua.srhuston.net'
53 alias keys='ssh-add $HOME/.ssh/*.pvt' 62 alias keys='ssh-add $HOME/.ssh/*.pvt'
54 alias r='ssh -l root' 63 alias r='ssh -l root'
55 alias rf='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -l root' 64 alias rf='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -l root'
56 alias rbh='ssh -t csesbh2.princeton.edu screen -raAx csesbh2' 65 alias rbh='ssh -t csesbh2.princeton.edu screen -raAx csesbh2'
57 alias rj='ssh -t joshua.srhuston.net screen -raAx' 66 alias rj='ssh -t joshua.srhuston.net screen -raAx'
58 alias rx='ssh -t xanadu.astro.princeton.edu screen -raAx' 67 alias rx='ssh -t xanadu.astro.princeton.edu screen -raAx'
59 alias roc='ssh zenoss@rocinante'
60 alias s=ssh 68 alias s=ssh
61 alias sf='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null' 69 alias sf='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null'
62 t() { 70 t() {
71 # Tunneling SSH - a simple 't hostname' will tunnel to xanadu and then
72 # connect to hostname, while 't hostname tunnelhost' will connect to
73 # tunnelhost and then hostname
63 T_HOST=xanadu.astro.princeton.edu 74 T_HOST=xanadu.astro.princeton.edu
64 if [ -n "$2" ] ; then 75 if [ -n "$2" ] ; then
65 T_HOST=$2 76 T_HOST=$2
66 fi 77 fi
67 ssh -t $T_HOST "ssh $1" 78 ssh -t $T_HOST "ssh $1"
68 } 79 }
69 alias x='ssh xanadu.astro.princeton.edu' 80 alias x='ssh xanadu.astro.princeton.edu'
70 81
71 # SSH key signing with Vault for administration
72 cert() {
73 export VAULT_ADDR='https://ajax.rc.princeton.edu:8200'
74 ssh-add -d $HOME/.ssh/rc_vault_key-cert.pub > /dev/null 2>&1
75 if vault login -method=radius username=vi-srh; then
76 vault write -field=signed_key ssh-client-signer/sign/root public_key=@$HOME/.ssh/rc_vault_key.pub > $HOME/.ssh/rc_vault_key-cert.pub
77 ssh-add -t 36000 $HOME/.ssh/rc_vault_key
78 else
79 echo Failed to login to vault, aborting
80 fi
81 }
82 82
83 # Proxying/tunneling - predominantly for my Mac laptop 83 # Proxying/tunneling - predominantly for my Mac laptop
84 proxy() { 84 proxy() {
85 PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu} 85 PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu}
86 PROXY_PORT=${PROXY_PORT:-8888} 86 PROXY_PORT=${PROXY_PORT:-8888}
93 echo Cancel command added to history 93 echo Cancel command added to history
94 } 94 }
95 95
96 # Remote desktop/VNC 96 # Remote desktop/VNC
97 eval "alias milton='ssh -L9930:milton:5900 -f joshua.srhuston.net \"sleep 5\"; ${VNCVIEWER}localhost:9930 &'" 97 eval "alias milton='ssh -L9930:milton:5900 -f joshua.srhuston.net \"sleep 5\"; ${VNCVIEWER}localhost:9930 &'"
98 # Xanadu VMs
99 eval "alias xvm='ssh -L9909:localhost:5909 -f xanadu.astro.princeton.edu \"sleep 300\"; ${VNCVIEWER}localhost:9909 &'"
100 eval "alias cygnus='ssh -L9910:localhost:5910 -f xanadu.astro.princeton.edu \"sleep 300\"; ${VNCVIEWER}localhost:9910 &'"
101 eval "alias syrinx='ssh -L9911:localhost:5911 -f xanadu.astro.princeton.edu \"sleep 300\"; ${VNCVIEWER}localhost:9911 &'"
102 eval "alias lyra='ssh -L9912:localhost:5912 -f xanadu.astro.princeton.edu \"sleep 300\"; ${VNCVIEWER}localhost:9912 &'"
103 98
104 # Programs 99 # Programs
105 alias atari='atari800 -height 800 -width 600' 100 alias atari='atari800 -height 800 -width 600'
106 alias base64='openssl enc -a' 101 alias base64='openssl enc -a'
107 alias irssi-test='irssi --home=$HOME/irssi-test/' 102 alias irssi-test='irssi --home=$HOME/irssi-test/'
108 alias pine='alpine' 103 alias pine='alpine'
109 alias ret='screen -raAx' 104 alias ret='screen -raAx'
110 alias rot13="tr 'a-zA-Z' 'n-za-mN-ZA-M'" 105 alias rot13="tr 'a-zA-Z' 'n-za-mN-ZA-M'"
111 alias tops='unset STY; screen -c .screenrc.pbstops -S pbstop'
112 tt () { 106 tt () {
113 OPTS="-G" 107 OPTS="-G"
114 if [ -e ${HOME}/.tt/${1}.tin ] ; then 108 if [ -e ${HOME}/.tt/${1}.tin ] ; then
115 OPTS="${OPTS} ${HOME}/.tt/${1}.tin" 109 OPTS="${OPTS} ${HOME}/.tt/${1}.tin"
116 shift 110 shift
129 alias tmu="sshfs -oreconnect${DARWIN:+,volname=tomenet-user} joshua.srhuston.net:Installs/tomenet/lib/user $HOME/Installs/tomenet/lib/user" 123 alias tmu="sshfs -oreconnect${DARWIN:+,volname=tomenet-user} joshua.srhuston.net:Installs/tomenet/lib/user $HOME/Installs/tomenet/lib/user"
130 124
131 # LDAP/host tools 125 # LDAP/host tools
132 alias ldm="ldapmodify -Q -Y GSSAPI -c" 126 alias ldm="ldapmodify -Q -Y GSSAPI -c"
133 alias ldsloop='while true; do read; clear; lds "$REPLY"; done' 127 alias ldsloop='while true; do read; clear; lds "$REPLY"; done'
134 alias hostmaster='ssh -x -a huston@arizona.princeton.edu /usr/oit/bin/hostinfo'
135 128
136 lds () { 129 lds () {
137 QUERY="$1" 130 QUERY="$1"
138 shift 131 shift
139 OPTS="" 132 OPTS=""
142 shift 135 shift
143 } 136 }
144 ldapsearch -Q -Y GSSAPI -LLL $OPTS "($QUERY)" $@ 137 ldapsearch -Q -Y GSSAPI -LLL $OPTS "($QUERY)" $@
145 } 138 }
146 139
147 ldsauth () {
148 QUERY="$1"
149 shift
150 OPTS=""
151 [[ "$1" =~ ^- ]] && {
152 OPTS="$1"
153 shift
154 }
155 ldapsearch -LLL -Z -W -D cn=DrAdmin,dc=astro,dc=princeton,dc=edu $OPTS -x "($QUERY)" $@
156 }
157
158 ldapsync() {
159 for H in ldap ldap2 ldap3 ; do
160 echo -ne $H":\t"
161 ldapsearch -LLL -h $H.astro.princeton.edu -x -s base '(objectclass=*)' contextCSN | egrep -v '^($|dn)' | sed 's/contextCSN: //'
162 done
163 echo -ne "now:\t"
164 date -u +%Y%m%d%H%M%S
165 }
166
167 # Other 140 # Other
168 alias condor_check="ls -lat /u/condor/hosts/*/log/MasterLog" 141 alias condor_check="ls -lat /u/condor/hosts/*/log/MasterLog"
169 alias slurp="wget -r -l1 -np -nd -A.mp3" 142 alias slurp="wget -r -l1 -np -nd -A.mp3"
170 alias zulu="date -u +%Y%m%d%H%M%SZ" 143 alias zulu="date -u +%Y%m%d%H%M%SZ"
171 144
175 pushd ~/Dropbox/Saves/minecraft/saves; 148 pushd ~/Dropbox/Saves/minecraft/saves;
176 if [ -d $1 ]; then 149 if [ -d $1 ]; then
177 tar cvf - $1 | bzip2 > ../$1_`date +%Y%m%d%H%M%S`.tar.bz2; 150 tar cvf - $1 | bzip2 > ../$1_`date +%Y%m%d%H%M%S`.tar.bz2;
178 fi; 151 fi;
179 popd 152 popd
180 }
181
182 tock() {
183 while true ; do
184 if [ `date +%S` -gt 42 ] ; then
185 if [ `date +%S` -lt 47 ] ; then
186 afplay /System/Library/Sounds/Pop.aiff &
187 fi
188 fi
189 sleep 1
190 done > /dev/null 2>&1
191 } 153 }
192 154
193 TOhtml() { 155 TOhtml() {
194 OUTDIR=`mktemp -d TOHTML.XXXXXX` 156 OUTDIR=`mktemp -d TOHTML.XXXXXX`
195 for F in `hg locate` ; do 157 for F in `hg locate` ; do