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
| """ | |
| Search and replace recursive | |
| Usage: | |
| ~$ python replace.py [rootdir] [searched_text] [replace_text] | |
| """ | |
| import os | |
| import sys | |
| if len(sys.argv) <= 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
| find . -not -path '.git' -iname '*.py' -type f -exec sed -i 's/ *$//' '{}' ';' |
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
| from lxml import etree | |
| from StringIO import StringIO | |
| import urllib2 | |
| url = "http://www.ivao.aero/atcss/list.asp" | |
| data = urllib2.urlopen(url).read() | |
| parser = etree.HTMLParser() | |
| tree = etree.parse(StringIO(data), parser) |
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
| from lxml import etree | |
| from StringIO import StringIO | |
| import urllib2 | |
| url = "http://www.ivao.aero/flightss/list.asp" | |
| data = urllib2.urlopen(url).read() | |
| parser = etree.HTMLParser() | |
| tree = etree.parse(StringIO(data), parser) |
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
| <?php | |
| /** | |
| * Proxy Dispatcher using php call_user_func_array (http://us2.php.net/manual/en/function.call-user-func-array.php) | |
| * */ | |
| class Foo { | |
| function bar1($arg, $arg2, $arg3, $arg4) { | |
| return "arg: $arg, arg2: $arg2, arg3: $arg3, arg4: $arg4\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
| from django.views.generic import TemplateView | |
| class MyView(TemplateView): | |
| url = "myurl/view1" | |
| template_name = "index/template.html" | |
| def get(self, *args, **kwargs): | |
| context = {} |
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
| virtualenv env | |
| source env/bin/activate | |
| pip install django==1.4.10 #Replace this for the django version you want | |
| pip install django-shopify | |
| start_shopify_app testing |
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
| from fabric.api import run, env | |
| def staging(): | |
| env.hosts = ['root@crawley-cloud.com'] | |
| def prod(): | |
| env.hosts = ['root@crawley-cloud.com'] |
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
| import os | |
| # By default assume it's local environment | |
| env = os.environ.get("ENV", "LOCAL") | |
| # PROD/DEV/LOCAL are values the environment variable ENV can have. | |
| # Example for production server: ~$ export ENV=PROD | |
| settings_files = { | |
| "PROD": "production_settings", | |
| "DEV": "development_settings", |
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
| import sys | |
| sys.path.append('../api2/include') | |
| from helpers.database import DataBase | |
| from config import config | |
| class WarehousesFinder(object): | |
| def __init__(self): |
OlderNewer