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
*.db | |
*.xy | |
*.png | |
*.pyc | |
*.pyo |
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 | |
"""Solution for project euler problem #12. | |
Based on: | |
http://stackoverflow.com/questions/571488/project-euler-12-in-python/571526#571526 | |
""" | |
def ndiv(n, prime_factors): | |
"""Return number of divisors of `n`. |
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
*.py[co] | |
*.egg-info/ | |
/MANIFEST | |
/build/ | |
/dist/ |
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
"""Measure relative performance of answers to [1]. | |
[1] http://stackoverflow.com/questions/1456617 | |
""" | |
import linecache | |
import random | |
from timeit import default_timer | |
WORDS_FILENAME = "/etc/dictionaries-common/words" |
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 | |
"""$ python autocmd.py /exam/ple .txt,.html /pri/vate some_script.pl | |
Answer for http://stackoverflow.com/questions/1533923/monitor-folder-for-new-files-using-unix-ksh-shell-script-or-perl-script-and-trigg | |
Adopted from autocompile.py [1] example. | |
[1] http://git.dbzteam.org/pyinotify/tree/examples/autocompile.py | |
Advantages: |
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 | |
"""Measure performance for 3 cases: | |
1. dict has key at the start of list | |
2. dict has key at the end of list | |
3. dict has no key in a list | |
See http://stackoverflow.com/questions/1737778/dict-has-key-from-list | |
""" | |
from functools import wraps |
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 python2 | |
"""Generate performance graphs. See | |
http://stackoverflow.com/questions/464960/code-golf-combining-multiple-sorted-lists-into-a-single-sorted-list#464967 | |
""" | |
from __future__ import with_statement | |
from optparse import OptionParser, make_option | |
import collections | |
import copy | |
import glob |
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
*.py[co] | |
/cachegrind.out.profilestats | |
/profilestats.prof |
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
boost-python/bin/ | |
*.py[co] | |
*.so | |
*.o | |
/xorcy.c |
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 | |
"""Find height, width of the largest rectangle containing all 0's in the matrix. | |
The algorithm for `max_size()` is suggested by @j_random_hacker [1]. | |
The algorithm for `max_rectangle_size()` is from [2]. | |
The Python implementation [3] is dual licensed under CC BY-SA 3.0 | |
and ISC license. | |
[1]: http://stackoverflow.com/questions/2478447/find-largest-rectangle-containing-only-zeros-in-an-nn-binary-matrix#comment5169734_4671342 |
OlderNewer