Skip to content

Instantly share code, notes, and snippets.

@giserh
giserh / geo_interface.rst
Created October 21, 2018 20:05 — forked from sgillies/geo_interface.rst
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@giserh
giserh / Diagram1.dia
Created July 9, 2017 10:58 — forked from amueller/Diagram1.dia
Machine learning cheat sheet diagram svg and dia file
@giserh
giserh / install_postgresql9.4_postgis2.1_ubuntu.md
Created November 23, 2016 13:56 — forked from ansell/install_postgresql9.4_postgis2.1_ubuntu.md
Installing PostgreSQL 9.4 and PostGIS on Ubuntu 14.04

Remove old PostGIS Installation

The first step is to remove older version of PostGIS if any.

sudo apt-get purge postgis

Setup repository

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
@giserh
giserh / gist:8c26be07f361f2342140658153738bc3
Created April 14, 2016 09:06 — forked from velvia/gist:69ca1ab5e758d3b0ab13
JTS custom CoordinateSequence example
import com.vividsolutions.jts.geom._
import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence
import com.vividsolutions.jts.geom.util.GeometryTransformer
/**
* A custom CoordSequence based on byte arrays for compactness and speed
* Just 2 dimensions for now.
*
* It's an example of creating a custom CoordinateSequence.
* NOTE: This is much more memory efficient, but slower because of deserialization cost.

First, install VirtualBox. Then:

brew update
brew upgrade
brew install docker boot2docker

mkdir ~/.boot2docker
curl http://static.dockerfiles.io/boot2docker-v1.1.2-virtualbox-guest-additions-v4.3.12.iso \
> ~/.boot2docker/boot2docker.iso
@giserh
giserh / tree.md
Last active August 29, 2015 14:08 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@giserh
giserh / xx.py
Last active August 29, 2015 14:08 — forked from anonymous/xx.py
import requests
import lxml.html
page = requests.get('http://tieba.baidu.com/p/2166231880').text
doc = lxml.html.document_fromstring(page)
for idx, el in enumerate(doc.cssselect('img.BDE_Image')):
with open('%03d.jpg' % idx, 'wb') as f:
f.write(requests.get(el.attrib['src']).content)
@giserh
giserh / minmaxheap.py
Last active August 29, 2015 14:07 — forked from gnarmis/minmaxheap.py
from math import log, floor, pow
class MinMaxHeap(object):
"""an implementation of min-max heap using an array,
which starts at 1 (ignores 0th element)
"""
def __init__(self, array=[]):
super(MinMaxHeap, self).__init__()
@giserh
giserh / minmaxheap.py
Last active August 29, 2015 14:07 — forked from gnarmis/minmaxheap.py
from math import log, floor, pow
class MinMaxHeap(object):
"""an implementation of min-max heap using an array,
which starts at 1 (ignores 0th element)
"""
def __init__(self, array=[]):
super(MinMaxHeap, self).__init__()