This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.
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
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get -y install linux-image-extra-$(uname -r) | |
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -" | |
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list" | |
sudo apt-get update | |
sudo apt-get -y install lxc-docker |
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
# Copyright 2012 Erlware, LLC. All Rights Reserved. | |
# | |
# This file is provided to you under the Apache License, | |
# Version 2.0 (the "License"); you may not use this file | |
# except in compliance with the License. You may obtain | |
# a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, |
I hereby claim:
- I am ferrouswheel on github.
- I am jpwp (https://keybase.io/jpwp) on keybase.
- I have a public key whose fingerprint is 1183 6DAE 39D0 C262 DC7A 905C F151 CC60 5B54 C9AF
To claim this, I am signing this object:
Why Should I Care (For Developers)
"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."
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 sys, os | |
local_path = lambda path: os.path.join(os.path.dirname(__file__), path) | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECTNAME.settings' | |
sys.path.append(local_path('..')) | |
... # Rest of conf.py goes here |
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
<!-- Assume spreadsheets is a django pagination object and pages is an iterable of page numbers to display --> | |
<!-- Note: this doesn't preserve GET parameters or hash fragments --> | |
<div class="pagination"> | |
<ul> | |
{% if spreadsheets.has_previous %} | |
<li><a href="?page={{ spreadsheets.previous_page_number }}">«</a></li> | |
{% else %} | |
<li class="disabled"><a href="?page={{ spreadsheets.previous_page_number }}">«</a></li> | |
{% endif %} |
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
""" | |
A script to run on a Windows 7 host after installing the Access redistributable: | |
http://www.microsoft.com/en-nz/download/details.aspx?id=13255 | |
Install Python 2.7, and then pyodbc from: | |
http://code.google.com/p/pyodbc/ | |
The script dumps all tables to a dictionary and pickles it. The dictionary has a key for each table name, each value is a dictionary that has the following keys. |
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
# Why would you do this? | |
# Well, perhaps you have a VPN to A, and A can access B but you can't access B directly. | |
# Assuming a and b are hosts in the domain example.com. Add the below to ~/.ssh/config on | |
# your local machine. | |
Host b.example.com | |
ProxyCommand ssh -q a.example.com nc -q0 b.example.com 22 | |
# If you have another host that only b can access, you can also chain through that! |
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
# assuming utc_datetime is the datetime to convert: | |
from django.utils import timezone | |
current_tz = timezone.get_current_timezone() | |
local_time = current_tz.normalize(utc_datetime).astimezone(current_tz) | |