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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EthernetBuiltIn</key>
<string>Yes</string>
<key>GenerateCStates</key>
<string>Yes</string>
<key>GeneratePStates</key>
<string>Yes</string>
@anthonywu
anthonywu / lib_search_guide.md
Last active January 3, 2016 22:19
programming library search

Before writing any in-house code, it is wise to check if there already exists a published library for the task at hand. If you're interacting with a service, chances are the developers of the service had taken time to develop official libraries for the more popular programming languages. If it's a task that you suspect is a solved problem, chances are someone has taken the initiative to open source their solution.

Here are the resources to discover libraries and tools for your programming task.

Python

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 / manage tunnels
Created December 15, 2014 20:19
ssh tunnel management
# check for running ssh processes that look like tunneling processes
ps -eo command | grep "ssh.*\-[L] .*/.*/.*" || echo "No Existing Tunnels"
# This script closes all ssh processes that look like local tunnels
for pid in $(ps -ef | grep "[s]sh.*-L" | awk '{ print $2 }'); do
kill -TERM $pid;
done
@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: