Skip to content

Instantly share code, notes, and snippets.

View briantjacobs's full-sized avatar

Brian Jacobs briantjacobs

View GitHub Profile
@briantjacobs
briantjacobs / config.yml
Created November 24, 2015 19:43
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
#! /bin/bash
# Convert Landsat 8 GeoTIFF images into RGB pan-sharpened JPEGs.
#
# Requirements:
# * gdal http://www.mapbox.com/tilemill/docs/guides/gdal/
# * convert (image-magick)
#
# Reference info:
# http://www.mapbox.com/blog/putting-landsat-8-bands-to-work/
@briantjacobs
briantjacobs / hi8-anim-howto.md
Created January 29, 2016 14:25 — forked from celoyd/hi8-anim-howto.md
A way to make Himawari-8 animations

Himawari-8 animation tutorial

Here’s how to make animations like this one. It requires intermediate Unix command-line knowledge, to install some tools and to debug if they don’t work. You’ll need these utilities:

  • curl (or you can translate to wget)
  • convert and montage, part of ImageMagick
  • ffmpeg, plus whatever codecs
  • parallel, for iteration that’s nicer than shell for loops or xargs
  • run everything in zsh for leading 0s in numerical ranges to work
@briantjacobs
briantjacobs / gist:8c831d15acb3aa42da29f03c5f6153e4
Created August 5, 2017 23:12 — forked from jarek-foksa/gist:2648095
SVGElement.prototype.innerHTML shim
// Important: You must serve your pages as XHTML for this shim to work,
// otherwise namespaced attributes and elements will get messed up.
Object.defineProperty(SVGElement.prototype, 'innerHTML', {
get: function() {
var $child, $node, $temp, _i, _len, _ref;
$temp = document.createElement('div');
$node = this.cloneNode(true);
_ref = $node.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
$child = _ref[_i];
@briantjacobs
briantjacobs / gist:07595a625c9abb4832a0
Created November 18, 2015 21:50 — forked from sh0rtwave/gist:29773181164ef748cc64
EPIC Daily 'Blue Marble' API for epic.gsfc.nasa.gov
# EPIC Daily “Blue Marble” API
The API URL is: http://epic.gsfc.nasa.gov/api/images.php
This gets you a list of the latest day’s images & metadata.
OR
http://epic.gsfc.nasa.gov/api/images.php?date=YYYY-M-D&w=X&e=Y
#!/usr/bin/env node
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
@briantjacobs
briantjacobs / example.js
Created December 3, 2015 20:30 — forked from millermedeiros/example.js
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@briantjacobs
briantjacobs / xyz_vs_tms.md
Created November 24, 2015 22:41 — forked from tmcw/xyz_vs_tms.md
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@briantjacobs
briantjacobs / Run in LOCAL terminal...
Created October 5, 2015 01:49 — forked from jswartwood/Run in LOCAL terminal...
Automatic Git deploys on Dreamhost
# Replace any brackets with real values
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal
ssh [user]@[host]
cd ~
mkdir [mydomain_com].git
cd [mydomain_com].git
git init --bare
vi hooks/post-receive
# Enter the code from the "post-receive" file (in this gist); save + quit
@briantjacobs
briantjacobs / .htaccess
Created October 4, 2015 17:52 — forked from mytharcher/.htaccess
Used for automated deploy web site code from Bitbucket to Dreamhost test site via git POST hook.
# This config is used for Dreamhost which HTTP basic authoriztion is forbidden.
# The PHP Server variable 'PHP_AUTH_USER' & 'PHP_AUTH_PW' could be implement by
# this config via a CGI environment variable.
# From [HTTP Authentication on PHP as CGI (like Dreamhost)](http://planetozh.com/blog/2009/04/http-authentication-on-php-as-cgi-like-dreamhost/)
RewriteEngine on
RewriteRule ^git-hook.*\.php - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]