Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Wilson-Perkin ryanwilsonperkin

View GitHub Profile
@ryanwilsonperkin
ryanwilsonperkin / dog
Created Sep 4, 2020
A script that treats arguments as DataDog queries and opens them in a notebook
View dog
#!/usr/bin/env ruby
# frozen_string_literal: true
# usage: dog query1 query2 ...
# Opens a new DataDog notebook with the provided queries
# When given no arguments, just opens a new notebook
require 'cgi'
require 'json'
URI_BASE = 'https://shopify.datadoghq.com/notebook'
@ryanwilsonperkin
ryanwilsonperkin / clone.py
Created May 17, 2020
Clone all repos from an organization
View clone.py
#!/usr/bin/env python3
"""
clone.py
A script for downloading all of your organization's GitHub repos.
usage: GITHUB_ACCESS_TOKEN=foobar python3 clone.py <organization>
Your GITHUB_ACCESS_TOKEN is created by following the steps in this guide:
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
@ryanwilsonperkin
ryanwilsonperkin / App.tsx
Created Nov 8, 2019
An example of using React Context to make data available to deeply nested components
View App.tsx
import React from "react";
import { ThemeProvider } from "./Theme";
import ToggleTheme from "./ToggleTheme";
import ThemedText from "./ThemedText";
const App: React.FC = () => (
<ThemeProvider>
<ToggleTheme />
<ThemedText>Hello World</ThemedText>
</ThemeProvider>
@ryanwilsonperkin
ryanwilsonperkin / fast_vagrant_ssh.md
Created May 3, 2017
Faster SSHing into vagrant
View fast_vagrant_ssh.md

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
ryanwilsonperkin / Dockerfile
Created Mar 12, 2019
Comparing the use of apt-get vs apt-fast for installing packages in Debian
View Dockerfile
# A standard Debian container extended with apt-fast (https://github.com/ilikenwf/apt-fast/)
FROM debian
LABEL maintainer="rwilsonperkin@waveapps.com"
# Install gnupg to allow apt-key verification, time to allow profiling
RUN apt-get update
RUN apt-get install -y gnupg time
# Set up PPA for apt-fast
RUN echo deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main >> /etc/apt/sources.list.d/apt-fast.list \
@ryanwilsonperkin
ryanwilsonperkin / flaky.py
Last active Feb 26, 2019
Fetch a list of flaky tests form a CircleCI project
View flaky.py
#!/usr/local/bin/python3
"""
@author Ryan Wilson-Perkin
Fetch a list of flaky tests from a CircleCI project.
Searches the last 30 builds that have failed on the master branch, downloads any
junit.xml artifacts it finds for them, and reports the tests that have failed.
Branch name, test results file, number of builds, and number of results are all
@ryanwilsonperkin
ryanwilsonperkin / commits.py
Created Feb 26, 2019
Count all the lines I've ever changed on GitHub
View commits.py
#!/usr/local/bin/python3
"""
Count all the lines I've ever changed on GitHub
Setup:
pip install requests tqdm GitPython
Usage:
./commits.py
"""
@ryanwilsonperkin
ryanwilsonperkin / .dockerignore
Created Oct 29, 2018
convox start does not respect .dockerignore for code sync
@ryanwilsonperkin
ryanwilsonperkin / component.js
Last active Aug 14, 2018
A HOC proposal for injecting tracking of events.
View component.js
import React from 'react';
import withTracking from 'withTracking';
export class MyLink extends React.Component {
static propTypes = {
text: PropTypes.string,
href: PropTypes.string,
track: PropTypes.func,
};
@ryanwilsonperkin
ryanwilsonperkin / react_links.md
Last active May 25, 2018
Useful links for those new to the react ecosystem
View react_links.md
You can’t perform that action at this time.