Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Hitchman rmmh

  • Boulder, Colorado
View GitHub Profile
View covid_deaths.py
#!/usr/bin/env python3
import re
import urllib
import dateutil
import requests_cache
session = requests_cache.CachedSession(allowable_codes=(200, 404))
session.headers['User-Agent'] = 'CovidDeathsPopularity/1.0 (hitchmanr@gmail.com) python3/requests'
View pb_glance.py
#!/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
#
# Unless required by applicable law or agreed to in writing, software
@rmmh
rmmh / paths.go
Last active Apr 25, 2021
worm-polyomino counting
View paths.go
// How many distinct closed paths visit each cell in an NxN grid exactly once?
package main
import (
"fmt"
"math/bits"
)
type walls struct {
View gist:6bcc6de6153f0467b1bec686a9ad832d
#!/usr/bin/env python3
# an experiment in using a large corpus of phrases to generate initialisms from
import re
import zipfile
from nltk import tokenize
phrases = {}
@rmmh
rmmh / bb.java
Created Jan 10, 2019
Minecraft Mod: Optimine 1.3_01v2 Source Code.
View bb.java
import org.lwjgl.opengl.GL11;
public abstract class bb {
protected pd b;
private ic a = new dx();
private bw e = new bw();
protected float c = 0.0F;
protected float d = 1.0F;
@rmmh
rmmh / RegionFile.java
Last active Jan 10, 2019
Source code for the 2011 McRegion Minecraft mod, which was included in Beta 1.3. dn.java and on.java are the integration points.
View RegionFile.java
/*
** 2011 January 5
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**/
@rmmh
rmmh / chunkrenderqueue.java
Last active Jan 10, 2019
Source for part of the ancient Minecraft FastRender mod. Pick the closest 3 chunks to render without doing a full sort.
View chunkrenderqueue.java
public boolean a(ei camera, boolean firstRun)
{
hz cmp = new hz(camera);
bz[] toAdd = new bz[3]; //TODO: throughout: bz should be something like "Chunk"
ArrayList<bz> nearChunks = null;
int pendingChunkSize = this.m.size();
int pendingChunkRemoved = 0;
@rmmh
rmmh / gage_lengths.py
Last active Nov 1, 2018
Compute the number of possible lengths expressed with Johansson's standard 81 inch gauge blocks, as described in https://youtu.be/gNRnrn5DE58?t=1597
View gage_lengths.py
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 Oct 12, 2018
A straightforward docker container differ, originally used for Kubernetes test infrastructure. Consider using https://github.com/GoogleContainerTools/container-diff instead.
View docker_diff.py
#!/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 Jul 31, 2018
Simple script to adjust a series of photos to add missing exif date information in a series of photos.
View fill_gaps.py
#!/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.