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
(function($){ | |
$.getDjangoJSON = function(url, data, success){ | |
return $.ajax({ | |
url: url, | |
dataType: "django-json", | |
data: data, | |
success: success | |
}); | |
}; |
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
Based of custom chainable querysets that others have posted + the usage of mixins like the ones found in Django's class based views | |
Example Queryset: | |
from django.db import models | |
class ExchangeQuerySet(models.query.QuerySet): | |
def my_test(self): | |
return self.filter() |
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
FILENAME="DATABASE.backup" && pg_dump -Fc -O -x -f "$FILENAME" DATABASE && s3cmd --acl-private put "$FILENAME" s3://S3_BUCKET && rm "$FILENAME" |
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
import argparse | |
import subprocess | |
import shlex | |
import datetime | |
import os | |
parser = argparse.ArgumentParser(description='pg_dump and upload to S3') | |
parser.add_argument('database', nargs=1) | |
parser.add_argument('-U', '--user') |
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 | |
import argparse | |
import simplejson as json | |
import urllib2, urllib | |
import httplib | |
import base64 | |
parser = argparse.ArgumentParser(description='Updates DNSimple with EC2\'s hostname') | |
parser.add_argument('cname', type=str, nargs=1, help='Name of the CNAME') | |
parser.add_argument('--domain', default='rhinoaccounting.com', help='Domain to update') |
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
@daily vacuumdb -U postgres --all --analyze -q | |
@monthly vacuumdb -U postgres --all --analyze --full -q |
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
DATABASE_URL=postgres://USERNAME:[email protected]/DATABASE | |
MEMCACHE_SERVERS=127.0.0.1:11211 | |
DJANGO_SETTINGS_MODULE=settings.development.local |
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 | |
''' | |
pip install fapws3 | |
python staticfile-server.py | |
''' | |
import fapws._evwsgi as evwsgi | |
from fapws import base | |
from fapws.contrib import views | |
from fapws.contrib import zip, log |
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
var findFilesWithExtension, | |
_this = this; | |
findFilesWithExtension = function(dir, extensions, callback) { | |
var directories, files; | |
files = []; | |
directories = [dir]; | |
return async.whilst(function() { | |
return directories.length > 0; | |
}, function(whilstCallback) { |
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
import multiprocessing | |
workers = multiprocessing.cpu_count() * 2 + 1 | |
worker_class = 'gevent' | |
loglevel = 'error' | |
secure_scheme_headers = { | |
'HTTP_X_FORWARDED_PROTO': 'https' | |
} |
OlderNewer