Skip to content

Instantly share code, notes, and snippets.

View StephenKrewson's full-sized avatar

Stephen Krewson StephenKrewson

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am StephenKrewson on github.
  • I am stephen_krewson (https://keybase.io/stephen_krewson) on keybase.
  • I have a public key whose fingerprint is 7BAF 95A8 21A8 C7CB F07D A8B1 C43A F4D7 1E8B 2DDE

To claim this, I am signing this object:

@StephenKrewson
StephenKrewson / clarissa.py
Last active December 14, 2015 20:39
This script was designed to read through a text file of Samuel Richardson's Collection of the Moral and Instructive Sentiments [1755] digitized by Eighteenth Century Collections Online and the Text Creation Partnership.
import re, sys
from collections import defaultdict
romanNum = {'i':1, 'ii':2, 'iii':3, 'iv':4, 'v':5, 'vi':6, 'vii':7, 'viii':8}
def Roman(num):
"""Hack for dealing with volume numbers less than nine"""
if num.lower() in romanNum:
return romanNum[num.lower()]
f1 = open(sys.argv[1], 'r') # Read in CMIS file
f2 = open(sys.argv[2], 'r') # Read in Table of Contents file
topics = [line.strip() for line in f2 if len(line) > 3] # Create array of topics
@StephenKrewson
StephenKrewson / Twitter Random Language Poetry
Last active December 16, 2015 09:59
~twitter poems~ (debuted at XS Collaborative exhibition with Hans Schoenburg, New Haven, April 2013)
import re, sys, nltk, string, matplotlib, HTMLParser
from nltk.corpus import cmudict
from random import choice, randint
from nltk.tokenize import *
from nltk import FreqDist
from twython import Twython
# OAuth2 authentication
t = Twython('',
'',
@StephenKrewson
StephenKrewson / gist:7147625
Created October 25, 2013 00:39
JPEG Semantic Glitcher
import time
start_time = time.clock()
#############################################
# myProgram.py | inputDir | print? | min_word | delete? | shift | Oulipo? | N + ?
#############################################
import sys, re, string, random # Import required modules
from collections import defaultdict
from itertools import chain
from os import walk, path
#############################################