This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://ayoungprogrammer.blogspot.ca/2013/01/part-3-making-ocr-for-equations.html | |
Equation OCR | |
*/ | |
#include <iostream> | |
#include <baseapi.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call(bank, address): | |
""" | |
Jumps into a function at a certain address. | |
""" | |
registers = get_registers() | |
push = [ | |
registers[0], | |
registers[5], | |
registers[4], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import lxml.etree | |
from StringIO import StringIO | |
def parse_html(content): | |
""" | |
A possibly safer way to parse HTML content with lxml. This will presumably | |
not break on poorly formatted HTML. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- Python code ensues | |
# Requires requests and beautiful soup four: install using | |
# "sudo pip-3.2 install bs4 requests" (preferably with "lxml" too) | |
import requests | |
import bs4 | |
refseq_ftp = "http://ftp.ncbi.nih.gov/refseq/release/microbial/" | |
genomes = requests.get(refseq_ftp) | |
link_and_size = [] | |
for x in genomes.text.splitlines(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Creates pretty-looking commit messages for git. This was created to pretty | |
print the old-commit-id values for filter-branched-rewritten commits in | |
pyphantomjs from the phantomjs repository. | |
""" | |
import os | |
import sys |