Skip to content

Instantly share code, notes, and snippets.

View rmmh's full-sized avatar

Ryan Hitchman rmmh

  • Boulder, Colorado
View GitHub Profile
@rmmh
rmmh / gage_lengths.py
Last active November 1, 2018 06:41
Compute the number of possible lengths expressed with Johansson's standard 81 inch gauge blocks, as described in https://youtu.be/gNRnrn5DE58?t=1597
gages = range(1001, 1010) + range(1010, 1491, 10) + range(500, 9501, 500) + range(10000, 40001, 10000)
gages.sort()
assert len(gages) == 81
def get_dists(n):
# Return distances using the LARGEST blocks possible.
# Track whether a block is used in a combination using a bitset.
if n == 0:
return {gages[0]: 1 << 0}
this = gages[n]
@rmmh
rmmh / docker_diff.py
Created October 12, 2018 01:13
A straightforward docker container differ, originally used for Kubernetes test infrastructure. Consider using https://github.com/GoogleContainerTools/container-diff instead.
#!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@rmmh
rmmh / fill_gaps.py
Last active July 31, 2018 13:17
Simple script to adjust a series of photos to add missing exif date information in a series of photos.
#!/usr/bin/env python
# Problem: Our maternity photos were mixed digital and film,
# and the exif dates/times for the film photos were wrong, preventing
# "sort by date" working in Google Photos.
#
# Solution: the filenames are in the right order, simply interpolate
# over the gaps to inject "correct" times.
@rmmh
rmmh / query.gql
Created July 31, 2017 22:36
Example Github GraphQLv4 Usage
{
rateLimit {
limit
cost
remaining
resetAt
}
repository(owner: "kubernetes", name: "kubernetes") {
pullRequests(last: 5, states: OPEN) {
nodes {
@rmmh
rmmh / torr.py
Last active March 19, 2018 21:16
Tiny .torrent file creator.
#!/usr/bin/env python2
'''
A tiny .torrent file creator with no external dependencies.
Easy to hack!
'''
import argparse
import hashlib
import os
@rmmh
rmmh / Github Helvetica.user.js
Created July 11, 2016 23:46
Github recently changed their default text font. This restores it to the previous settings -- Helvetica is prettier than Ubuntu Sans on Linux.
// ==UserScript==
// @name Github Helvetica
// @namespace http://userstyles.org
// @description Github recently changed their default text font. This restores it to the previous settings -- Helvetica is prettier than Ubuntu Sans on Linux.
// @author Ryan Hitchman
// @homepage https://userstyles.org/styles/130086
// @match https://github.com/*
// @match https://*.github.com/*
// @run-at document-start
// @version 0.20160711225447
@rmmh
rmmh / gol64.c
Last active March 14, 2016 05:17
Fast Conway's Game of Life evaluation using 64-bit integers
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef unsigned long long u64;
// Evaluate Conway's Game of Life for an 8x8 grid of cells
// The universe is closed (no wrapping, cells outside grid are dead)
u64 next(u64 cur) { // ~16.5 cycles (Haswell / GCC 5.2 -O3)
// General bit layout (MSB top left, LSB bottom right)
@rmmh
rmmh / -
Last active September 3, 2015 07:52
PICO-8 cart compression analysis. 'picolz' is the current compression method.
path text picolz zlib -9 lz4hc zlib code + ram
---------------------------------------------------- ------ -------- --------- ------- -----------------
2267_12639_chode_br.p8.png 0 8 8 20 74
2137_11694_interstellar.p8.png 248 180 152 191 1346
2338_13131_swirlthing.p8.png 314 254 213 269 296
2120_11629_heavy_snare_worm.p8.png 479 336 280 377 591
2109_11533_transdimensional_butterfly.p8.png 712 504 408 578 1090
2178_11993_garter.p8.png 729 503 388 555 524
2129_11647_snake_killer.p8.png 921 473 397 561 1316
2117_11597_workplace.p8.png 940 369 316 434 1058
@rmmh
rmmh / options.json
Last active October 6, 2015 01:17 — forked from anonymous/options.json
{"tickrate":15,"fillColor":"#222","backgroundColor":"#CC8","buzzColor":"#FFAA00","quietColor":"#000000","shiftQuirks":false,"loadStoreQuirks":false}
@rmmh
rmmh / readme.txt
Created September 1, 2014 16:07 — forked from anonymous/readme.txt
Play this game by pasting the script in http://www.puzzlescript.net/editor.html