Skip to content

Instantly share code, notes, and snippets.

View winterstream's full-sized avatar

Wynand Winterbach winterstream

  • Google
  • Zurich, Switzerland
View GitHub Profile

A Bloom Filter in Redis

This is a really simple implementation of a bloom filter using Redis 2.6's lua scripting facility.

Though it "works", it's just a proof of concept. The choice and implementation of hashing functions leave something to be desired (I'm sure it's a fine implementation of CRC32 that I borrowed, but it's in pure lua, and, well, CRC32 is not the best function to use for a bloom filter).

Caveat Emptor, no refunds, etc. MIT License.

;;;
;;; Blog post at http://wp.me/p12FcK-3
;;;
;;; Loom: http://github.com/jkk/loom
;;; GraphViz: http://graphviz.org
;;; Ubigraph: http://ubietylab.net/ubigraph/
;;;
(ns user
(:use [clojure.string :only [lower-case split-lines join]]
@winterstream
winterstream / gist:3776246
Created September 24, 2012 14:34 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@winterstream
winterstream / gevent-fork-0mq.py
Created August 29, 2012 23:55 — forked from gdamjan/gevent-fork-0mq.py
fork a process in gevent for cpu intensive stuff / with zeromq communication
# You need gevent 1.0 and pyzmq 3.x currently unreleased
#
# pip install hg+https://bitbucket.org/denis/gevent
# pip install git+git://github.com/zeromq/pyzmq.git
#
import gevent
import zmq.green as zmq
import os, sys