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
@brunosan
brunosan / install_postgis_osx.sh
Last active August 29, 2015 13:57 — forked from lucasallan/install_postgis_osx.sh
Install and run a postgis in mavericks
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@brunosan
brunosan / fix.sh
Created March 13, 2014 22:19
IF ntf driver breaks on GDAL
#Fix error Unable to load PROJ.4 library (libproj.so)
sudo ln -s /usr/lib/libproj.so.0 /usr/lib/libproj.so
import rasterio
import numpy as np
src = rasterio.open('/Users/sean/code/decloud/envs/1_16/output/0_q.tif')
# Fraction of elements with value > 100 at full resolution.
q = src.read_band(1)
ones = np.ones(q.shape)
print "Full, %d pixels" % (q.shape[0]*q.shape[1])
print sum(ones[q>100])/(q.shape[0]*q.shape[1])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brunosan
brunosan / tiles.json
Created March 27, 2014 21:55
Calculate the average number of tiles. Visible on http://nbviewer.ipython.org/gist/brunosan/9819908
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@brunosan
brunosan / index.html
Last active August 29, 2015 14:02 — forked from d3noob/index.html
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.draw Plugin</title>
<meta charset="utf-8" />
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
<link
@brunosan
brunosan / inddex.html
Created January 5, 2015 18:33
Flights 2014
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Arc.js</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@brunosan
brunosan / get_one_more.sh
Created April 11, 2015 17:29
This onelines resets the MAC address. Because sometimes you **really** need that extra few minutes on xfinity Wifi.
sudo ifconfig en0 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g;s/.$//'`
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.