Skip to content

Instantly share code, notes, and snippets.

View thanhleviet's full-sized avatar
🤗
Focusing

Thanh Lee thanhleviet

🤗
Focusing
View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fabfile for Django
------------------
see http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p/
modified for fabric 0.9/1.0 by Hraban (fiëé visuëlle)
several additions, corrections and customizations, too
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
[program:gunicorn]
command=/bin/gunicorn -w 4 myapp:app
environment=MY_ENV=/var/null
user=www-data
#!/bin/bash
### BEGIN INIT INFO
# Provides: Django EC2 server
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Django server management script
# Description: Django server management script
### END INIT INFO
#
# install Geoserver on Ubuntu Maverick 10.10
# note: Geoserver is proxied through apache so port 8080 is not used
#
# @spara 11/15/10
#
# setup sources
sudo sh -c "echo ' ' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb http://us.archive.ubuntu.com/ubuntu/ maverick multiverse' >> /etc/apt/sources.list"
@thanhleviet
thanhleviet / gist:4142680
Created November 25, 2012 06:52
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@thanhleviet
thanhleviet / supervisord.sh
Created October 30, 2012 01:44 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@thanhleviet
thanhleviet / PostGIS201.sh
Created July 11, 2012 04:53 — forked from Tab3r/PostGIS201.sh
PostGIS 2.0.1 in Ubuntu 12.04
sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 libxml2-dev proj libjson0-dev xsltproc docbook-xsl docbook-mathml gettext postgresql-contrib-9.1 pgadmin3
sudo apt-add-repository ppa:olivier-berten/geo
sudo apt-get update
sudo apt-get install libgdal-dev
# Its looks like:
# $ gdal-config --version
# 1.9.0
# $ geos-config --version
L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({
options: {
debug: false
},
tileSize: 256,
initialize: function (options) {
L.Util.setOptions(this, options);
@thanhleviet
thanhleviet / views.py
Created July 4, 2012 07:25 — forked from albertsun/views.py
geojson tiles views.py
from redistricting.apps.features.models import CensusBlock, CensusTract, CensusCounty, DataBlock
from redistricting.utils import gmerc
from django.http import HttpResponse, Http404, HttpResponseForbidden
from django.contrib.gis.geos import GEOSGeometry
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.template import RequestContext