Skip to content

Instantly share code, notes, and snippets.

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@suzaku
suzaku / test_sync
Last active December 21, 2015 04:09
O_DSYNC vs. O_SYNC vs. Call fsync manually vs. no sync
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
@kachayev
kachayev / dijkstra.py
Last active April 14, 2024 06:58
Dijkstra shortest path algorithm based on python heapq heap implementation
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:
@fcicq
fcicq / ed2kHash.py
Last active August 18, 2018 11:54
ed2kHash class for python (you may use it as alcc)
# 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
@rainly
rainly / git_tips.md
Created May 1, 2011 00:58 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@rainly
rainly / git-workflow.md
Created March 17, 2011 10:34 — forked from rainux/git-workflow.md
Git Workflow

Git Workflow

Consider three remote branches origin/master, origin/staging and origin/production. The master is the shared developers' edge. Staging is what is tested before a push to production and production is the code that gets deployed.

New Development