Skip to content

Instantly share code, notes, and snippets.

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

@jqtrde
jqtrde / gdal_hdf.md
Last active August 29, 2015 14:17 — forked from drewbo/gdal_hdf.md

MODIS downloads are stored as .hdf files which makes them non-trivial to interact with.

I've previously mentioned using HEG but for a more streamlined approach we're going to want to use gdal.

Compiling GDAL with HDF4 support can actually be done fairly easily using brew although information on this was a bear to find. Thanks to Wood Sun we can do this via three commands

brew tap homebrew/versions
brew install hdf4
brew install https://raw.githubusercontent.com/geoalchimista/homebrew/master/formulae/gdal.rb --with-hdf4
@jqtrde
jqtrde / index.html
Last active August 29, 2015 14:17 — forked from wboykinm/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.js'></script>
<script src='tx.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.css' rel='stylesheet' />
<style>

Storytelling from Space: Tools/Resources

This list of resources is all about acquring and processing aerial imagery. It's generally broken up in three ways: how to go about this in Photoshop/GIMP, using command-line tools, or in GIS software, depending what's most comfortable to you. Often these tools can be used in conjunction with each other.

Acquiring Landsat & MODIS

Web Interface

  • Landsat archive
psql DBNAME -c "\\copy (SELECT ST_AsGeoJson(ST_Union(the_geom)) FROM TABLENAME) to '/PATH/TO/YOUR/DESIRED/FILE.geojson'"
# 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 && \
```
SELECT *
FROM (SELECT the_geom FROM incidents WHERE incidents.major_category = 'Fire') as f, (SELECT geom FROM neighborhoods_wa WHERE neighborhoods_wa.name = 'Broadmoor') as n
WHERE ST_Within(f.the_geom, n.geom);
```
@jqtrde
jqtrde / load_shp_to_AWS
Last active August 29, 2015 14:16 — forked from glw/load_shp_to_AWS
shp2pgsql -s 4326 -d -g the_geom shapefilename.shp shapefilename |psql -U username --password -p 5432 -h reallylonghostnametoamazonaws.com dbname
@jqtrde
jqtrde / vim-for-python.md
Created February 18, 2015 05:34
Vim as a Python IDE

Vim as a Python IDE

  • Why?
    • Pre-installed everywhere
    • Use directly in terminal
    • Modal commands
    • Fast
    • Community, and all that comes with that.
  • Basics
@jqtrde
jqtrde / index.html
Last active August 29, 2015 14:15 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<style type='text/css'>
div {
cursor:pointer;
cursor:hand;