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
In [19]: fd = os.open('t1', os.O_CREAT | os.O_DSYNC | os.O_WRONLY) | |
In [20]: %timeit os.write(fd, 'a') | |
1000 loops, best of 3: 232 us per loop | |
In [21]: fd2 = os.open('t2', os.O_CREAT | os.O_SYNC | os.O_WRONLY) | |
In [22]: %timeit os.write(fd2, 'a') | |
1000 loops, best of 3: 737 us per loop | |
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
from collections import defaultdict | |
from heapq import * | |
def dijkstra(edges, f, t): | |
g = defaultdict(list) | |
for l,r,c in edges: | |
g[l].append((c,r)) | |
q, seen, mins = [(0,f,())], set(), {f: 0} | |
while q: |
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
# by fcicq (fcicq at fcicq dot net) @ 2012.5.12, Released under GPLv2 | |
import hashlib | |
try: | |
from cStringIO import StringIO | |
except ImportError: | |
from io import BytesIO as StringIO | |
if bytes != str: ord = int | |
class ed2kHash(): | |
CHUNK_SIZE = 9728000 | |
BLOCK_SIZE = 262144 |
(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )
git config --global user.name "Fernando Guillen"
git config --global user.email "[email protected]"
cd /develop/myrepo