Skip to content

Instantly share code, notes, and snippets.

import os, sys
import site
# put virtualenv on pythonpath
site.addsitedir('/path/to/project/ve/lib/python2.5/site-packages')
# redirect prints to apache log
sys.stdout = sys.stderr
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
# -*- coding: utf-8 -*-
"""
Example Usage
=============
>>> import datetime
>>> start = datetime.date(2009, 6, 21)
>>> g1 = daterange(start)
=============================================================
Installing Multicore Solr 1.3.0 / Tomcat 6.0.X on Ubuntu 8.10
=============================================================
Install OpenJDK (comes from universe)::
aptitude install openjdk-6-jre
Download Tomcat 6.X and move it in place::
=============================================================
Installing Multicore Solr 1.3.0 / Tomcat 6.0.X on Ubuntu 8.10
=============================================================
Install OpenJDK (comes from universe)::
aptitude install openjdk-6-jre
Download Tomcat 6.X and move it in place::
"""
The HOSTMAP variable is a dictionary of lists. The keys represent
roles of a server, the values represent the hostnames of machines that
fill those roles. If you are reading this, you likely know what you're
doing. If you don't know what you're doing, you probably want to put
your hostname into local_dev. Ensure it has a comma at the end, and
the hostname is a string.
You can get your hostname by typing `hostname` into a terminal.
"""
brew install readline
brew link readline
brew install python
brew install postgres
brew install postgis
brew install gdal
brew install geos
brew install git
brew install tmux
brew install pip
from django.http import HttpRequest
class PickleableHttpRequest(HttpRequest):
def __init__(self, request=None, attributes=None):
super(PickleableHttpRequest, self).__init__()
if request:
if not isinstance(request, HttpRequest):
raise Exception('Request supplied is not a valid HTTP request object.')
@nowells
nowells / git-merge-master-everywhere.rb
Created November 18, 2011 01:02
git merge master to all branches
#!/usr/bin/env ruby
require 'net/smtp'
def run(command)
output = `#{command} 2>&1`
if not $?.success?
raise Exception, "Command Failed '#{command}': #{output}"
end
output
@nowells
nowells / git-dependancies.rb
Created December 1, 2011 18:51
A tool to display all branches that have dependancies in your repository and list out what branches have been merged and are therefore dependancies.
#!/usr/bin/env ruby
begin
require 'rainbow'
rescue LoadError
module Rainbow
def color(color)
self
end
def background(color)