Skip to content

Instantly share code, notes, and snippets.

View aparrish's full-sized avatar

Allison Parrish aparrish

View GitHub Profile
@aparrish
aparrish / mdprev.py
Created August 21, 2011 20:15
preview your markdown with a web server
#!/usr/bin/env python
# run like so:
# $ python mdprev.py --port=8000 --input=your_markdown_file.md
# then open your browser to http://localhost:8000/
# requires tornado and markdown2 https://github.com/trentm/python-markdown2
import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.options
@aparrish
aparrish / make_turk_job.py
Created October 28, 2011 21:46
make a mechanical turk job with boto
import boto.mturk
import boto.mturk.connection
import boto.mturk.price
from boto.mturk.question import *
import sys
question = QuestionForm([
Question(
identifier=1,
content=QuestionContent([
@aparrish
aparrish / right-handed sowpods
Created November 7, 2011 17:39
grep '^[poiuylkjhmnb]*$' sowpods.txt
bhikhu
bhikkhuni
bi
bib
bibb
bibliophil
bibliophily
bibliopoly
bijou
bikini
@aparrish
aparrish / make_s3_policy.py
Created November 30, 2011 21:04
make an s3 policy from a bucket name, secret key, and filename
def make_s3_policy(aws_bucket, aws_secret_key, filename, expiration_delta):
import datetime
import base64
import json
import hmac
from hashlib import sha1
expiration = (datetime.datetime.utcnow() + \
datetime.timedelta(seconds=expiration_delta)).strftime("%Y-%m-%dT%H:%M:%SZ")
policy = {
"expiration": expiration,
@aparrish
aparrish / len_scotus.txt
Created January 6, 2012 04:30
list of supreme court justices sorted by length of name
John Jay
Ward Hunt
Hugo Black
Abe Fortas
Thomas Todd
John McLean
John Catron
David Davis
Horace Gray
Earl Warren
@aparrish
aparrish / simplecometclient.py
Created January 24, 2012 21:57
simple python comet client
import email.utils # for rfc2822 formatted current timestamp
import requests
class CometClient(object):
def __init__(self, last_modified=None):
if last_modified is None:
self.last_modified = email.utils.formatdate()
else:
self.last_modified = last_modified
@aparrish
aparrish / blend.py
Created February 22, 2012 02:12
weird text blend procedure
import sys
import random
lines = list()
for line in sys.stdin:
line = line.strip()
lines.append(line)
for i, line in enumerate(lines):
@aparrish
aparrish / oprah.py
Created March 5, 2012 15:48 — forked from ktibb/oprah.py
import urllib
import BeautifulSoup
import re
html = urllib.urlopen('http://www.oprah.com/relationships/What-Kind-of-Woman-Watches-Porn-Researchers-Find-Answers').read()
soup = BeautifulSoup.BeautifulSoup(html)
#texts = soup.findAll(text=True)
texts = soup.find("div", {"class": "arial14"})

The first thing Zach Gage did, when I walked into his apartment, was apologize for the mess. He had just finished building, in a corner of his living room, an old-fashioned arcade cabinet — the kind of wooden, vending-machine-size techno-altar you would have seen teenagers huddled around in skating rinks in the early 1980s, except this one had a giant Mac monitor for its screen and a Mac mini for its guts and could play more than 3,000 games: everything from the paradigm-shifting superclassics (Space Invaders, Pac-Man) to experimental metagames that Gage and his indie-designer friends invented — with no budget, sometimes in just a few hours — over the last year or two.

Gage referred to his arcade as “a little shrine to games.” Building it, he said, had been his summer project; it cost him around six weeks and $1,000. He ordered parts from Hong Kong, then stripped and cut something like 100 wires, then figured out software to map them all to the various buttons. He had to learn the differences between Japanes

@aparrish
aparrish / zzt_toilets.txt
Created April 24, 2012 17:04
every occurrence of the word "toilet" in my ZZT-OOP corpus
A 'Toilet Bowling' set.
A Soviet toilet.
A Soviet toilet.
A Soviet toilet.
A Soviet toilet.
A Soviet toilet.
A Soviet toilet.
A Soviet toilet.
A TOILET!'
A ZZT standard toilet.