Skip to content

Instantly share code, notes, and snippets.

View giomasce's full-sized avatar

Giovanni Mascellani giomasce

View GitHub Profile
#!/bin/bash
# Call it with incremental_patches.sh patch1 patch2 patch3
# It will modify each patch so that it first applies all the previous
# ones, then the patch itself
LAST=
for i in "$@" ; do
echo $i $LAST
if [ "x$LAST" != "x" ] ; then
# See docs in http://git-annex.branchable.com/internals/hashing/ and implementation in http://sources.debian.net/src/git-annex/5.20140227/Locations.hs/?hl=408#L408
import hashlib
import struct
def hashdirlower(key):
hasher = hashlib.md5()
hasher.update(key)
digest = hasher.hexdigest()
return "%s/%s/" % (digest[:3], digest[3:6])