Skip to content

Instantly share code, notes, and snippets.

@kanzure
kanzure / sciencemag.sh
Created January 16, 2013 21:57
sciencemag.org downloader
#!/usr/bin/perl
# Scraper for Science Magazine
# Needs curl and grep and mkdir
# Just use it on Linux
# Downloads paper and all available supplementary data
# including movies and tables
# Also downloads Table of Contents for each issue
# Should store all the data properly so one can browse from
# each TOC
@kanzure
kanzure / sample.py
Last active December 11, 2015 16:58
spectrometer
class Spectrometer:
def read(self):
"""
Reads the data from the last capture.
"""
raise NotImplementedError("This must be implemented by the subclass.")
def detect(self):
"""
Returns whether or not this type of spectrometer seems to be present.
@kanzure
kanzure / README.md
Created February 1, 2013 01:59
python-rompatcher-readme

Rompatcher

Rompatcher is a python library for "patching" ROMs. It allows you to write (in a config file you can share) exactly what changes you want to make to a ROM. When you run the file, the changes are executed. The output is a usable ROM.

Installing

Simple.

sudo pip install rompatcher
@kanzure
kanzure / main.cpp
Created February 4, 2013 19:34
ayoungprogrammer-equation-ocr
/*
http://ayoungprogrammer.blogspot.ca/2013/01/part-3-making-ocr-for-equations.html
Equation OCR
*/
#include <iostream>
#include <baseapi.h>
@kanzure
kanzure / pc-trail.clj
Created February 25, 2013 22:57
pc-trail
(defn pc-trail
"Track the PC for a number of ticks."
[state ticks]
(tick state)
(set-state! state)
(loop [pcs [(PC)] ]
(if (> (count pcs) ticks) pcs
(do
(com.aurellem.gb.Gb/tick)
(recur (conj pcs (PC)))))))
@kanzure
kanzure / helpers.clj
Created February 25, 2013 23:05
vba-clojure-helpers
(defn first-change
"Watch the current memory location as it ticks,
return the first state that differs at location mem."-
[state n]
(tick state)
(set-state! state)
(let [init (aget (memory state) n)]
(loop []
(if (= (aget (memory) n) init)
(do
@kanzure
kanzure / vba-clojure.c
Created February 26, 2013 01:22
vba-clojure bug?
// let the player control the game until he decides he hates it. This is particularly useful for playing from the repl.
void stepUntilCapture() {
while (currentButtons[0] != 2048) {
/* if (currentButtons[0] != 0) {
printf("currentButtons[o] is %d\n", currentButtons[0]);
} */
step();
}
// reset the buttons so that this function can be called in the future
@kanzure
kanzure / vbawarp.py
Created February 28, 2013 08:36
vba-warping
import vba
vba.load_rom()
# load my favorite state
vba.set_state(vba.load_state("mom-speech-1-before"))
# set warp memory
vba.set_memory_at(0xdcb5, 0x1)
vba.set_memory_at(0xdcb6, 0x1)
vba.set_memory_at(0xdcb8, 0x1)
@kanzure
kanzure / vba-tilemap.py
Created March 1, 2013 00:35
vba-tilemap
import vba
vba.load_rom()
vba.set_state(vba.load_state("talking-with-npc"))
vba.step()
tiles = vba.get_memory_range(0xc4a0, 1000)
from chars import chars
output = ""
@kanzure
kanzure / call.vba.py
Created March 1, 2013 05:56
vba-call
def call(bank, address):
"""
Jumps into a function at a certain address.
"""
registers = get_registers()
push = [
registers[0],
registers[5],
registers[4],