Skip to content

Instantly share code, notes, and snippets.

View anthonywu's full-sized avatar

Anthony Wu anthonywu

  • Silicon Valley / Bay Area
View GitHub Profile

There are three ways to get across the Bay.

Service Cost Notes
AC Transit Transbay Service $4.20/one-way or $151.20/month fastest option if you live near a bus stop; drops off at Transbay Terminal, then connect to office via bike share at station. 36 rides or 18 commute round-trips makes the monthly pass worthwhile
Bikes on BART varies bikes allowed all hours, but crowded during peak hours; swinging through Oakland stations makes this slower than AC Transit Transbay Service
MacArthur Bike Shuttle $1 cheapest option, if full take BART
SF Bay Ferry $4.75 on ClipperCard connects Jack London Square and SF Ferry Building; can take bike onboard

If you connect by bicycle, you have these options to avoid having to take the bike onto the train:

@anthonywu
anthonywu / strava_heatmap_cleanup.js
Created June 19, 2014 04:39
Strava Heatmap Cleanup
jQuery('.centered').remove();
jQuery('.top-row').remove();
jQuery('.background').remove();
jQuery('.map-info').remove();
@anthonywu
anthonywu / .env
Created November 26, 2014 00:13
autoenv demo for Vagrant + VirtualBox
python -c "
import json
with open('.vagrant/machines/default/virtualbox/synced_folders') as f:
sf_content = f.read()
synced_folders = json.loads(sf_content)['virtualbox']
print('Your Virtual Machine has {} synced folders\n'.format(len(synced_folders)))
@anthonywu
anthonywu / cron_git_checkpoint.sh
Created December 15, 2014 20:17
Crontab Git Checkpointing
#!/bin/bash
# This is a legacy script from 2012 that auto-commits crontab contents to the learnsprout-prod repo.
if [ $# -lt 1 ]; then
echo "Usage: $(basename $0) <crontab|tbd>"
exit 1
fi
cd $(dirname $0)
@anthonywu
anthonywu / compile_openconnect.sh
Created December 15, 2014 20:18
Compile OpenConnect
#!/bin/bash -e
sudo apt-get install gcc make pkg-config openssl libgnutls28 libgnutls28-dev libxml++2.6-dev
cd ~
target=openconnect
wget ftp://ftp.infradead.org/pub/openconnect/openconnect-4.99.tar.gz ${target}.tar.gz
tar -xvf ${target}.tar.gz
cd $target
./configure --with-gnutls --disable-nls
@anthonywu
anthonywu / oracle_db_ping.sh
Created December 15, 2014 20:22
Oracle db ping test
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $(basename $0) <connection string>"
exit 1
fi
CONN_STRING=$1
sqlplus $CONN_STRING << EOF
@anthonywu
anthonywu / keybase.md
Created July 15, 2015 22:12
keybase.md

Keybase proof

I hereby claim:

  • I am anthonywu on github.
  • I am anthonywu (https://keybase.io/anthonywu) on keybase.
  • I have a public key whose fingerprint is B705 0771 3519 68DA AACE 104C AB83 AD17 6691 0D05

To claim this, I am signing this object:

@anthonywu
anthonywu / quick_enums.py
Created February 1, 2012 23:50
Python enum classes
# Author: Anthony Wu
# A quick way to make Python enum classes.
# Uses range/enumerate to quickly generate a list of enumerated values,
# but only safe/useful for your application logic where you don't have
# to persist these values to a data store.
# Example A: hard code enum classes
class Fruits(object):
@anthonywu
anthonywu / human_enum.py
Created February 27, 2012 00:43
Python Human Enums
"""
Copyright (c) 2012 Anthony Wu, twitter.com/anthonywu
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@anthonywu
anthonywu / py_tuple_unpack.py
Created February 29, 2012 23:13
Python args tuple unpacking
def foobar(a, b, c, (username, password)=(None,None)):
print a, b, c, username, password
foobar(1, 2, 3, ('hello','world')) # 1 2 3 hello world
foobar(1, 2, 3) # prints "1 2 3 None None"