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 / DPU16.txt
Created August 27, 2013 15:52
DCPU-16 protection unit spec.
DCPU-16 Hardware Info:
Name: DPU16 -- DCPU Protection Unit (16-process version)
ID: 0x1071c17b, version: 0x1000
Manufacturer: 0xcafe31aa
Description:
The DPU prevents unauthorized access to memory and hardware peripherals.
Access permissions are determined by the process ID's bit being set in the
corresponding mask.
@rmmh
rmmh / chunkrenderqueue.java
Last active January 10, 2019 05:30
Source for part of the ancient Minecraft FastRender mod. Pick the closest 3 chunks to render without doing a full sort.
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 / RegionFile.java
Last active January 10, 2019 05:29
Source code for the 2011 McRegion Minecraft mod, which was included in Beta 1.3. dn.java and on.java are the integration points.
/*
** 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 / 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 / options.json
Last active May 14, 2018 07:20 — forked from anonymous/options.json
Chip8 Mr Worm (made with Octo)
{"tickrate":"20","backgroundColor":"#640","fillColor":"#A5A","buzzColor":"#FFAA00","quietColor":"#000000","shiftQuirks":false,"loadStoreQuirks":false}
@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 / readme.txt
Last active March 17, 2018 06:07
PuzzleScript Demake of PUSH, from http://lonebot.net/games/push/
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@rmmh
rmmh / script.txt
Created April 23, 2014 15:26
Liquid War prototype.
title Liquid War Alpha
author Ryan Hitchman
realtime_interval .1
========
OBJECTS
========
Bg