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
Faust, by now aged and blind all over again, gives orders for thousands of workers to be summoned to dig canals and drain the marshes. His brain, senile for the second time and-- or so the cynic Mephistopheles thinks -- crazed and clouded, is aglow with a grand idea: to make mankind happy. At a signal from Mephistopheles, hell's servants appear and start digging Faust's grave. Mephistopheles has lost all hope of winning his soul and simply wants to bury him, to be rid of him. Faust hears the sound of many shovels. "What is that?" he asks. The spirit of mockery has not deserted Mephistopheles. He paints Faust a false picture of the draining of the marshes. Soviet critics like to interpret this passage in the spirit of socialist optimism: As they would have it, Faust, feeling that he has benefited mankind, and finding in this his supreme joy, exclaims: "Stay, fleeting moment, thou art beautiful!" But we have to ask ourselves whether Goethe was not ridiculing the idea of human happiness. Because in reality nothi |
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 mediacloud | |
import json | |
mc = mediacloud.api.MediaCloud('') | |
# query mentions of civic hacking | |
res = mc.sentenceList('( hacking AND civic ) OR ( hackathon AND civic)', '+publish_date:[2013-01-01T00:00:00Z TO 2014-04-19T00:00:00Z] AND +media_sets_id:1') | |
#print "found " + res['response']['numFound'] + " sentences" | |
story_ids = [] | |
[story_ids.append(i) for i in [y["stories_id"] for y in res["response"]["docs"]] if not story_ids.count(i)] |
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 nltk | |
from urllib import urlopen | |
# download alice in wonderland | |
url = "http://www.gutenberg.org/cache/epub/11/pg11.txt" | |
raw_text = urlopen(url).read() | |
tokens = nltk.word_tokenize(raw_text) | |
freq_dist = nltk.FreqDist(tokens) | |
#freq_dist.plot(50, cumulative=False) |
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 nltk | |
import urllib | |
import json | |
import urllib2 | |
from urllib import urlopen | |
# download From Egypt to Japan by Henry Martyn | |
url = "http://www.gutenberg.org/cache/epub/39474/pg39474.txt" | |
raw_text = urlopen(url).read() |
This file has been truncated, but you can view the full file.
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
The Project Gutenberg EBook of Moby Dick; or The Whale, by Herman Melville This eBook is for the use of anyone anywhere at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org Title: Moby Dick; or The Whale Author: Herman Melville Last Updated: January 3, 2009 Posting Date: December 25, 2008 [ EBook # 2701 ] Release Date: June, 2001 Language: English *** START OF THIS PROJECT GUTENBERG EBOOK MOBY DICK; OR THE WHALE *** Produced by Daniel Lazarus and Jonesey MOBY DICK; OR THE WHALE By Herman Melville Original Transcriber's Notes: This text is a combination of etexts, one from the now-defunct ERIS project at Virginia Tech and one from Project Gutenberg's archives. The proofreaders of this version are indebted to The University of Adelaide Library for preserving the Virginia Tech version. The resulting etext was compared with a public domain hard copy version of the t |
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
require 'csv' | |
emails = CSV.read(ARGV[0]) | |
emails.shift | |
full_emails = [] | |
emails.each do |email| | |
if(!email[0].nil? and email[0].strip.size>0) | |
full_emails << email[0].strip | |
end | |
end |
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
#don't use this. | |
# Use https://github.com/mysociety/popit-python instead. | |
# But I didn't have the heart not to put it online | |
# after several hours of creating this, before realizing | |
# that a library already existed, and that | |
# it just hadn't appeared in my search results and | |
# the library wasn't listed in mySociety API documentation | |
import requests, json, yaml |
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
#adapted from minus_context | |
import nltk | |
import feedparser | |
import random | |
import twitter | |
import yaml | |
import string | |
import re | |
from urlparse import urlparse |
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 codecs | |
import json | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from scipy import stats | |
from dateutil import * | |
import math | |
import statsmodels.formula.api as sm |
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
class SillyError < StandardError; end | |
module CatchAnError | |
def self.included base | |
base.extend CatchSpecific | |
end | |
module CatchSpecific | |
def catch_specific_error(a,stdout) | |
num_attempts = 0 |