annotate .bash_aliases @ 291:b7096eec6557

Moved 'ret' and cleaned up a few old bits
author Steve Huston <huston@srhuston.net>
date Sat, 31 Aug 2024 14:38:04 -0400
parents f62fb9579277
children ac2565aaab48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
f65964738bab Added Id tag to files, and svn propset svn:keywords as appropriate
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 15
diff changeset
1 # Aliases are read from this file; no real reason to separate them out except
f65964738bab Added Id tag to files, and svn propset svn:keywords as appropriate
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 15
diff changeset
2 # for readability.
f65964738bab Added Id tag to files, and svn propset svn:keywords as appropriate
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 15
diff changeset
3
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
4 #
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
5 # Some settings which are architecture dependent
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
6 #
15
fe83d9892ee3 Replaced tests with a 'case' in .bash_aliases
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 13
diff changeset
7 case `uname` in
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
8 Darwin)
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
9 # DARWIN is used for the SSHFS mounts below
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
10 DARWIN="yes"
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
11
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
12 # The 'stat' and 'date' commands are here since the syntax of the commands
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
13 # is different between Linux and Mac OS X. If this is run elsewhere, the
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
14 # eval will be false and the test not done below, so it's safe to not
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
15 # bother checking for zero-length variables on the test - it just won't
82
0b67280c980c Reword comment (no more svn)
Steve Huston <huston@srhuston.net>
parents: 75
diff changeset
16 # run the hg incoming, so you won't be prompted if there's newer files
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
17 # available in your repository. These are safe to export since they're
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
18 # the commands to be evaulated, not the output - you're storing how to get
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
19 # the answer, not the answer itself.
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
20
41
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
21 # Also note, the full paths are stored since GNU coreutils might be
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
22 # installed; while that would tend to make things "easier" since the GNU
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
23 # one is the same as the Linux ones below, it can't be guaranteed.
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
24 # Instead of checking for the presence of /opt/local/bin/ls (or gls) it's
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
25 # easier to point directly to the one you know *is* installed.
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
26
41
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
27 DFSTAT="/usr/bin/stat -f %m -t %s $HOME/.dotfilets"
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
28 MDATE="/bin/date -v -1m +%s"
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
29
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
30 alias ls='/bin/ls -FG'
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
31
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
32 VNCVIEWER="open vnc://"
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
33 ;;
8
aa5e55aa62ef Moved specific section to top of .bash_aliases, so other bits can be set based
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 3
diff changeset
34
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
35 Linux)
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
36 # See above for a description of these four
41
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
37 DFSTAT="/usr/bin/stat -c %Y $HOME/.dotfilets"
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
38 MDATE="/bin/date -d \"1 month ago\" +%s"
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
39
41
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
40 alias ls='/bin/ls --color=auto -F'
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
41
2bea356b1032 * Added default screenrc from Linux (and the Screen installation) to .screenrc
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 40
diff changeset
42 VNCVIEWER="vncviewer Shared=1 Fullcolor=1 "
30
ca6c77fe843b * Whitespace (ugh)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 26
diff changeset
43 ;;
15
fe83d9892ee3 Replaced tests with a 'case' in .bash_aliases
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 13
diff changeset
44 esac
8
aa5e55aa62ef Moved specific section to top of .bash_aliases, so other bits can be set based
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 3
diff changeset
45
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
46 #
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
47 # Export some of those above for the benefit of future shells
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
48 #
197
954d25f20123 Removing toodledo stuff (no longer used)
Steve Huston <huston@srhuston.net>
parents: 196
diff changeset
49 export DFSTAT MDATE
33
f59f847377d7 * Added toodledo interfacing
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 30
diff changeset
50
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
51 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
52 # Create a service that can share files through to places we ssh to from here.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
53 # This should be pretty light, rooted in the $DOTHOME directory (see ~/.bashrc
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
54 # for information) and removed when we either request it or the shell exits.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
55 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
56 ds() {
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
57
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
58 PIDFILE=${DOTHOME}/.dotshare-PID
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
59
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
60 # If we want to kill an existing server, let's do that first.
274
02a3d7c46b2b Better 'ds end' functionality, and ability to share a remote environment more easily
Steve Huston <huston@srhuston.net>
parents: 268
diff changeset
61 if [ "$1" == "end" ]; then
02a3d7c46b2b Better 'ds end' functionality, and ability to share a remote environment more easily
Steve Huston <huston@srhuston.net>
parents: 268
diff changeset
62 [[ -e $PIDFILE ]] || {
02a3d7c46b2b Better 'ds end' functionality, and ability to share a remote environment more easily
Steve Huston <huston@srhuston.net>
parents: 268
diff changeset
63 echo "No server detected"
02a3d7c46b2b Better 'ds end' functionality, and ability to share a remote environment more easily
Steve Huston <huston@srhuston.net>
parents: 268
diff changeset
64 return 1
02a3d7c46b2b Better 'ds end' functionality, and ability to share a remote environment more easily
Steve Huston <huston@srhuston.net>
parents: 268
diff changeset
65 }
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
66 kill `cat $PIDFILE`
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
67 unset DOTSHARE_PID DOTSHARE_PORT
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
68 echo "Server terminated"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
69 return 0
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
70 fi
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
71
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
72 # Let's check if things exist and we can just use them as-is
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
73 if [ -e $PIDFILE ]; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
74 DOTSHARE_PID=`cat $PIDFILE`
268
48b4f41712dc Suppress warnings in lsof, change filetype bash -> sh
Steve Huston <huston@princeton.edu>
parents: 265
diff changeset
75 DOTSHARE_PORT=`lsof -w -n -p $DOTSHARE_PID | grep LISTEN | awk '{print $9}' | sed 's/.*://'`
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
76 if [ -z $DOTSHARE_PORT ]; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
77 echo "Server PIDfile found but couldn't get a port, aborting"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
78 return 255
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
79 fi
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
80 echo "Existing server ${DOTSHARE_PID} listening on ${DOTSHARE_PORT}, setting environment"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
81 export DOTSHARE_PID DOTSHARE_PORT
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
82 return 0
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
83 fi
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
84
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
85 # Nothing exists, so we need to make one; first, which python do we have
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
86 if hash python3 > /dev/null 2>&1 ; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
87 # Python 3.9 also accepts '-d' for a directory
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
88 serv_cmd="python3 -m http.server --bind localhost 0"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
89 elif hash python > /dev/null 2>&1 ; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
90 # I think nothing else where I'd run this will need this one
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
91 serv_cmd="python -m SimpleHTTPServer 0"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
92 else
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
93 echo "No python found, cannot start share server."
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
94 return 255
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
95 fi
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
96
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
97 # Spawning this in a subshell because the process won't go away and we want
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
98 # to background it, but we also want to set a trap around the whole thing,
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
99 # and we need to 'cd' to somewhere else to start it since older versions
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
100 # can't be passed a different path to serve. So there's some hacks here,
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
101 # but I don't think they're avoidable for the moment. Once Joshua and
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
102 # Xanadu have Python 3.9 at least, I can rework this whole thing.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
103 (
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
104 cd $DOTHOME
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
105 $serv_cmd > /dev/null 2>&1 &
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
106 P=$!
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
107 echo $P > ${DOTHOME}/.dotshare-PID
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
108 trap "kill $P 2>/dev/null; rm -f $PIDFILE; unset DOTSHARE_PID DOTSHARE_PORT" 0
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
109 wait
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
110 ) &
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
111 disown %+
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
112
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
113 # Give it a moment to collect its thoughts...
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
114 sleep 1
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
115 DOTSHARE_PID=`cat $PIDFILE`
268
48b4f41712dc Suppress warnings in lsof, change filetype bash -> sh
Steve Huston <huston@princeton.edu>
parents: 265
diff changeset
116 DOTSHARE_PORT=`lsof -w -n -p $DOTSHARE_PID | grep LISTEN | awk '{print $9}' | sed 's/.*://'`
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
117 echo "Server PID $DOTSHARE_PID ready on port $DOTSHARE_PORT"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
118 export DOTSHARE_PID DOTSHARE_PORT
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
119 }
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
120
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
121 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
122 # SSH aliases/functions
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
123 #
167
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
124 cert() {
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
125 # SSH key signing with Vault for administration
167
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
126 export VAULT_ADDR='https://ajax.rc.princeton.edu:8200'
193
5d0e1adee7e0 Modifying cert alias for different key
Steve Huston <huston@astro.princeton.edu>
parents: 192
diff changeset
127 ssh-add -d $HOME/.ssh/rc_vault_key-cert.pub > /dev/null 2>&1
167
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
128 if vault login -method=radius username=vi-srh; then
193
5d0e1adee7e0 Modifying cert alias for different key
Steve Huston <huston@astro.princeton.edu>
parents: 192
diff changeset
129 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
194
bb1c927125a5 Add a timeout to the key & cert
Steve Huston <huston@astro.princeton.edu>
parents: 193
diff changeset
130 ssh-add -t 36000 $HOME/.ssh/rc_vault_key
167
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
131 else
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
132 echo Failed to login to vault, aborting
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
133 fi
88ed01a1094f SSH Certificate signing
Steve Huston <huston@astro.princeton.edu>
parents: 165
diff changeset
134 }
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
135
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
136 # I rename my keys from the standard so they're easy to glob on a commandline
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
137 alias keys='ssh-add $HOME/.ssh/*.pvt'
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
138
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
139 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
140 # These are for reattaching screen sessions, only useful on bastion systems
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
141 #
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
142 alias rbh='ssh -t csesbh2.princeton.edu screen -raAx csesbh2'
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
143 alias rj='ssh -t joshua.srhuston.net screen -raAx'
285
f62fb9579277 Changing irc alias a little due to how docker exits; update histignore
Steve Huston <huston@srhuston.net>
parents: 284
diff changeset
144 alias irc='ssh -t joshua.srhuston.net docker exec -it irssi screen -raAx;clear;echo IRC Session ended'
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
145 alias rx='ssh -t xanadu.astro.princeton.edu screen -raAx'
291
b7096eec6557 Moved 'ret' and cleaned up a few old bits
Steve Huston <huston@srhuston.net>
parents: 285
diff changeset
146 # Moved this one here, no ssh but still screen usage
b7096eec6557 Moved 'ret' and cleaned up a few old bits
Steve Huston <huston@srhuston.net>
parents: 285
diff changeset
147 alias ret='screen -raAx'
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
148
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
149 t() {
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
150 # Tunneling SSH - a simple 't hostname' will tunnel to xanadu and then
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
151 # connect to hostname, while 't hostname tunnelhost' will connect to
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
152 # tunnelhost and then hostname
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
153 # Today (2024/03/30) I don't remember the last time I used this; retire?
198
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
154 T_HOST=xanadu.astro.princeton.edu
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
155 if [ -n "$2" ] ; then
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
156 T_HOST=$2
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
157 fi
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
158 ssh -t $T_HOST "ssh $1"
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
159 }
6e7913283c7a Removed a lot of cruft that's no longer needed, cleaned up some comments & syntax
Steve Huston <huston@srhuston.net>
parents: 197
diff changeset
160
165
ab0fb2057b88 Proxy function for starting a proxy server & Chrome
Steve Huston <huston@astro.princeton.edu>
parents: 164
diff changeset
161 proxy() {
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
162 # Proxying/tunneling - predominantly for my Mac laptop
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
163 local PROXY_HOST PROXY_PORT PROXY_PATH PROXY_UMOUNT PROXY_CMD
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
164 # We set a simple command to run over the proxy for normal connections,
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
165 # which we know will be multiplexed and stay active. If you're using a
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
166 # manual host for something, you'll want to use a "sleep 30" or something to
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
167 # keep the shell open long enough for the proxy to be used, or maybe even
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
168 # longer if you plan on disconnecting and reconnecting over time.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
169 PROXY_CMD=${PROXY_CMD:-hostname}
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
170 case $1 in
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
171 home)
207
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
172 if [ "$HOST" != "gallifrey" ] ; then
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
173 echo "Not on gallifrey, no need for this"
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
174 return
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
175 fi
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
176 PROXY_HOST=${PROXY_HOST:-joshua.srhuston.net}
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
177 PROXY_PORT=${PROXY_PORT:-8889}
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
178 PROXY_PATH="/Volumes/Chrome-Personal"
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
179 PROXY_UMOUNT="hdiutil detach -quiet ${PROXY_PATH}"
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
180 if [ ! -e ${PROXY_PATH}/.profile-exists ] ; then
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
181 hdiutil attach -stdinpass -nobrowse -quiet ~/Documents/Chrome-Personal.dmg
206
3b8b613c4d7a Whitespace!
Steve Huston <huston@astro.princeton.edu>
parents: 205
diff changeset
182 if [ ! $? ] ; then
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
183 echo Disk image failed to mount, aborting
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
184 return
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
185 fi
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
186 fi
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
187 ;;
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
188 work)
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
189 PROXY_HOST=${PROXY_HOST:-xanadu.astro.princeton.edu}
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
190 PROXY_PORT=${PROXY_PORT:-8888}
207
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
191 if [ "$HOST" == "gallifrey" ] ; then
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
192 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome"
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
193 else
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
194 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_Work"
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
195 fi
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
196 ;;
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
197 rc)
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
198 PROXY_HOST=${PROXY_HOST:-csesbh2.princeton.edu}
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
199 PROXY_PORT=${PROXY_PORT:-8887}
207
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
200 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_RC"
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
201 ;;
234
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
202 w2zq)
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
203 PROXY_HOST=${PROXY_HOST:-ssh://w2zq.mywire.org:22022}
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
204 PROXY_PORT=${PROXY_PORT:-8886}
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
205 PROXY_PATH="/Users/huston/Library/Application Support/Google/Chrome_W2ZQ"
235
2b3e169f8182 Updating proxy setting, forgot I wasn't using a controlmaster there
Steve Huston <huston@srhuston.net>
parents: 234
diff changeset
206 PROXY_UMOUNT="ssh -O exit $PROXY_HOST"
234
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
207 ;;
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
208 *)
234
863d190c2fa1 Proxy settings for DVRA administration
Steve Huston <huston@srhuston.net>
parents: 229
diff changeset
209 echo "Proxy needs one argument: home, work, rc, or w2zq"
207
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
210 return
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
211 ;;
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
212 esac
207
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
213 # In theory you need to have a job stay on the remote host for the
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
214 # forwarding to stay open. However if you're using persistent/shared
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
215 # connections then the port stays open anyway. We still need a command
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
216 # though, and 'hostname' returns quickly as well as giving a visual output
7fc7d82cce6d I think this might have the last of the proxy setup finished - should be portable too (at least to other Macs)
Steve Huston <huston@astro.princeton.edu>
parents: 206
diff changeset
217 # that you connected to the right place.
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
218 ssh -D $PROXY_PORT -f -C -q $PROXY_HOST "$PROXY_CMD"
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
219 (
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
220 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
221 --proxy-server="socks5://127.0.0.1:$PROXY_PORT" \
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
222 --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
223 --user-data-dir="${PROXY_PATH}" > /dev/null 2>&1
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
224 $PROXY_UMOUNT
242
96f00cdb6614 Cert check function
Steve Huston <huston@astro.princeton.edu>
parents: 240
diff changeset
225 # Maybe leave this off, so what if the port is left open if there are no
205
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
226 # conflicts...
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
227 # ssh -O cancel -D $PROXY_PORT $PROXY_HOST
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
228 ) &
16fdb3931af6 Many changes to proxy setup, probably more to come eventually
Steve Huston <huston@astro.princeton.edu>
parents: 200
diff changeset
229 disown %+
165
ab0fb2057b88 Proxy function for starting a proxy server & Chrome
Steve Huston <huston@astro.princeton.edu>
parents: 164
diff changeset
230 }
ab0fb2057b88 Proxy function for starting a proxy server & Chrome
Steve Huston <huston@astro.princeton.edu>
parents: 164
diff changeset
231
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
232 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
233 # Remote desktop/VNC - definitely outdated and maybe no longer useful?
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
234 #
155
5ab127dd2d89 Fixing up aliases for VNC connections
Steve Huston <huston@astro.princeton.edu>
parents: 154
diff changeset
235 eval "alias milton='ssh -L9930:milton:5900 -f joshua.srhuston.net \"sleep 5\"; ${VNCVIEWER}localhost:9930 &'"
12
08bf77c6174f Added bynarr alias (rdesktop)
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 10
diff changeset
236
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
237 #
1
7e33b3191cf7 Merged in settings from home, and at the same time edited some of the
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 0
diff changeset
238 # Programs
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
239 #
3
072b183989e0 Merged in changes for the Mac, including the beginnings of platform
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 2
diff changeset
240 alias atari='atari800 -height 800 -width 600'
2
2b4dcc885071 Alphabetized aliases for easier sorting
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 1
diff changeset
241 alias base64='openssl enc -a'
160
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
242 tt () {
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
243 OPTS="-G"
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
244 if [ -e ${HOME}/.tt/${1}.tin ] ; then
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
245 OPTS="${OPTS} ${HOME}/.tt/${1}.tin"
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
246 shift
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
247 fi
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
248 tt++ ${OPTS} $@
fd42244e9413 Adding 'tt' alias, commenting out some services on joshua
Steve Huston <huston@srhuston.net>
parents: 156
diff changeset
249 }
0
c78481cfb082 Initial checkin:
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents:
diff changeset
250
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
251 #
1
7e33b3191cf7 Merged in settings from home, and at the same time edited some of the
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 0
diff changeset
252 # SSHFS mounts
8
aa5e55aa62ef Moved specific section to top of .bash_aliases, so other bits can be set based
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 3
diff changeset
253 # The $DARWIN check fills in a nice volname if this is a Mac
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
254 #
26
e14a0b4fab30 * Rename private keys in ~/.ssh/ to <name>.pvt so the keys alias can just add
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 25
diff changeset
255 alias junkpile="sshfs -oreconnect${DARWIN:+,volname=Junkpile} srhuston.net:junkpile $HOME/junkpile"
91
9d5fcbb36232 Reordering some alises for completeness
Steve Huston <huston@astro.princeton.edu>
parents: 90
diff changeset
256 alias sdh="sshfs -oreconnect${DARWIN:+,volname=srhuston.net} srhuston.net: $HOME/srhuston.net"
26
e14a0b4fab30 * Rename private keys in ~/.ssh/ to <name>.pvt so the keys alias can just add
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 25
diff changeset
257 alias sj="sshfs -oreconnect${DARWIN:+,volname=Joshua} joshua.srhuston.net: $HOME/joshua"
e14a0b4fab30 * Rename private keys in ~/.ssh/ to <name>.pvt so the keys alias can just add
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 25
diff changeset
258 alias sx="sshfs -oreconnect${DARWIN:+,volname=Xanadu} xanadu.astro.princeton.edu: $HOME/xanadu"
173
9fed6f4301db Tomenet sshfs alias
Steve Huston <huston@srhuston.net>
parents: 167
diff changeset
259 alias tmu="sshfs -oreconnect${DARWIN:+,volname=tomenet-user} joshua.srhuston.net:Installs/tomenet/lib/user $HOME/Installs/tomenet/lib/user"
13
dacbbae5965c Added Ruby setup variables
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 12
diff changeset
260
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
261 #
51
44c36681ca0f * Removed many double quotes from tests; they caused the tests to pass on
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 50
diff changeset
262 # LDAP/host tools
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
263 #
156
5dfc68e01309 New ldm/lds, and a quick way to know when is now
Steve Huston <huston@astro.princeton.edu>
parents: 155
diff changeset
264 alias ldm="ldapmodify -Q -Y GSSAPI -c"
51
44c36681ca0f * Removed many double quotes from tests; they caused the tests to pass on
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 50
diff changeset
265 alias ldsloop='while true; do read; clear; lds "$REPLY"; done'
90
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
266 lds () {
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
267 QUERY="$1"
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
268 shift
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
269 OPTS=""
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
270 [[ "$1" =~ ^- ]] && {
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
271 OPTS="$1"
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
272 shift
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
273 }
156
5dfc68e01309 New ldm/lds, and a quick way to know when is now
Steve Huston <huston@astro.princeton.edu>
parents: 155
diff changeset
274 ldapsearch -Q -Y GSSAPI -LLL $OPTS "($QUERY)" $@
90
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
275 }
cdfa42697eec Updated lds, added ldsauth and ldapsync
Steve Huston <huston@astro.princeton.edu>
parents: 82
diff changeset
276
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
277 #
13
dacbbae5965c Added Ruby setup variables
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 12
diff changeset
278 # Other
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
279 #
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
280 hgs() {
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
281 # Creates a hg server in the current repo and connects to it automatically.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
282 # We assume here that if the host is a Mac, we're going to open the
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
283 # connection automatically, otherwise we echo the URL to the terminal to be
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
284 # opened
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
285 ROOT=`hg root`
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
286 if [ "$1" == "end" -a -e $ROOT/.hg/hgserve-PID ] ; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
287 kill `cat $ROOT/.hg/hgserve-PID`
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
288 rm $ROOT/.hg/hgserve-PID
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
289 else
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
290 if [ -e $ROOT/.hg/hgserve-PID ] ; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
291 P=`cat $ROOT/.hg/hgserve-PID`
268
48b4f41712dc Suppress warnings in lsof, change filetype bash -> sh
Steve Huston <huston@princeton.edu>
parents: 265
diff changeset
292 URL=`lsof -w -n -p $P | grep LISTEN | awk '{print $9}'`
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
293 else
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
294 URL=`hg serve -d -p 0 --pid-file $ROOT/.hg/hgserve-PID | sed 's#.*at http://\(.*\)/ (bound.*#\1#'`
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
295 fi
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
296 if [ -z "$DARWIN" ] ; then
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
297 echo hg serve on http://$URL/
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
298 else
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
299 open http://$URL/
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
300 fi
242
96f00cdb6614 Cert check function
Steve Huston <huston@astro.princeton.edu>
parents: 240
diff changeset
301 fi
96f00cdb6614 Cert check function
Steve Huston <huston@astro.princeton.edu>
parents: 240
diff changeset
302 }
251
b00e6b403896 Added airline-colour-splits and removed whitespace
Steve Huston <huston@srhuston.net>
parents: 242
diff changeset
303 mc-backup() {
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
304 # Definitely time to rework this one - I don't even use Dropbox anymore!
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
305 # Keeping it here for now just for the syntax, but this is probably no
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
306 # longer worth keeping either.
113
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
307 pushd ~/Dropbox/Saves/minecraft/saves;
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
308 if [ -d $1 ]; then
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
309 tar cvf - $1 | bzip2 > ../$1_`date +%Y%m%d%H%M%S`.tar.bz2;
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
310 fi;
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
311 popd
56c2ff1a8427 mc-backup function
Steve Huston <huston@srhuston.net>
parents: 108
diff changeset
312 }
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
313 alias slurp="wget -r -l1 -np -nd -A.mp3"
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
314 alias zulu="date -u +%Y%m%d%H%M%SZ"
63
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
315 TOhtml() {
265
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
316 # Since I moved to hosting the hg repo, this is less useful to share things.
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
317 # But still a nice bit of code and worth keeping I think. Needs a rework to
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
318 # match the new style of the dotfile repo as of 2024/03/30 (splitting out
df0b24d4fabd Think I'm ready to check this all in now; shared dotfiles that can be "sent"
Steve Huston <huston@srhuston.net>
parents: 251
diff changeset
319 # shared configs, etc)
210
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
320 OUTDIR=${1:-`mktemp -d TOHTML.XXXXXX`}
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
321 ROOT=`hg root`
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
322
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
323 echo "<HTML><HEAD><TITLE>My dotfiles</TITLE></HEAD><BODY><UL>" > $OUTDIR/index.html
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
324
251
b00e6b403896 Added airline-colour-splits and removed whitespace
Steve Huston <huston@srhuston.net>
parents: 242
diff changeset
325 for F in `hg locate` ; do
63
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
326
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
327 # Files to ignore from the list
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
328 case $F in
210
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
329 .vim/*)
63
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
330 continue
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
331 ;;
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
332 *)
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
333 ;;
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
334 esac
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
335
210
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
336 D=`echo $F | grep "/" | sed 's/\/[^\/]*$//'`
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
337 if [ $D ] ; then
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
338 mkdir -p $OUTDIR/$D
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
339 fi
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
340
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
341 vim -n -e +TOhtml "+w ${OUTDIR}/${F}.html" +qa\! $ROOT/$F
215
c35da750af7a Forgot a closing tag
Steve Huston <huston@srhuston.net>
parents: 210
diff changeset
342 echo "<LI><A href=${F}.html>$F</A></LI>" >> $OUTDIR/index.html
63
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
343 done
210
25e7a79f5ba0 Better update to TOhtml
Steve Huston <huston@astro.princeton.edu>
parents: 208
diff changeset
344 echo "</UL></BODY></HTML>" >> $OUTDIR/index.html
63
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
345 echo Files stored in $OUTDIR
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
346 }
590b4d17d933 * TOhtml function that makes pretty prints of all the dotfiles for display
huston@80426f53-59d1-405d-934b-f07cd76f4a1a
parents: 62
diff changeset
347
268
48b4f41712dc Suppress warnings in lsof, change filetype bash -> sh
Steve Huston <huston@princeton.edu>
parents: 265
diff changeset
348 # vim: set filetype=sh :