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 ord_dict(dict): | |
""" ord_dict is a dict that remembers the order in which its keys were originally inserted""" | |
def __init__(self): | |
self.ord_keys = [] | |
def keys(self): | |
return list(self.ord_keys) | |
def __setitem__(self, key, value): | |
if not self.has_key(key): |
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 | |
# geo-ip.py uses the geobytes.com API to find the probable | |
# geographic location for a particular IP address | |
# requires python 2.6 or json library; note that the free- | |
# of-charge geobytes API only allows 20 requests per hour. | |
# original author: Will Benton, 2009 | |
# this is public domain, there is no warranty, share and enjoy |
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
/* | |
midtest.m | |
example OS X CoreMIDI code; generates an unattractive stream of random notes | |
compile me with | |
gcc -framework Foundation -framework CoreMIDI midtest.m -o mt | |
Then run mt and set the input MIDI track for your favorite | |
synthesizer to "random notes;" enjoy (?) random notes |
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
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <deque> | |
#define MAX_LINE_LEN 1024 | |
struct Poller |
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
Preheat a griddle over a MEDIUM-HOT BURNER. Soften 2 TBSP BUTTER | |
(or use PEANUT or CANOLA OIL, which you will not need to soften). | |
In ONE BOWL, mix together 1.25 CUPS FLOUR, 1 TBSP SUGAR, 1 TSP SALT, | |
and 1 TSP BAKING POWDER. | |
In ANOTHER BOWL that is MORE THAN TWICE AS LARGE as the first, beat | |
ONE EGG well. Whisk in about 1.5 CUPS KEFIR (or WHOLE MILK MIXED | |
WITH PLAIN YOGURT). (You can adjust this amount to make thinner | |
or thicker pancakes.) Whisk in 1 TSP BAKING SODA. |
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
git clone http://git.apache.org/qpid.git/ qpid | |
cd qpid | |
for branch in $(git branch -r | grep -v master) ; do git branch --track $(echo $branch | cut -f2- -d/) $branch ; done | |
git remote add github git@github.com:willb/qpid.git | |
git push --all github |
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
Exception Type: EXC_BAD_ACCESS (SIGBUS) | |
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000f3f000 | |
Crashed Thread: 0 Dispatch queue: com.apple.main-thread | |
Thread 0 Crashed: Dispatch queue: com.apple.main-thread | |
0 com.apple.WebCore 0x93ffd790 WTF::HashTable<WebCore::StringImpl*, WebCore::StringImpl*, WTF::IdentityExtractor<WebCore::StringImpl*>, WebCore::StringHash, WTF::HashTraits<WebCore::StringImpl*>, WTF::HashTraits<WebCore::StringImpl*> >::rehash(int) + 544 | |
1 com.apple.WebCore 0x940369f8 WebCore::AtomicString::remove(WebCore::StringImpl*) + 56 | |
2 com.apple.WebCore 0x93ff4678 WebCore::StringImpl::~StringImpl() + 88 | |
3 com.apple.WebCore 0x9414d278 WebCore::MappedAttribute::~MappedAttribute() + 136 | |
4 com.apple.WebCore 0x9414d1d5 WTF::Vector<WTF::RefPtr<WebCore::Attribute>, 0ul>::shrink(unsigned long) + 85 |
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
#!/bin/bash | |
# Run git-tidy instead of "git clean" to keep from shooting yourself | |
# in the foot. Use "-i" to examine each file to be deleted. | |
function noninteractive() { | |
git clean -n | grep "Would remove" | |
echo |
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 ruby | |
# Why does this crash ruby 1.8.6 in Fedora 11 and 12? | |
# It seems to work in 1.8.5 and 1.8.7. | |
module Frotz | |
DICT = { | |
'map' => 'MAP' | |
} | |
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
#!/usr/bin/env ruby | |
# This code crashes ruby 1.8.6 in Fedora 11 and 12. | |
# It seems to work in 1.8.5 and 1.8.7. | |
module Frotz | |
DICT = { | |
'map' => 'MAP' | |
} | |
end |