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 | |
| # vim: noet | |
| def keyword(regex): | |
| def decorator(meth): | |
| def wrapper(*args, **kwargs): | |
| print "in wrapper func" | |
| meth(*args, **kwargs) | |
| return wrapper |
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
| def querydict_to_dict(qd): | |
| return dict((str(k), v) for k, v in qd.iteritems()) |
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
| [rubygsm]$ ./gsm-band usa | |
| Found modem on port: | |
| /dev/ttyUSB0 | |
| GSM bands supported: | |
| 850, 900, 1800, 1900, 850/1900, 900E/1800, 900E/1900 | |
| Currently selected: | |
| 900E/1800 | |
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 BaseHTTPServer import HTTPServer | |
| from SimpleHTTPServer import SimpleHTTPRequestHandler | |
| HTTPServer(('', 8000), SimpleHTTPRequestHandler).serve_forever() |
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 ruby | |
| # vim: noet | |
| capitals = { | |
| "England" => "london", | |
| "France" => "paris", | |
| "Germany" => "berlin", | |
| "Spain" => "madrid", | |
| "Italy" => "rome", |
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
| # in sites-available/example.com | |
| <VirtualHost *:80> | |
| ServerName example.com | |
| ProxyPass /path http://localhost:4000/ | |
| ProxyPassReverse /path http://localhost:4000/ | |
| ProxyPreserveHost on | |
| ProxyRequests on | |
| </VirtualHost> | |
| # in mods-available/ports.conf |
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 | |
| # vim: ai ts=4 sts=4 et sw=4 | |
| import os, sys | |
| from django.conf.urls.defaults import * | |
| # this list will be populated with the | |
| # urls from the urls.urlpatterns of each | |
| # running rapidsms app, then imported by | |
| # django as if we'd declared them all here |
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
| /* | |
| * run this in firebug to extract a list of the | |
| * album/artist/track names from any browse page | |
| * at lala.com, then acquire them from a less | |
| * obnoxious source. outputs csv. | |
| */ | |
| (function() { | |
| var extract = function() { |
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
| # Contributor: Adam Mckaig <[email protected]> | |
| # vim: et ts=4 sw=4 | |
| pkgname=python-mox | |
| pkgver=0.5.3 | |
| pkgrel=1 | |
| pkgdesc="Object-mocking framework for Python." | |
| arch=("any") | |
| url="http://code.google.com/p/pymox/" | |
| license=("APACHE") |
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
| def call_with_dwim_args(callable_, args): | |
| """ | |
| Call and return ``callable_`` with *do-what-I-mean* ``args``. More | |
| precisely: | |
| | if ``args`` is a dict, call ``callable_(**args)`` | |
| | if ``args`` is a list, call ``callable_(*args)`` | |
| | otherwise, call ``callable_(args)`` | |
| The usual Pythonic solution of testing ``iter(args)`` and catching |
OlderNewer