Skip to content

Instantly share code, notes, and snippets.

@mlavin
mlavin / keybase.md
Created September 26, 2014 00:56
Verify Keybase

Keybase proof

I hereby claim:

  • I am mlavin on github.
  • I am mlavin (https://keybase.io/mlavin) on keybase.
  • I have a public key whose fingerprint is 4215 FFB7 280C 8293 6C0B 9481 8F2A 2314 3123 FC13

To claim this, I am signing this object:

@mlavin
mlavin / NOTES.rst
Created September 23, 2013 14:17
Celery Late Ack Example

Running the Example

Start the worker:

celery -A tasks worker --loglevel=info -c 2 --pidfile=celery.pid

In another terminal send 6 tasks:

python script.py
@mlavin
mlavin / base.py
Created March 16, 2012 23:52
Unlogged Table Tests
from django.db.backends.postgresql_psycopg2.base import *
def change_to_unlogged(statement):
"""Replace CREATE TABLE statements to be UNLOGGED."""
return statement.replace('CREATE TABLE', 'CREATE UNLOGGED TABLE')
class DatabaseCreation(DatabaseCreation):
def create_test_db(self, verbosity, autoclobber):
@mlavin
mlavin / fabfile.py
Created January 11, 2012 16:44
Fabric Package Install
import ConfigParser
import os
from fabric.api import env, sudo
from fabric.contrib import files
SERVER_ROLES = ['dbmaster', 'app', 'lb', ]
env.roledefs = dict.fromkeys(SERVER_ROLES, [])
# Directory structure
@mlavin
mlavin / models.py
Created November 14, 2011 16:12
Install DB views
import os
import sys
from django.conf import settings
from django.db import connections, models, transaction, DEFAULT_DB_ALIAS
from django.db.models.signals import post_syncdb
from django.dispatch import receiver
from south.signals import post_migrate
@mlavin
mlavin / ppas.txt
Created October 28, 2011 13:40
Lucid PPAs
# Postgres 9.0 and 9.1 along with PostGIS
ppa:pitti/postgresql
ppa:ubuntugis/ppa
ppa:pi-deb/gis
# rsyslogd that does not suffer from Ubuntu bug #407862
ppa:evax/rsyslog
# Latest stable Nginx
ppa:nginx/stable
# Redis backport
ppa:rwky/redis
@mlavin
mlavin / Vagrantfile
Created October 6, 2011 17:34
Vagrant Setup
Vagrant::Config.run do |config|
config.vm.define :"dbmaster" do |config|
config.vm.box = "lucid32"
config.vm.network("33.33.33.10")
config.vm.customize do |vm|
vm.memory_size = 256
end
end
config.vm.define :"app1" do |config|
config.vm.box = "lucid32"
@mlavin
mlavin / jenkins.sh
Created September 3, 2011 16:45
Jenkins Build Script
#!/bin/bash -ex
export PIP_DOWNLOAD_CACHE=/tmp/.pip_download_cache
cd $WORKSPACE
virtualenv -q ve
source ./ve/bin/activate
pip install -E ./ve -r requirements/ci-apps.txt
cd $WORKSPACE/homebrew
ln -fs `pwd`/settings/ci.py `pwd`/settings/local.py
python manage.py jenkins