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
#!/usr/bin/env python | |
"""A simple Bloom Filter implementation | |
Calculating optimal filter size: | |
Where: | |
m is: self.bitcount (how many bits in self.filter) | |
n is: the number of expected values added to self.filter | |
k is: the number of hashes being produced | |
(1 - math.exp(-float(k * n) / m)) ** k | |
http://en.wikipedia.org/wiki/Bloom_filter | |
""" |
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
#!/usr/bin/python | |
# Find the sum of all the multiples of 3 or 5 below 1000. | |
import unittest | |
from multiprocessing import Pool | |
class main_test(unittest.TestCase): | |
def test_multisum(self): | |
self.assertEqual(multisum(3, 10), 18) # 3,6,9 |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
# You need PIL <http://www.pythonware.com/products/pil/> to run this script | |
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use | |
# any TTF you have) | |
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com] | |
# License: GPL <http://www.gnu.org/copyleft/gpl.html> | |
from image_utils import ImageText |
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
; Welcome to the first installment of emacs-command-a-day. Learning | |
; emacs can be hard as there are many commands and key-bindings that | |
; beginners find difficult. To help you make the transition to "the | |
; best text editor ever", I'll bring you one command each week day, so | |
; you can practice on your own at a reasonable pace. | |
;; Emacs Installation Notes | |
; I assume that you can start emacs. If you have no idea how, (on a | |
; mac or linux system) you should be able to open up a terminal and |