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
/* | |
For any 1<k<=64, let mask=(1<<k)-1. hash_64() is a bijection on [0,1<<k), which means | |
hash_64(x, mask)==hash_64(y, mask) if and only if x==y. hash_64i() is the inversion of | |
hash_64(): hash_64i(hash_64(x, mask), mask) == hash_64(hash_64i(x, mask), mask) == x. | |
*/ | |
// Thomas Wang's integer hash functions. See <https://gist.github.com/lh3/59882d6b96166dfc3d8d> for a snapshot. | |
uint64_t hash_64(uint64_t key, uint64_t mask) | |
{ | |
key = (~key + (key << 21)) & mask; // key = (key << 21) - key - 1; |
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 debruijn(k, n): | |
""" | |
De Bruijn sequence for alphabet size k (0,1,2...k-1) | |
and subsequences of length n. | |
From wikipedia Sep 22 2013 | |
""" | |
a = [0] * k * n | |
sequence = [] | |
def db(t, p,): | |
if t > n: |
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
from PIL import Image | |
import numpy | |
from skimage.filter import sobel | |
from skimage.morphology import watershed | |
from scipy import ndimage as nd | |
grind = numpy.asarray(Image.open('grind.png')).mean(axis=2) | |
edges = sobel(grind) | |
markers = numpy.zeros_like(grind) |
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
pkgname=vagrant | |
pkgver=1.2.1 | |
pkgrel=4 | |
pkgdesc="Tool for building and distributing virtualized development environments" | |
arch=('i686' 'x86_64') | |
url='http://vagrantup.com/' | |
license=('MIT') | |
depends=('ruby' 'virtualbox>=4.0' 'ruby-net-ssh>=2.6.6' \ | |
'ruby-net-scp>=1.1.0' 'ruby-erubis>=2.7.0' 'ruby-i18n>=0.6.0' \ | |
'ruby-log4r>=1.1.9' 'ruby-childprocess>=0.3.7') |
NewerOlder