Skip to content

Instantly share code, notes, and snippets.

View maraca's full-sized avatar

Martin Cozzi maraca

View GitHub Profile
@maraca
maraca / gist:1127145
Created August 5, 2011 08:48
Fun with Cassandra
time ./scripts/cassamine.py > record.txt
Traceback (most recent call last):
File "./scripts/cassamine.py", line 32, in <module>
main()
File "./scripts/cassamine.py", line 24, in main
'sha1': gen_hash(word, 'sha1'), })
File "/usr/local/lib/python2.6/dist-packages/pycassa/columnfamily.py", line 755, in insert
write_consistency_level=write_consistency_level)
File "/usr/local/lib/python2.6/dist-packages/pycassa/columnfamily.py", line 773, in batch_insert
batch.send()
@maraca
maraca / gist:1096231
Created July 21, 2011 00:12
Coding in French
#!/utilisateur/bin/frython
@privé
le debut class (ma variable)
le debut init(moi)
imprime 'Bonjour Monde'
le fin
le fin
@maraca
maraca / gist:1094164
Created July 20, 2011 01:40
Algo to parse periods of time.
#!/usr/bin/python2.6
import datetime
dates = [
datetime.date(2011, 01, 01),
datetime.date(2011, 01, 11),
datetime.date(2011, 01, 15),
datetime.date(2011, 01, 25),
datetime.date(2011, 01, 30),
@maraca
maraca / gist:1083737
Created July 14, 2011 23:43
Dijkstra in Q
/* dijkstra.q: Dijkstra's shortest path algorithm 10-21-01 AG */
import bag, dict, graph;
public dijkstra G S T;
private search G S T ST, search2 G S T ND ST;
private queue DIST, head Q, rmhead Q, change Q N D1 D2;
@maraca
maraca / generator.py
Created April 13, 2011 22:35
Generators in python
#!/usr/bin/python2.6
import random
# yields a random customer id
def random_generator(percentage):
for customer in xrange(1000000):
if random.randrange(0, 100, 1) < percentage:
yield customer
#!/usr/bin/python2.6
import random
values = range(0, 1000000)
customers = []
unpaid_customers = []
# generate a bunch of random values between 0 - 1000
for value in values:
#!/usr/bin/python2.6
import random
values = range(0, 1000000)
customers = []
unpaid_customers = []
# generate a bunch of random values between 0 - 1000
for value in values:
#!/usr/bin/python2.6
import random
values = range(0, 10000)
customers = []
unpaid_customers = []
# generate a bunch of random values between 0 - 1000
for value in values:
Hi gisty!
#!/usr/bin/python2.6
from setuptools import setup
setup(
name='gisty',
version='0.1',
description='Upload your code to gist.github.com based on https://gist.github.com/763188',
keywords='Gist Github',
package_dir = {'': 'src'},