This file contains hidden or 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 | |
# encoding: utf-8 | |
from __future__ import division, with_statement | |
import sys | |
class Foo(object): | |
def bar(self, counter=[0]): | |
counter[0] += 1 | |
print("Counter is %i" % counter[0]) | |
This file contains hidden or 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 | |
# encoding: utf-8 | |
from __future__ import division, with_statement | |
import sys | |
# http://stackoverflow.com/questions/309884/code-golf-number-to-words | |
# http://en.wikipedia.org/wiki/Long_and_short_scales | |
"""Converts numbers to words using the English short scale.""" |
This file contains hidden or 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
/* | |
=skin= | |
@name Default | |
@author Yatrik Solanki | |
@homepage http://www.yatriksolanki.com | |
@email [email protected] | |
@license MPL/LGPL/GPL | |
=/skin= | |
*/ | |
This file contains hidden or 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/perl | |
use strict; | |
use warnings; | |
no warnings 'redefine'; | |
use XML::Atom::Client; | |
use XML::XPath; | |
my $username = 'email-address-here'; |
This file contains hidden or 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
size(520, 500) | |
from math import pi | |
data = [ | |
#Pattern,expedia.com,hotel-guides.us,travel.yahoo.com,travelocity.com,tripadvisor.com | |
['[x] hotel',0.02154,0.00903,0.35186,0.16603,0.45155], | |
['[x] hotel [x]',0.00000,0.00000,0.14872,0.26750,0.58378], | |
['[x] inn [x]',0.03185,0.00000,0.00000,0.24957,0.71859], | |
['hotel [x]',0.01385,0.02769,0.31154,0.23692,0.41000], | |
['hotel in [x]',0.03216,0.00000,0.53631,0.19191,0.23963], |
This file contains hidden or 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
size(520, 500) | |
from math import pi | |
data = [ | |
#Pattern,expedia.com,hotel-guides.us,travel.yahoo.com,travelocity.com,tripadvisor.com | |
['[x] hotel',0.02154,0.00903,0.35186,0.16603,0.45155], | |
['[x] hotel [x]',0.00000,0.00000,0.14872,0.26750,0.58378], | |
['[x] inn [x]',0.03185,0.00000,0.00000,0.24957,0.71859], | |
['hotel [x]',0.01385,0.02769,0.31154,0.23692,0.41000], | |
['hotel in [x]',0.03216,0.00000,0.53631,0.19191,0.23963], |
This file contains hidden or 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
var Expr = Sizzle.selectors = { | |
order: [ "ID", "NAME", "TAG" ], | |
match: { | |
ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, | |
CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/, | |
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/, | |
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, | |
TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/, | |
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, | |
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, |
This file contains hidden or 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 | |
# encoding: utf-8 | |
from __future__ import division, with_statement | |
import sys | |
import random | |
def somesort(data): | |
"""A dumb n**2 sort.""" | |
data = list(data) | |
result = list() |
This file contains hidden or 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 python3.0 | |
import sys | |
import multiprocessing | |
def process(function, name=None): | |
"""Decorates a into spawning a new process. Yay clarity.""" | |
def decorated(*args, *kwargs): | |
p = multiprocessing.Process(target=function, name=name, args=args, kwargs=kwargs) | |
p.start() |
This file contains hidden or 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
# posted partly as an aide-memoire, but more usefully, as a prompt | |
# for me to make this into a proper stop-start daemon | |
# hopefully, one that won't have hardcoded machine names... | |
IPADDR=`ifconfig en0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'` | |
ssh house.husk.org -N -f -L *:3698:foil:3689 | |
dns-sd -P "foil" _daap._tcp. local 3698 foil.local. $IPADDR txtvers=1 "Database ID=BC2C8AD5" "Machine ID=BC2C8AD5" & |