Skip to content

Instantly share code, notes, and snippets.

View eclarke's full-sized avatar

Erik Clarke eclarke

View GitHub Profile
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols: Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
@eclarke
eclarke / toggleproxy.sh
Last active August 29, 2015 13:57
A hackety hack function to toggle SSH/SOCKS proxy on OS X Mavericks
function toggleproxy {
# checks to see if SOCKS proxy is enabled
if [[ $(networksetup -getsocksfirewallproxy Wi-Fi | grep '^Enabled') == "Enabled: No" ]]; then
networksetup -setsocksfirewallproxystate Wi-Fi on
echo "SOCKS on!"
# checks to see if there's an existing SSH tunnel and if not, it starts one
if [[ -z $(ps aux | grep '[0-9] ssh -D 8080') ]]; then
echo -ne "Don't see a ssh tunnel on 8080 active, starting one now..."
ssh -D 8080 -f -C -q -N USERNAME@HOSTNAME.EDU # Change this from the defaults!
[[ $? == 0 ]] && echo " success!" || echo " failed :("