Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Hitchman rmmh

View GitHub Profile
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.
@rmmh
rmmh / query.gql
Created Jul 31, 2017
Example Github GraphQLv4 Usage
View query.gql
{
rateLimit {
limit
cost
remaining
resetAt
}
repository(owner: "kubernetes", name: "kubernetes") {
pullRequests(last: 5, states: OPEN) {
nodes {
@rmmh
rmmh / torr.py
Last active Mar 19, 2018
Tiny .torrent file creator.
View torr.py
#!/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 Jul 11, 2016
Github recently changed their default text font. This restores it to the previous settings -- Helvetica is prettier than Ubuntu Sans on Linux.
View Github Helvetica.user.js
// ==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
You can’t perform that action at this time.