Skip to content

Instantly share code, notes, and snippets.

View ryanwilsonperkin's full-sized avatar

Ryan Wilson-Perkin ryanwilsonperkin

View GitHub Profile
@ryanwilsonperkin
ryanwilsonperkin / Dockerfile
Created March 12, 2019 20:00
Comparing the use of apt-get vs apt-fast for installing packages in Debian
# 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 February 26, 2019 16:51
Fetch a list of flaky tests form a CircleCI project
#!/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 February 26, 2019 03:32
Count all the lines I've ever changed on GitHub
#!/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 October 29, 2018 19:03
convox start does not respect .dockerignore for code sync
DONTSYNC
@ryanwilsonperkin
ryanwilsonperkin / component.js
Last active August 14, 2018 18:38
A HOC proposal for injecting tracking of events.
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 / update.py
Created April 6, 2018 03:24
Update relative imports in JS files to be absolute based on current path
import os
import re
import sys
ROOT_DIR = 'project-name'
PATTERN = re.compile(
"""(?P<prefix>.*from *['"])"""
"""(?P<path>\..*)"""
"""(?P<suffix>['"].*)"""
)
@ryanwilsonperkin
ryanwilsonperkin / coredump
Created March 14, 2018 23:36
Debugging npm failure on Alpine Linux on EC2 C5 instance
Program terminated with signal SIGSEGV, Segmentation fault.
warning: Unexpected size of section `.reg-xstate/26' in core file.
#0 __cp_end () at src/thread/x86_64/syscall_cp.s:29
29 src/thread/x86_64/syscall_cp.s: No such file or directory.
[Current thread is 1 (LWP 26)]
(gdb) bt
#0 __cp_end () at src/thread/x86_64/syscall_cp.s:29
#1 0x00007fd6161eecd8 in __syscall_cp_c (nr=202, u=<optimized out>, v=<optimized out>, w=<optimized out>, x=<optimized out>, y=<optimized out>,
z=0) at src/thread/pthread_cancel.c:35
@ryanwilsonperkin
ryanwilsonperkin / example_public.py
Last active March 11, 2018 19:34
pipenv-test-public-package
import sys
sys.stdout.write('This is a public package\n')
@ryanwilsonperkin
ryanwilsonperkin / example_private.py
Last active March 11, 2018 19:35
pipenv-test-private-package
import sys
sys.stdout.write('This is a private package\n')
@ryanwilsonperkin
ryanwilsonperkin / create_test_list.py
Created March 5, 2018 14:31
Reads Xunit XML files and prints the (sorted) test names to stdout.
#!/usr/local/bin/python
"""
Reads Xunit XML files and prints the (sorted) test names to stdout.
usage: python create_test_list.py file [file...]
"""
import sys
import xml.etree.ElementTree as ET
def xmlToList(filename):