Skip to content

Instantly share code, notes, and snippets.

View cecepm's full-sized avatar

Cecep Mahbub cecepm

  • Jakarta, Indonesia
View GitHub Profile
@cecepm
cecepm / argparse_sample1.py
Created January 2, 2014 10:20
argparse simple case, required input file, but optional output file
#!/usr/bin/env python
# encoding: utf-8
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('infile', type=argparse.FileType('r'), help='Input file in CSV format.')
parser.add_argument('-o', '--outfile', type=argparse.FileType('wb'), help='Output file in CSV format.')
args = parser.parse_args()
@cecepm
cecepm / create_template_postgis-debian.sh
Last active December 31, 2015 22:09
Create PostGIS Template in Ubuntu 12.04
#!/bin/bash
#
# Taken and modified from
# https://docs.djangoproject.com/en/dev/_downloads/create_template_postgis-debian.sh
GEOGRAPHY=0
POSTGIS_SQL=postgis.sql
# For Ubuntu 12.04 (with PostGIS 1.5)
if [ -d "/usr/share/postgresql/9.1/contrib/postgis-1.5" ]
@cecepm
cecepm / Anaconda.sublime-settings
Last active December 31, 2015 11:59
My SublimeText Settings
{
"anaconda_linting_behaviour": "save-only",
"pep8_ignore":
[
"E501",
"E501",
"E701",
"E126",
"E127",
"E128",
@cecepm
cecepm / gist:7801973
Last active December 30, 2015 08:19
Install Sentry on Ubuntu 12.04

Install Prerequisites

Build dependencies

sudo apt-get install build-essential python-dev python-pip

Database

sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1
@cecepm
cecepm / gist:7283918
Last active December 27, 2015 06:49
Update VirtualBox Guest Additions

Warning:

[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.

Guest Additions Version: 4.2.12

VirtualBox Version: 4.3

@cecepm
cecepm / gist:6668013
Last active December 23, 2015 17:19
Install Scientific iPython on Ubuntu 12.04

Install iPython Notebook

Install virtualenv and virtualenvwrapper

sudo apt-get install python-virtualenv virtualenvwrapper

Create virtual environment

mkvirtualenv ipy
@cecepm
cecepm / gist:6666459
Last active December 23, 2015 17:09
Install Scientific iPython on Mac OSX 10.8 (Mountain Lion)

iPython Notebook

Install iPython and prerequisites in virtualenv

mkvirtualenv ipy
pip install numpy
brew install gfortran
pip install scipy
brew install freetype

pip install matplotlib

@cecepm
cecepm / gist:6366520
Last active December 21, 2015 21:09
Install QGIS 1.8 on Mac OSX 10.8 (Mountain Lion)

Install QGIS 1.8 on Mac OSX 10.8 (Mountain Lion)

Download and install in this order

http://www.kyngchaos.com/files/software/frameworks/GDAL_Complete-1.9.dmg
http://www.kyngchaos.com/files/software/frameworks/GSL_Framework-1.16-1.dmg
http://www.kyngchaos.com/files/software/qgis/QGIS-1.8.0-2.dmg

GRASS Support

@cecepm
cecepm / postgis_administration.md
Last active March 28, 2016 15:40
PostgreSQL cheatsheet

PostGIS Administration

Create Database with Spatial Support (PostGIS v2.0)

Connect to your database, example using psql command line

\connect mydb

then install extensions

@cecepm
cecepm / gist:5683547
Last active December 17, 2015 22:39
Migrate PostGIS version 1.5 to version 2.0 using PostgresApp on Mac OSX

Migrate PostGIS version 1.5 to version 2.0 using PostgresApp on Mac OSX

Version

Source DB (data to be migrated)

OS Ubuntu 12.04 (on vagrant/virtualbox vm)
PostgreSQL 9.1
PostGIS 1.5.3