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
class Memento : | |
__mem__ = {} | |
def __init__(self, f) : | |
self.f = f | |
def __call__(self, arg) : | |
if arg not in self.__mem__ : | |
self.__mem__[arg] = self.f(arg) | |
return self.__mem__[arg] |
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
while true; do echo -n "◐\r"; sleep .1; echo -n "◓\r"; sleep .1; echo -n "◑\r"; sleep .1; echo -n "◒\r"; sleep .1; done | |
while true; do echo -n "◜\r"; sleep .1; echo -n "◠\r"; sleep .1; echo -n "◝\r"; sleep .1; echo -n "◞\r"; sleep .1; echo -n "◡\r"; sleep .1; echo -n "◟\r"; sleep .1; done | |
while true; do a=$a" "; echo -n "\r" $a "✈ "; sleep .1; done | |
while true; do a=$a" "; echo -n "\r" $a "\xcf\x80\xce\xbf\xcf\x8d\xcf\x84\xcf\x83\xce\xb1 "; sleep .1; done |
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
class Node : | |
def __init__( self, data ) : | |
self.data = data | |
self.next = None | |
self.prev = None | |
class LinkedList : | |
def __init__( self ) : | |
self.head = None |
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
def intersection( *A ) : | |
res = [] | |
while True : | |
# check if the heads are the same | |
all_same = True | |
for i in range(1, len(A)) : | |
if len(A[i]) > 0 and len(A[i-1]) > 0 and A[i-1][0] == A[i][0] : | |
pass | |
else : | |
all_same = False |
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
''' | |
convert a number (given in string format) from a base f to base t | |
''' | |
import string | |
def convertbase( n, f, t ) : | |
digits = list(string.digits+string.uppercase) | |
rev_digits = {} |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
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
# -*- encoding: utf-8 -*- | |
def latex_decode( s ) : | |
''' | |
A simple function which taks a latex escaping command | |
and returns the appropriate unicode character according | |
to this table (via wikipedia): | |
LaTeX command Sample Description | |
\`{o} ò grave accent |
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
Django==1.4 | |
South==0.7.6 | |
django-dbsettings==0.2 | |
django-grappelli==2.3.8 | |
pyechonest==4.2.21 | |
simplejson==2.6.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
import json | |
class API : | |
ERROR = -1 | |
OK = 0 | |
class APIResponse(API) : | |
def __init__(self, code, data) : | |
self.code = code | |
self.data = data |
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
<html> | |
<head> | |
</head> | |
<body> | |
</body> | |
</html> |