This file contains hidden or 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
| (defcustom server-use-tcp nil | |
| "If non-nil, use TCP sockets instead of local sockets." | |
| :set #'(lambda (sym val) | |
| (unless (featurep 'make-network-process '(:family local)) | |
| (setq val t) | |
| (unless load-in-progress | |
| (message "Local sockets unsupported, using TCP sockets"))) | |
| (when val (random t)) | |
| (set-default sym val)) | |
| :group 'server |
This file contains hidden or 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 | |
| from profilestats import profile # $ pip install profilestats | |
| def join_join(a, b): | |
| return ','.join([a, b]) | |
| def join_plus(a, b): | |
| return a + ',' + b | |
| @profile |
This file contains hidden or 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 | |
| """Example on how how to override instance method in Python. | |
| See http://stackoverflow.com/q/4243586 | |
| """ | |
| import types | |
| from operator import methodcaller | |
| class Spam: |
This file contains hidden or 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 | |
| """Run all processes in parallel. | |
| Group output by process groups and order within groups | |
| """ | |
| import shlex | |
| import subprocess | |
| import sys | |
| import threading |
This file contains hidden or 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
| __pycache__/ | |
| *.pyc | |
| *.out |
This file contains hidden or 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
| [svn-remote "svn"] | |
| url = https://svn.example.com | |
| fetch = path/to/your_project/trunk:refs/remotes/trunk | |
| branches = path/to/your_project/branches/*:refs/remotes/* | |
| tags = path/to/your_project/tags/*:refs/remotes/tags/* |
This file contains hidden or 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
| # http://stackoverflow.com/questions/4305518/why-is-equivalent-python-code-so-much-slower/4381575#4381575 | |
| # iter_gcd -- Python 2.x version, with gcd function call | |
| # Python 3.x version uses range instead of xrange | |
| from sys import argv,stderr | |
| def gcd(m, n): | |
| if n > m: | |
| m, n = n, m | |
| while n != 0: | |
| rem = m % n |
This file contains hidden or 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
| Flat profile: | |
| Each sample counts as 0.01 seconds. | |
| % cumulative self self total | |
| time seconds seconds calls s/call s/call name | |
| 42.87 5.17 5.17 4201 0.00 0.00 PyEval_EvalFrameEx | |
| 18.74 7.43 2.26 82071657 0.00 0.00 long_divrem | |
| 5.72 8.12 0.69 111023712 0.00 0.00 PyObject_Malloc | |
| 5.22 8.75 0.63 82071657 0.00 0.00 l_divmod | |
| 4.56 9.30 0.55 94120476 0.00 0.00 binary_op1 |
This file contains hidden or 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
| $ python -V | |
| Python 2.6.6 | |
| $ pypy -V | |
| Python 2.5.2 (79529, Nov 25 2010, 23:04:06) | |
| [PyPy 1.4.0] | |
| $ jython -V | |
| Jython 2.5.1 |
This file contains hidden or 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 |