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/python2.6 | |
import random | |
values = range(0, 1000000) | |
customers = [] | |
unpaid_customers = [] | |
# generate a bunch of random values between 0 - 1000 | |
for value in values: |
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/python2.6 | |
import random | |
values = range(0, 1000000) | |
customers = [] | |
unpaid_customers = [] | |
# generate a bunch of random values between 0 - 1000 | |
for value in values: |
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/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 |
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
/* 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; |
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/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), |
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
#!/utilisateur/bin/frython | |
@privé | |
le debut class (ma variable) | |
le debut init(moi) | |
imprime 'Bonjour Monde' | |
le fin | |
le fin |
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
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() |
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
def arr_leader(values): | |
storage = {} | |
max_sum_key = values[0] | |
max_sum_val = 1 | |
for i in values: | |
if storage.get(i) is None: | |
storage[i] = 0 | |
storage[i] += 1 | |
# stores the current highest sum |
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/python2.7 | |
__author__ = "[email protected]" | |
import hashlib | |
import os | |
import qrcode | |
import time | |
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
A woman in a hot air balloon realized she was lost. She reduced | |
altitude and spotted a man below. Shee decended a bit more and | |
shouted: 'Excuse me, can you help me? I promised a friend I would meet | |
him an hour ago but I dont know where I am.' | |
The man below replied, 'You are in a hot air ballon hovering | |
approximately 30 feet above the ground. You are between 40 and 41 | |
degrees North latitude and between 59 and 60 degrees west longtitude.' | |
'You must be an Engineer,' said the balloonist. | |
'I am' replied the man, 'How did you know.' | |
'Well'; answered the balloonist, 'everything you have told me is |