Skip to content

Instantly share code, notes, and snippets.

View brunosan's full-sized avatar

Bruno Sánchez-Andrade Nuño brunosan

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bryanluman
bryanluman / float2int.py
Last active December 2, 2020 03:57
Converting a large DEM with rasterio
import numpy as np
import rasterio
"""
2014-02-13
Bryan Luman
Use it however you like at your own risk
Problem:
I have a huge DEM converted from LiDAR LAS points. I'd like to make it slightly
@welch
welch / installing-opencv-2.4.5-macosx-10.8.4-anaconda-1.6.0
Created September 6, 2013 19:17
How to to build OpenCV 2.4.5 from the distribution tarball using cmake, on Mac OSX 10.8.4, linked to an anaconda installation.
It is a rite of passage to post one's successful build instructions for OpenCV on a Mac
after you've tried all the other conflicting instructions out there and still failed.
brew failed for me (was this because I could never get a happy brew doctor situation?
I'll never know). macports? nope. build-from-source recipes? I didn't find one that
worked for me.
Here's what did work to build OpenCV 2.4.5 from the distribution tarball using cmake,
on Mac OSX 10.8.4, linked to an anaconda installation rather than the system python.
It is a mashup of various bits of advice out there. If you're already comfortable with
build/install from source, all you need to read is the cmake invocation in step 3 and
@cobyism
cobyism / gh-pages-deploy.md
Last active May 7, 2024 18:46
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

brew install fltk
sudo pip install mercurial
hg clone http://hg.orfeo-toolbox.org/OTB
cd OTB
mkdir build
cmake \
-DBUILD_APPLICATIONS:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_C_FLAGS:STRING=-Wall -Wno-uninitialized -Wno-unused-variable -fPIC \
@tmcw
tmcw / togeo.py
Created August 11, 2012 18:53
geo-assign any arbitrary image to a geotiff usable in tilemill
import subprocess
import sys, re
MERC = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
infile = sys.argv[1]
info_output = subprocess.Popen(['gdalinfo', infile], stdout=subprocess.PIPE).communicate()[0]
size_is_re = re.compile('Size is (?P<width>\d+), (?P<height>\d+)')
size_is = filter(lambda x: x, map(lambda x: size_is_re.match(x), info_output.split('\n')))
@lxbarth
lxbarth / tilemillchoropleth.md
Created November 16, 2011 16:03
Creating a choropleth map with TileMill, QGIS and SQLite