Skip to content

Instantly share code, notes, and snippets.

duggan / receive.js
Created Mar 8, 2012
Node.js script. Spits out the headers of a request - useful for basic remote request testing
View receive.js
var http = require('http');
var qs = require('querystring');
/* Host / Port configuration.
Defaults to listening on all interfaces, port 80.
var host = "";
var port = 80;
http.createServer(function (req, res) {
duggan / das-keyboard-uk-osx.xml
Created Apr 2, 2012
Das Keyboard UK Keyboard Layout for OSX
View das-keyboard-uk-osx.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!-- This goes in /Users/<username>/Library/Keyboard Layouts/daskeyboard.keylayout -->
<!-- Select it by checking the Das Keyboard option in System Preferences -> Languages & Text -> Input Sources -->
<keyboard group="0" id="2" name="Das Keyboard - UK" maxout="1">
<layout first="0" last="0" modifiers="commonModifiers" mapSet="ANSI"/>
<modifierMap id="commonModifiers" defaultIndex="0">
<keyMapSelect mapIndex="0">
import sys
from boto.ec2.connection import EC2Connection
from boto.exception import BotoServerError
maintenance_instances = []
""" Get EC2 connection """
duggan / test-memcache.php
Created May 9, 2012
Test a memcache connection
View test-memcache.php
* Some basic connectivity tests for a memcache server.
* $host string Memcache server address to connect to
* $port int Memcache server port
* $key string A key for setting a test value
* $var string A test value to be set
duggan / neologism.php
Created May 14, 2012
Mash dictionary words into a selected word to create neologism candidates
View neologism.php
* Neologism
* Mash a selected word into dictionary words,
* sort into a list for perusal. Not terribly memory friendly.
* @arg string $word The word to be mashed.
* @arg string $end_part The end part of the word to start the mashing from.
duggan /
Created Jul 4, 2012
Basic distributed filesystem write performance test.
#!/usr/env python
import uuid
import time
import sys
import getopt
def main():
opts, args = getopt.getopt(sys.argv[1:], "fd:v", ["files=", "directory="])
View index.php
$base = "";
$metadata = array("instance-id", "hostname", "instance-type", "public-hostname", "security-groups",
"ami-id", "ami-launch-index", "ami-manifest-path", "kernel-id","mac","reservation-id"
echo "<style>td{white-space:nowrap;}</style>";
echo "<table>";
foreach ($metadata as $info) {
duggan / shlint.gemspec
Created Oct 24, 2012
shlint gemspec (example)
View shlint.gemspec
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib) do |s| = "shlint"
s.version = "0.1.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Ross Duggan"] = [""]
duggan /
Created Oct 30, 2012
Big Red Button - playing sounds on Windows
import sys
import time
import usb
import winsound
Using the MetricFire "Big Red Button" to play buzzer sounds.
Buzzer sounds should be WAV files.
Gonna need to follow the driver installation instructions here:
View exceptions.rb
exceptions = []
tree = {}
ObjectSpace.each_object(Class) do |cls|
next unless cls.ancestors.include? Exception
next if exceptions.include? cls
exceptions << cls
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}}
indent = 0