gre
|
codepad
|
|
gre
|
Saved pastes by gre:
#!/usr/bin/env python
"""shamir_threshold_scheme.py
Shamir's (k, n) threshold scheme. See "The Handbook of Applied Cryptography" or
Shamir's 1979 paper, "How to Share a Secret."
|
view (76 lines, 22 lines of output) |
#################
# c2.pyx
# compile this with the help of setup.py (below), via:
# python setup.py build_ext --inplace
#################
|
view (73 lines) |
#!/usr/bin/env python
############################
# Behind the Scenes #
############################
|
view (109 lines) |
#!/usr/bin/env python
"""random_ge_one.py
Add up uniformly distributed random numbers between zero and one, counting how
|
view (43 lines, 1 line of output) |
#!/usr/bin/env python
def pop1(n):
# Naive; first changes n to binary, then adds up bits one by one
|
view (78 lines) |
#!/usr/bin/env python
"""dijkstraMaster.py
A submission to Programming Praxis for Dijkstra's Algorithm. Uses a min
|
view (129 lines, 1 line of output) |
#!/usr/bin/env python
import random
from cookbook import primes
# Sieve of Eratosthenes based primes < n, speedy and space efficient
|
view (69 lines) |
#!/usr/bin/env python
"""
dijkstra2.py
A slightly faster implementation of Dijkstra's Algorithm, using a linear search
|
view (59 lines, 1 line of output) |
#!/usr/bin/env python
"""
My submission to Programming Praxis for "Tracking Santa":
http://programmingpraxis.com/2010/12/24/tracking-santa/
To run, save the data.js file in the same directory, delete "var locations = "
|
view (50 lines) |
#!/usr/bin/env python
"""
dijkstra.py
A conceptually simpler but less efficient implementation of Dijkstra's
|
view (75 lines, 1 line of output) |
"""
interval.py
My submission for Programming Praxis's "Interval Arithmetic" exercise; see
http://programmingpraxis.com/2010/12/21/interval-arithmetic/
|
view (77 lines) |