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
wget --header="Accept:application/rdf+xml" http://demo.ckan.org/dataset/gold-prices |
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 re | |
import sys | |
import ckanclient | |
import dateutil.parser | |
import datetime | |
em = re.compile('.*@(.*)') | |
spammy = ["yahoo.com", "hotmail.com", 'mindpowerup.com', | |
"yahoo.co.uk", 'acumenwit.com', 'hotmail.fr', |
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
(ns hangman.core | |
(:gen-class) | |
(:require [clojure.string :as str])) | |
(defn char_to_draw | |
"Chooses whether to draw a _ or a char" | |
[ch guesses] | |
(if (is_char_in_words ch guesses) | |
(str ch " ") | |
(str "_ ") |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
# lovematch asks for two names and determines their compatibility | |
# IPO imminent | |
import sys | |
VOWELS = "aeiou" | |
def get_score_for(person): |
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
common = ['e','t', 'i', 's', 'o', 'n', 'h', 'r', 'a', 'f', 'u', 'l', 'd', 'g', 'm', 'w', 'p', 'y', 'c', 'b', 'v', 'k', 'x', 'j', 'q', 'z'] |
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
#!/usr/bin/env python | |
import urllib,requests | |
from lxml.html import fromstring | |
SCRAPER_NAME = "smr" | |
code = 'http://classic.scraperwiki.com/editor/raw/{0}'.format(SCRAPER_NAME) | |
db = 'https://classic.scraperwiki.com/scrapers/export_sqlite/{0}/'.format(SCRAPER_NAME) | |
lang_page = fromstring(requests.get('http://classic.scraperwiki.com/scrapers/{0}'.format(SCRAPER_NAME)).content) |
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
<?php | |
error_reporting(E_ALL); | |
date_default_timezone_set('Europe/London'); | |
$publisher = $_GET["publisher_name"]; | |
// TODO: Validate publisher name | |
/* For the given publisher, return the entire list of sub-publishers | |
as a flat array of names (including the one provided). */ | |
function get_subpublishers_for($name) { |
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
#!/usr/bin/env python | |
from lxml import etree | |
TABLE_NS = u"urn:oasis:names:tc:opendocument:xmlns:table:1.0" | |
TEXT_NS = u"urn:oasis:names:tc:opendocument:xmlns:text:1.0" | |
def get_rows_from_file(doc): | |
nodes = doc.xpath("//t:table[1]", namespaces={"t": TABLE_NS}) | |
if nodes: |
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
#!/usr/bin/env python | |
from lxml import etree | |
import mmap | |
def ram_used(where): | |
import resource | |
print "func:{0}:{1}".format(where, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024) | |
def _fast_iter(context, func): |
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
#!/usr/bin/env python | |
""" | |
1. Connect to sqlite. | |
2. Write out data column into name.json | |
1. For each name, create a folder with that name, write the code into that folder. | |
2. Download the data file | |
3. Move the name.json into the folder (it's done) | |
""" |