Skip to content

Instantly share code, notes, and snippets.

View blech's full-sized avatar

Paul Mison blech

View GitHub Profile
anonymous
anonymous / overpass.geojson
Created February 3, 2014 22:17
data exported by overpass turbo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# https://www.mapbox.com/blog/processing-landsat-8/
task :landsat_2014 => :environment do
dirs = Dir["#{Rails.root.to_s}/db/initial/raster/*"].reject {|q| q =~ /tar\.gz/ }
dirs.each do |dir|
scene_id = dir.split("/")[-1]
[4,3,2].each do |band|
`gdalwarp -t_srs EPSG:3857 #{dir}/#{scene_id}_B#{band}.TIF #{dir}/#{scene_id}_B#{band}-projected.tif`
end
`convert -combine #{dir}/#{scene_id}_B{4,3,2}-projected.tif #{dir}/#{scene_id}_RGB-projected.tif && \
convert -channel B -gamma 0.925 -channel R -gamma 1.03 -channel RGB -sigmoidal-contrast 50x16% #{dir}/#{scene_id}_RGB-projected.tif #{dir}/#{scene_id}_RGB-projected-corrected.tif && \
import cgi
from google.appengine.ext import blobstore
from django.contrib import admin
from django import forms
from .models import FileDownload
class DLAdminForm(forms.ModelForm):
@blech
blech / README.md
Last active September 24, 2015 10:38
iTunes defaults

These four defaults settings will disable Ping, hide the dropdown, restore the old arrows, and invert them such that clicking them will navigate the libary, not the Store. Boiled down from http://gidden.net/tom/2010/09/25/removing-ping

defaults write com.apple.iTunes disablePingSidebar 1
defaults write com.apple.iTunes hide-ping-dropdown 1
defaults write com.apple.iTunes show-store-link-arrows 1

defaults write com.apple.iTunes invertStoreLinks 1

@chanian
chanian / imax.sh
Created June 16, 2011 18:52
Was that movie originally filmed in IMAX? Or am I paying extra for good marketing...
#!/bin/sh
#
# usage: ./imax.sh "tron 2"
#
# Note, this doesn't always work as it is clearly scrapping imdb.
# comment below for any suggested changes!
#
echo "Was it filmed in IMAX?"
q=`echo $1 | sed -e s/\ /\+/g`
@mattbornski
mattbornski / timezone.md
Created March 29, 2012 22:36
Determine timezone from lat/long

Goal: To take this: https://graph.facebook.com/105464892820215 And derive this: America/Los Angeles From which we can then derive UTC-0800 or UTC-0700, as appropriate under the daylight madness scheme in effect on the date of interest.

It seems oddly hard to figure out what timezone a given point in space is located in. Looking around, there are only a few APIs which provide this information (http://www.earthtools.org/webservices.htm#timezone and http://www.worldweatheronline.com/time-zone-api.aspx), and only a few datasets which seem to contain it; most of them are in serious GIS formats, and expect you to query them in some manual fashion using a proprietary GIS tool.

I'm not really interested in that; I want a piece of code I can just ask "what timezone is this in" and get an answer, without installing some huge piece of software I don't have a license to or worrying about rate limits from somebody's API. So I'm going to take a shapefile I found here (http://efele.net/maps/tz/world/) and see if we can

@billierinaldi
billierinaldi / energy.json
Created September 25, 2012 02:11
Overlapping Sankey links
{"nodes":[
{"name":"Agricultural 'waste'"},
{"name":"Bio-conversion"},
{"name":"Liquid"},
{"name":"Losses"},
{"name":"Solid"},
{"name":"Gas"},
{"name":"Biofuel imports"},
{"name":"Biomass imports"},
{"name":"Coal imports"},
@andrewxhill
andrewxhill / index.html
Last active December 10, 2015 15:38
Simple CartoDB + D3 earthquake example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Easy earthquakes</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v2/cartodb.js"></script>
<style type="text/css">
body{
@migurski
migurski / Grid.min.js
Created February 9, 2013 02:38
I Miss GetLatLon.com
var require=function(b,j){var d=require.resolve(b,j||"/"),e=require.modules[d];if(!e)throw Error("Failed to resolve module "+b+", tried "+d);return(d=require.cache[d])?d.exports:e()};require.paths=[];require.modules={};require.cache={};require.extensions=[".js",".coffee",".json"];require._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0};
require.resolve=function(){return function(b,j){function d(a){a=g.normalize(a);if(require.modules[a])return a;for(var c=0;c<require.extensions.length;c++){var b=require.extensions[c];if(require.modules[a+b])return a+b}}function e(a){a=a.replace(/\/+$/,"");var c=g.normalize(a+"/package.json");if(require.modules[c]){var c=require.modules[c](),b=c.browserify;if("object"===typeof b&&b.main){if(c=d(g.resolve(a,b.main)))return c}else if("string"===typeof b){if(c=d(g.resolve(a,b)))return c}else if(c.main&&
(c=d(g.resolve(a,c.main))))return c}return d(a+"/index")}j||(j="/");if(require._core[b])return b;var g=require.modules.path(),c=(j=g.resolve("/",j))||"/";if(b.match(/^(?:\.\.?\/|\/)
@migurski
migurski / README.md
Last active December 14, 2015 18:38
GL-Solar, Rainbow Road edition