Skip to content

Instantly share code, notes, and snippets.

@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
@rolo
rolo / html_compile.py
Created August 1, 2012 16:37
Python script to compile .shtml files with server side includes down to flat HTML suitable for hosting on S3 or where SSIs aren't supported.
#! /usr/bin/env python
import os
import re
import shutil
from os.path import splitext
SOURCE = os.getcwd() + "/www/"
TARGET = os.getcwd() + "/compiled/"
if not os.path.exists(TARGET):
@rolo
rolo / republish_all_pages
Created August 8, 2013 14:08
Automatically republish all Django CMS 2.4.2 pages which are already published. For when all pages needed republishing after an upgrade from 2.3.x.
from cms.models.pagemodel import Page
pages = Page.objects.filter(published=True, publisher_is_draft=True)
for page in pages:
print '%s (%d)' % (page, page.id)
page.publish()
@rolo
rolo / factories.py
Created December 7, 2012 16:47 — forked from mbrochh/factories.py
Django UserFactory with factory_boy - using random instead of clock to avoid username clashes
import random
from django.contrib.auth.models import User
from factory import Factory, LazyAttribute, Sequence
class UserFactory(Factory):
"""
Creates a new ``User`` object.
Username will be a random 30 character md5 value.

Keybase proof

I hereby claim:

  • I am rolo on github.
  • I am rolo (https://keybase.io/rolo) on keybase.
  • I have a public key whose fingerprint is 816E E5E2 8715 EF59 72F6 3B88 5579 CCA6 B686 4958

To claim this, I am signing this object: