Skip to content

Instantly share code, notes, and snippets.

@gabrieldance
gabrieldance / keybase.md
Created January 10, 2019 22:40
keybase public gist

Keybase proof

I hereby claim:

  • I am gabrieldance on github.
  • I am gabrieldance (https://keybase.io/gabrieldance) on keybase.
  • I have a public key ASAg765fFB_Kj4Nj7jgbj_u--eMizlIftSw3ckrT64kk4Ao

To claim this, I am signing this object:

this.breakScale=chroma.scale([lowColor,'#ff0b3a'])
.domain([1, 114, 258, 481, 2105])
.correctLightness(true)
@gabrieldance
gabrieldance / l8get
Last active August 29, 2015 14:12 — forked from briantjacobs/l8get
# This is a shell function to quickly grab the data for a given Landsat 8 tile ID from Google's servers
# For example:
# l8get LC81690352014169LGN00
# The echo at the end is to remind myself of the syntax for extracting bands 8, 4, 3, and 2. (Pansharp, Red, Green, Blue)
# On OSX this would go into your ~/.bash_profile file.
# Requires gsutil from https://developers.google.com/storage/docs/gsutil_install
# Most useful in conjunction with USGS' Earth Explorer: http://earthexplorer.usgs.gov/
@gabrieldance
gabrieldance / cut_out_states.rb
Last active August 29, 2015 14:07
cut out states from country shapefile
require 'csv'
states = CSV.read('states_w_regions.csv',headers:true)
states.each do |state|
puts(state["id"], state["abbreviation"])
`ogr2ogr -f "ESRI Shapefile" -sql "select * from cb_2013_us_county_500k where cast(STATEFP as integer(2)) = #{state["fips_state"]}" cb_2013_#{state["abbreviation"]}_county_500k.shp ../cb_2013_us_county_500k.shp`
end
# These are shell functions to quickly create pansharpened RGB images ready for color correction
# from a set of raw Landsat 8 TIF files in a given directory.
# For example:
# l8_pansharp LC81690352014169LGN00
# Creates:
# LC81690352014169LGN00_rgb_pansharp.tif
# l8_rush_pansharp downloads a L8 tile from Google Storage (if they have it), extracts the relevant bands, then creates the pansharpened output.
We can't make this file beautiful and searchable because it's too large.
ST_FIPS,SFIPS,COUNTY_FIP,CFIPS,PL_FIPS,ID,NAME,ELEVATION,POP_1990,POPULATION,ST,STATE,WARNGENLEV,WARNGENTYP,WATCH_WARN,ZWATCH_WAR,PROG_DISC,ZPROG_DISC,COMBOFLAG,LAND_WATER,RECNUM,LON,LAT
50,50,023,023,NULL,1457265,East Calais,850,0.0,NULL,VT,VERMONT,3,NULL,3,0.0,50,50.0,0.0,NULL,0.0,-72.4303,44.3664
50,50,023,023,NULL,15000150000,Exit 9 I89,NULL,0.0,NULL,VT,VERMONT,3,NULL,3,0.0,125,125.0,0.0,NULL,0.0,-72.6851,44.2982
50,50,023,023,NULL,1919082,Exit 10 I89,459,0.0,NULL,VT,VERMONT,3,NULL,3,0.0,125,125.0,0.0,NULL,0.0,-72.7513,44.3427
50,50,023,023,NULL,1457229,Duxbury,420,0.0,NULL,VT,VERMONT,2,NULL,2,0.0,100,100.0,0.0,NULL,0.0,-72.7531,44.3269
50,50,023,023,NULL,1460076,Waterbury Center,725,0.0,NULL,VT,VERMONT,2,NULL,2,0.0,125,125.0,0.0,NULL,0.0,-72.7164,44.3781
50,50,023,023,NULL,1460309,Woodbury,1197,0.0,NULL,VT,VERMONT,3,NULL,3,0.0,100,100.0,0.0,NULL,0.0,-72.42,44.43
50,50,023,023,NULL,1461796,Exit 8 I89,550,0.0,NULL,VT,VERMONT,3,NULL,3,0.0,125,125.0,0.0,NULL,0.0,-72.5963,44.2507
50,50,023,023,NULL,1457248,Ea
We can't make this file beautiful and searchable because it's too large.
NAME,NAMEASCII,SOV0NAME,SOV_A3,ADM0NAME,ADM0_A3,ADM1NAME,ISO_A2,LATITUDE,LONGITUDE,POP_MAX,POP_MIN,POP_OTHER,LS_NAME
Colonia del Sacramento,Colonia del Sacramento,Uruguay,URY,Uruguay,URY,Colonia,UY,-34.4799990054,-57.8400024734,21714,21714,0,NULL
Trinidad,Trinidad,Uruguay,URY,Uruguay,URY,Flores,UY,-33.5439989374,-56.9009965602,21093,21093,0,NULL
Fray Bentos,Fray Bentos,Uruguay,URY,Uruguay,URY,Ro Negro,UY,-33.1389990288,-58.3039974719,23279,23279,0,NULL
Canelones,Canelones,Uruguay,URY,Uruguay,URY,Canelones,UY,-34.5380040067,-56.2840014932,19698,19698,0,NULL
Florida,Florida,Uruguay,URY,Uruguay,URY,Florida,UY,-34.0990020052,-56.214998448,32234,32234,0,NULL
Bassar,Bassar,Togo,TGO,Togo,TGO,Kara,TG,9.26100006832,0.78900357378,61845,61845,0,NULL
Sotouboua,Sotouboua,Togo,TGO,Togo,TGO,Centre,TG,8.55700213306,0.98499646233,21054,21054,0,NULL
Medenine,Medemine,Tunisia,TUN,Tunisia,TUN,Mdenine,TN,33.3999990025,10.4166995576,61705,61705,0,NULL
Kebili,Kebili,Tunisia,TUN,Tunisia,TUN,Kebili,TN,33.6899970349,8.9710025379,19875
@gabrieldance
gabrieldance / ffmpeg to OGV
Created October 31, 2013 19:42
ffmpeg to OGV
#!/bin/bash
for file in *.mov; do
ffmpeg2theora -v 9 -a 6 --max_size 640x360 -o ../640x360/${file}.ogv $file
done
@gabrieldance
gabrieldance / ffmpeg to webm
Created October 31, 2013 19:41
bash script to encode two-pass WEBM video.
#!/bin/bash
for file in *.mov; do
ffmpeg -i ${file} -pass 1 -video_size 640x360 -c:v libvpx -qmin 0 -qmax 50 -b:v .325M -f webm -y /dev/null
ffmpeg -i ${file} -pass 2 -video_size 640x360 -c:v libvpx -qmin 0 -qmax 50 -b:v .325M -c:a libvorbis -q:a 6 -y ../../640x360/FINAL_WEBM/${file%%mov}webm
done
/* all single-instance buttons get the .gia-button class */
.gia-button {
display: inline-block;
padding: 8px 22px;
color: #fff;
font-size: 14px;
font-family: Helvetica, Arial, sans-serif;
font-weight: 200;
line-height: 1em;