Skip to content

Instantly share code, notes, and snippets.

@rumple
rumple / pygo.py
Last active August 29, 2015 13:57
Stupid Python program that runs Go code.
#!/usr/bin/env python
# Stupid Python program that runs Go code.
import requests
import sys
import string
def run_go(src):
payload = {"version":2, "body": src}
@rumple
rumple / asm.py
Created August 22, 2013 22:53
Solution to Reddit's r/dailyprogrammer challenge #132. http://redd.it/1kqxz9
#!/usr/bin/env python
import sys
idx = 0
lit = 1
ops = {
("and", (idx, idx)): 0x0,
("and", (idx, lit)): 0x1,
("or", (idx, idx)): 0x2,
("or", (idx, lit)): 0x3,
#!/usr/bin/python
grid = [[8,8,4,4,5],[4,9,6,4,8],[8,6,4,1,2],[4,8,2,6,3],[0,6,8,8,4]]
seen_locations = []
def next_location(loc):
if loc[0]:
yield (loc[0] - 1, loc[1])
if loc[1]:
yield (loc[0], loc[1] - 1)
if loc[0] < 4:
yield (loc[0] + 1, loc[1])