Skip to content

Instantly share code, notes, and snippets.

@dhepper
dhepper / gist:721676
Created November 30, 2010 13:31
tidypub
#!/usr/bin/python
import urllib
import urllib2
import re
import sys
URL = 'http://tidypub.org/'
r = urllib2.urlopen(URL)
for l in r.readlines():
@dhepper
dhepper / memcache_checker.py
Created November 30, 2010 16:54
memcache checker
#!/usr/bin/python
# memcache_checker.py
#
# checks a list of memcache servers for a given key
# usage: memcache_checker.py <key>
import sys
import socket
# a list of (host, port) tuples
@dhepper
dhepper / build.xml
Created July 25, 2011 13:29
Ant file for WikipediaMiner
<project name="WikipediaMiner" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="test" location="test"/>
@dhepper
dhepper / gen_aliases.sh
Created January 3, 2012 19:35
Generated aliases for Django management commands
for CMD in `python -c 'from django.core import management; print " ".join(management.get_commands().keys())'`
do
alias dj${CMD}="django-admin.py ${CMD}"
done
@dhepper
dhepper / append_gen_aliases.sh
Created January 4, 2012 08:37
Adds a script to generate aliases for Django management commands to bin/activate
cat <<EOT >> bin/activate
for CMD in \`python -c 'from django.core import management; print " ".join(management.get_commands().keys())'\`
do
alias dj\${CMD}="django-admin.py \${CMD}"
done
EOT
@dhepper
dhepper / vow_with_async_teardown_in_coffee.coffee
Created January 13, 2012 15:21
A Vow with asynchronous teardown in CoffeScript
assert = require 'assert'
vows = require 'vows'
tornDown = false
vows.describe('Vows with asynchronous teardowns').addBatch
'Context with long-running teardown':
'is run first': () ->
teardown: () ->
callback = @callback
setTimeout(() ->
@dhepper
dhepper / vow_with_teardown_in_coffee.coffee
Created January 13, 2012 15:03
A Vow with teardown in CoffeeScript
vows = require 'vows'
assert = require 'assert'
vows.describe("A Vow with teardown").addBatch
"A context":
topic: () ->
flag: true
"And a vow": (topic) ->
assert.isTrue(topic.flag)
teardown: (topic) ->
@dhepper
dhepper / vow_with_teardown.js
Created January 13, 2012 15:13
A Vow with teardown
vows = require('vows');
assert = require('assert');
vows.describe("A Vow with teardown").addBatch({
"A context": {
topic: function () {
return { flag: true };
},
"And a vow": function (topic) {
assert.isTrue(topic.flag);
assert = require 'assert'
vows = require 'vows'
tornDown = false
vows.describe('Vows with asynchronous teardowns').addBatch
'Context with long-running teardown':
'is run first': () ->
teardown: () ->
setTimeout(() =>
tornDown = true
vows = require('vows');
assert = require('assert');
vows.describe("Vows with asynchonous teardowns").addBatch({
"Context with long-running teardown": {
"is run first": function () {},
teardown: function () {
var callback = this.callback;
setTimeout(function () {