Skip to content

Instantly share code, notes, and snippets.

View alukach's full-sized avatar
🍊

Anthony Lukach alukach

🍊
View GitHub Profile
@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
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@zhm
zhm / gist:2005158
Last active February 28, 2022 17:11
Building GDAL 1.9 with ESRI FileGDB support on OS X Lion

Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion

  • Download the SDK from ESRI's website http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api
  • Extract the SDK, and put the contents of the directory in a known location, I used ~/local/filegdb. Here's an example path to one of the files: ~/local/filegdb/lib/libFileGDBAPI.dylib
  • I use ~/local/filegdb so it can stay isolated in it's own place. You can put it anywhere, but the next few steps might be different.
  • Go into the directory containing the FileGDB SDK, e.g. ~/local/filegdb
  • ESRI built these dylib's using @rpath's, so to avoid needing to mess with DYLD_LIBRARY_PATH, I updated the @rpath's using install_name_tool. There might be a more elegant way to handle this. If so, comments are welcome!
  • Here are the commands I used to patch the dylibs, this is not required if you want to use DYLD_LIBRARY_PATH yourself:
@kapouer
kapouer / app.js
Created June 19, 2012 22:11
express tilelive example
// Tile server using the node web framework Express (http://expressjs.com).
var app = require('express').createServer();
var tilelive = require('tilelive');
require('tilelive-mapnik').registerProtocols(tilelive);
var filename = __dirname + '/' + 'stylesheet.xml';
tilelive.load('mapnik://' + filename, function(err, source) {
if (err) throw err;
app.get('/:z/:x/:y.*', function(req, res) {
source.getTile(req.param('z'), req.param('x'), req.param('y'), function(err, tile, headers) {
// `err` is an error object when generation failed, otherwise null.
@alukach
alukach / mpo2gif.sh
Created July 11, 2012 07:09 — forked from fuba/mpo2gif
Convert a .mpo file to an animated gif
#!/bin/sh
# mpo2gif
# convert all .mpo files in a directory to a animation gif.
# Source: https://gist.github.com/878450
# this idea is from http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=16275
# this script requires exiftool and imagemagick.
for file in *.[Mm][Pp][Oo0]; do
@alukach
alukach / gist:3146699
Created July 19, 2012 20:45 — forked from rolo/gist:1481128
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
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@beala
beala / picking-colors.py
Created October 7, 2012 17:19
The companion code to my picking colors blog post.
import math
import random
def getSuccessors(color):
def perm(l, n, str_a, perm_a):
"""Generate every permutation of length `n`, selecting from the
possible values in `l`.
"""
if len(str_a) == n:
return (str_a,) + perm_a
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 5, 2023 21:58
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@EyePulp
EyePulp / gist:4962327
Last active December 13, 2015 19:28
django templated e-mail using markdown/html -- supports attaching files or streaming file attachments
from django.conf import settings
def email_template(
template_name = None,
template_context = None,
subject = '',
recipients = None,
sender = settings.DEFAULT_FROM_EMAIL,
fail_silently = False,
use_markdown = False,