Skip to content

Instantly share code, notes, and snippets.

View aparrish's full-sized avatar

Allison Parrish aparrish

View GitHub Profile
@aparrish
aparrish / exercise.txt
Last active August 29, 2015 13:56
supplemental exercise for RWET
(1) create a program that prints every other line of input.
i.e., if you ran the program like so:
$ python every_other_line.py <sea_rose.txt
it would produce the output
Rose, harsh rose,
meagre flower, thin,
@aparrish
aparrish / two_cats.py
Created March 27, 2014 14:53
prints out two cats
# vim:fileencoding=utf8
print u"🐱"
print u"\U0001F431"
@aparrish
aparrish / lebron_james.csv
Created May 29, 2014 02:16
LeBron James' 2013-2014 regular season game log, in CSV format.
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 30 columns, instead of 29 in line 9.
Rk,G,Date,Age,Tm,,Opp,,GS,MP,FG,FGA,FG%,3P,3PA,3P%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS,GmSc,+/-
1,1,2013-10-29,28-303,MIA,,CHI,W (+12),1,38:01,5,11,.455,0,1,.000,7,9,.778,0,6,6,8,1,0,2,0,17,16.9,+8
2,2,2013-10-30,28-304,MIA,@,PHI,L (-4),1,36:38,9,17,.529,4,7,.571,3,4,.750,0,4,4,13,0,0,4,3,25,21.4,-8
3,3,2013-11-01,28-306,MIA,@,BRK,L (-1),1,42:14,11,19,.579,1,2,.500,3,5,.600,1,6,7,6,2,1,5,2,26,19.9,-3
4,4,2013-11-03,28-308,MIA,,WAS,W (+10),1,34:41,9,14,.643,3,5,.600,4,5,.800,0,3,3,5,1,0,6,2,25,17.0,+16
5,5,2013-11-05,28-310,MIA,@,TOR,W (+9),1,36:01,13,20,.650,1,3,.333,8,8,1.000,2,6,8,8,0,1,1,2,35,33.9,+3
6,6,2013-11-07,28-312,MIA,,LAC,W (+5),1,37:09,6,13,.462,1,3,.333,5,9,.556,0,5,5,6,1,0,4,4,18,10.8,-1
7,7,2013-11-09,28-314,MIA,,BOS,L (-1),1,36:32,9,13,.692,0,0,,7,9,.778,1,7,8,10,0,0,5,1,25,23.1,+5
8,8,2013-11-12,28-317,MIA,,MIL,W (+23),1,29:58,13,21,.619,4,7,.571,3,6,.500,0,3,3,2,0,0,3,0,33,21.6,+14
9,9,2013-11-15,28-320,MIA,,DAL,W (+6),1,36:58,14,18,.778,1,1,1.000,10,11,.909,0,6,6,4,1,0,6,0,39,31.
@aparrish
aparrish / scores.txt
Created May 29, 2014 02:18
bunch of numbers, woo
17,25,26,25,35,18,25,33,39,30,13,21,22,35,28,27,26,23,21,21,24,17,25,30,24,18,38,19,33,26,26,15,30,32,32,36,25,21,34,30,29,27,18,34,30,24,31,13,37,36,42,33,31,20,61,22,19,17,23,19,21,24,43,15,25,32,38,17,13,32,17,34,38,29,37,36,27
@aparrish
aparrish / botdraft.txt
Created June 7, 2014 21:30
I am not going to finish this bot today. but here's the gist! haha literally gist.
X is a cleric. Its university is Y (http://dbpedia.org/ontology/EducationalInstitution).
X is a ship. Its ship draft (μ) is Y (http://www.w3.org/2001/XMLSchema#double).
X is a legislature. Its region served is Y (http://dbpedia.org/ontology/Place).
X is a dog. Its foal date is Y (http://www.w3.org/2001/XMLSchema#date).
X is a lake. Its area total (m2) is Y (http://www.w3.org/2001/XMLSchema#double).
X is a automobile engine. Its piston stroke (μ) is Y (http://www.w3.org/2001/XMLSchema#double).
X is a Painting. Its original title is Y (http://www.w3.org/2001/XMLSchema#string).
X is a speedway league. Its location city is Y (http://dbpedia.org/ontology/City).
X is a governmental administrative region. Its iso code of a province is Y (http://www.w3.org/2001/XMLSchema#string).
X is a murderer. Its waist size (μ) is Y (http://www.w3.org/2001/XMLSchema#double).
@aparrish
aparrish / exercise_d.py
Created March 11, 2015 16:26
Programming exercise D for RWET
#
# Worksheet #4
#
# This worksheet is also a Python program. Your task is to read the
# task descriptions below and then write one or more Python statements to
# carry out the tasks. There's a Python "print" statement before each
# task that will display the expected output for that task; you can use
# this to ensure that your statements are correct.
#
# In this worksheet, some of the tasks will throw an error that causes

Python ITP Group Regular Expressions Tutorial

I'll be working from these notes:

Source texts we'll use (download these to your working directory):

@aparrish
aparrish / wasteland.txt
Created May 1, 2015 20:49
gifs and t.s. eliot yay
I. THE BURIAL OF THE DEAD http://giphy.com/gifs/snl-sexy-boys-103KA5iywW1sPu
April is the cruellest month, breeding http://giphy.com/gifs/reaction-queue-dont-judge-102gtxf7BuxWj6
Lilacs out of the dead land, mixing http://giphy.com/gifs/television-real-housewives-10341OvHB1ikLK
Memory and desire, stirring http://giphy.com/gifs/mike-cam-dormtainment-103KE3fiQzcTZe
Dull roots with spring rain. http://giphy.com/gifs/football-soccer-102np7PW60nyNi
Winter kept us warm, covering http://giphy.com/gifs/twin-peaks-dale-cooper-102XsXDVcC6Bgs
Earth in forgetful snow, feeding http://giphy.com/gifs/rupauls-drag-race-season-4-logo-103Byejv85n0Oc
A little life with dried tubers. http://giphy.com/gifs/1016E9DEmOfOjS
Summer surprised us, coming over the Starnbergersee http://giphy.com/gifs/sexy-girl-hot-1002EGqllJzsSA
With a shower of rain; we stopped in the colonnade, http://giphy.com/gifs/bet-awards-ru-paul-more-than-juju-ever-did-10371OYDDs5Cow
@aparrish
aparrish / twitter_search.py
Created April 3, 2011 15:58
simple twitter search api client
import json
import urllib
import time
def search_twitter(query, callback, maxpages=10):
resp = urllib.urlopen('http://search.twitter.com/search.json%s' % query)
data = json.loads(resp.read())
for item in data['results']:
callback(item)
if 'next_page' in data and maxpages > 1:
@aparrish
aparrish / poem.py
Created April 3, 2011 15:59
generate simple poem from twitter search results
from twitter_search import search_twitter
import random
import sys
import re
class Thingy(object):
def __init__(self, words):
self.words = words
self.begins = dict([(word, []) for word in words])
self.ends = dict([(word, []) for word in words])