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 / update_ubuntu_old_release.sh
Created March 9, 2012 23:08
Redirecting Ubuntu apt-get to old-releases
# Point end-of-life Ubuntu versions' apt source URLs to old-releases.*
# See: https://help.ubuntu.com/community/EOLUpgrades
sudo sed -i s/us.archive.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list
sudo sed -i s/security.ubuntu/old-releases.ubuntu/g /etc/apt/sources.list
sudo apt-get update
@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
}
@anthonywu
anthonywu / graceful_auto_reconnect.py
Created January 29, 2012 01:25
Gracefully handle a PyMongo AutoReconnect
import functools
import pymongo
import logging
import time
MAX_AUTO_RECONNECT_ATTEMPTS = 5
def graceful_auto_reconnect(mongo_op_func):
"""Gracefully handle a reconnection event."""
@functools.wraps(mongo_op_func)
@anthonywu
anthonywu / sample_plist_reader.py
Created December 2, 2020 06:12
sample_plist_reader
import os
import pathlib
import plistlib as pl
import pprint
f = 'com.apple.finder.plist'
with open(os.path.expanduser(pathlib.Path('~/Library/Preferences/') / f), 'rb') as fp:
data = pl.load(fp, fmt=pl.FMT_BINARY)
pprint.pprint(data)
@anthonywu
anthonywu / Dockerfile
Last active June 4, 2019 05:00
Cloudflare Workers wrangler CLI workspace
FROM ubuntu:bionic-20190515
# rustup: requires curl or wget
# wrangler: cargo install requires gcc, pkg-config and libssl-dev
# wrangler generate: requires git
RUN apt update && \
apt install -qy curl emacs gcc git libssl-dev pkg-config wget && \
apt -y full-upgrade
# wrangler build: requires npm nodejs
@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
Verifying my Blockstack ID is secured with the address 1Bv8Wq5jPv8RtWEGH7wEwGZ6fucsCzyBvA https://explorer.blockstack.org/address/1Bv8Wq5jPv8RtWEGH7wEwGZ6fucsCzyBvA
@anthonywu
anthonywu / icloud_password_restore.sh
Created November 1, 2016 18:25
icloud_password_restore.sh
# if the iCloud password option is disabled, you'll not see your iCloud login with this result
dscl . read /Users/your_username | grep AuthenticationAuthority
# use this command to add your icloud password as an auth authority again
sudo dscl . append /Users/your_username AuthenticationAuthority ";AppleID;icloud_account@example.com"
# confirm the previous command
dscl . read /Users/your_username | grep AuthenticationAuthority
@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 / 2016-12-08 Unconcious Bias for Founders workshop notes.md
Created December 9, 2016 18:33
2016-12-08 Unconcious Bias for Founders workshop notes

Event: Unconscious Bias for Founders: Practical Tips on Hiring & Leading An Inclusive Team

This interactive workshop will explore the research behind unconscious bias and evidence-based strategies founders can take to make better, more objective decisions in both the recruiting & hiring process and in ongoing team dynamics and culture. Participants will leave with specific plans on how to apply these strategies within their own organization.

>Joelle Emerson Joelle is founder & CEO of ParadigmIQ – a boutique consultancy that helps companies like Pinterest, Airbnb, Slack, Asana and others build high functioning diverse and inclusive teams. She has written extensively about diversity, inclusion, and unconscious bias, and her work has been featured in The Wall Street Journal, The New Yorker, Fortune and more. Prior to Paradigm Joelle was a women’s rights attorney and she holds a degree from Stanford Law. Joelle’s work comes very highly recommended from numer