Skip to content

Instantly share code, notes, and snippets.

Avatar

John Harrison bloomonkey

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am bloomonkey on github.
  • I am bloomonkey (https://keybase.io/bloomonkey) on keybase.
  • I have a public key ASB7T45eCErQED60GdPMocBfSVFSQU6EfBRHN_y3LEPeSAo

To claim this, I am signing this object:

@bloomonkey
bloomonkey / numerals.py
Created Jun 11, 2013
Convert Roman numeral strings to integers #PyPool
View numerals.py
"""Roman Numeral to Arabic Numbers.
Some doctests:
>>> convert_to_arabic('Nulla')
0
>>> convert_to_arabic('i')
1
>>> convert_to_arabic('v')
5
@bloomonkey
bloomonkey / decypher.py
Last active Dec 17, 2015 — forked from davidtweaver/gist:5570661
Code Breaking. PyPool attempts to solve programming challenge: http://pi3.sites.sheffield.ac.uk/mini-challenges/chal6
View decypher.py
"""Code Breaking.
PyPool attempts to solve programming challenge:
http://pi3.sites.sheffield.ac.uk/mini-challenges/chal6
"""
import string
# Encoded sentences
@bloomonkey
bloomonkey / tornadoSRU.py
Created Oct 25, 2012
Deploying Cheshire3's SRU Server in Tornado
View tornadoSRU.py
import tornado.web
import tornado.httpserver
import tornado.wsgi
from cheshire3.web.sruWsgi import application
container = tornado.wsgi.WSGIContainer(application)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
@bloomonkey
bloomonkey / subjectURIs.py
Created Oct 24, 2012
Generate Archives Hub URIs for records matching a given subject
View subjectURIs.py
"""Generate Archives Hub URIs for records matching a given subject.
Usage: %prog [options] subject
"""
import sys
import os
from contextlib import contextmanager
@bloomonkey
bloomonkey / addDoctype.py
Created Jul 30, 2012
Python (2.5 < v < 3.0) script to insert XHTML Doctype declaration at start of files where it's missing for a given directory
View addDoctype.py
from __future__ import with_statement
import sys
import os
try:
myDir = sys.argv[1]
except IndexError:
myDir = os.getcwd()
for root, dirs, files in os.walk(myDir):
@bloomonkey
bloomonkey / caselessDictionary.py
Created Jun 27, 2012
A Python dictionary sub-class that is case-insensitive when searching, but also preserves the keys as inserted.
View caselessDictionary.py
class CaselessDictionary(dict):
"""A dictionary with case-insensitive keys.
A dictionary that is case-insensitive when searching, but also preserves
the keys as inserted.
"""
def __init__(self, initval={}):
if isinstance(initval, dict):
for key, value in initval.iteritems():