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
@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 / .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 / 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();

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 / 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

<?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 / quick_install_memcached_mac.sh
Created May 8, 2013 18:23
Quick install memcached on Mac OS X
# install via Homebrew
brew install memcached
# optional: make memcached start along with the system
ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents
# load memcached now for immediate use
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
# check the process that just launched
@anthonywu
anthonywu / install_ubuntu_chrome.sh
Created May 8, 2013 18:02
Install Google Chrome on Ubuntu
# run with sudo user privileges
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo chmod 644 /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable
@anthonywu
anthonywu / fb-git-review-install.sh
Created May 8, 2013 17:54
Install Facebook git-review on OS X
# checkout git-review from GitHub and install
# note: this is not the same git-review available via pip installer
git clone git@github.com:facebook/git-review.git
cd git-review/
sudo python setup.py install
# assuming you have Homebrew installed
brew install tkdiff
@anthonywu
anthonywu / osx_pdf_join.sh
Created April 18, 2013 02:35
Mac OS X – bash function to join pdfs on the command line
function pdf_join {
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
read -p "Name of output file > " output_file && "$join_py" -o $output_file $@ && open $output_file
}