Skip to content

Instantly share code, notes, and snippets.

Ryan Wilson-Perkin ryanwilsonperkin

Block or report user

Report or block ryanwilsonperkin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ryanwilsonperkin /
Created Mar 5, 2018
Reads Xunit XML files and prints the (sorted) test names to stdout.
Reads Xunit XML files and prints the (sorted) test names to stdout.
usage: python file [file...]
import sys
import xml.etree.ElementTree as ET
def xmlToList(filename):
ryanwilsonperkin /
Last active Jan 9, 2018
Use the GitHub API to generate a CSV or your organization's repositories.
Generate a CSV file of your organization's GitHub repositories.
Results in a CSV file with the following columns:
- name: The name of the repository
- private: True if this is a private repository, else False
- fork: True if this repository is the result of a fork, else False
- created_at: The datetime this repository was created
- updated_at: The datetime this repository was last updated
ryanwilsonperkin /
Created Dec 20, 2017
Check all applications in a convox rack for environment variables (name or value) containing a search_query
if [ -z "$rack" ] || [ -z "$search_query" ]; then
echo "usage: $0 rack search_query"
exit 1
apps=$(convox apps --rack $rack | grep -v STATUS | cut -f1 -d' ')
ryanwilsonperkin /
Last active Nov 23, 2017
Different types of decorators
# Regular decorator
def decorator(f):
def wrapped(*args, **kwargs):
result = f(*args, **kwargs)
return result
return wrapped
# Regular decorator usage
ryanwilsonperkin /
Created May 3, 2017
Faster SSHing into vagrant

Running vagrant ssh can be slow because it boots up a ruby process, does a bunch of analysis to determine your ssh parameters, and then actually invokes the command. If you want a faster login, try the following:

# Compute the ssh parameters, append them to your global ssh config file
# The --host parameter specifies what you want the vagrant machine to be called
vagrant ssh-config --host vagrant >> ~/.ssh/config

# Now just ssh into that machine directly
ssh vagrant
ryanwilsonperkin / webpack.config.js
Created Feb 23, 2017
Webpack: chunkhash in production, hash in development
View webpack.config.js
const PRODUCTION = process.env.NODE_ENV === 'production';
const HASH_MODE = PRODUCTION ? 'chunkhash' : 'hash';
module.exports = {
output: {
filename: `[name].[${HASH_MODE}].js`,
chunkFilename: `[name].[${HASH_MODE}].js`,


A simple way to get line profiling on your python functions.

  1. pip install line_profiler
  2. Decorate your function with @profile (no import needed)
  3. Launch a shell with kernprof -l shell
  4. Call the function you want to profile. Preferably several times! (%timeit is great for running it several times)
  5. Exit the shell. You'll see a dumped file created called
# Having fun with context managers
from contextlib import contextmanager
def deity():
print 'The Father'
print 'The Holy Ghost'
god = deity()

Keybase proof

I hereby claim:

  • I am ryanwilsonperkin on github.
  • I am ryanwilsonperkin ( on keybase.
  • I have a public key whose fingerprint is 5664 AF96 D17B 16E8 F21B F431 FBA8 1CE4 75C6 7F0D

To claim this, I am signing this object:

View comprehension.js
// Clever
function comprehension(arr, fn) {
return arr.reduce((obj, key) => Object.assign(obj, {[key]: fn(key)}), {});
// Legible
function comprehension(arr, fn) {
const obj = {};
for (key of arr) {
obj[key] = fn(key);
You can’t perform that action at this time.