Skip to content

Instantly share code, notes, and snippets.

@gabrieldance
gabrieldance / keybase.md
Created Jan 10, 2019
keybase public gist
View keybase.md

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:

View chroma_test.js
this.breakScale=chroma.scale([lowColor,'#ff0b3a'])
.domain([1, 114, 258, 481, 2105])
.correctLightness(true)
View 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 Aug 29, 2015
cut out states from country shapefile
View cut_out_states.rb
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
View l8_pansharp.sh
# 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.
View 20120808_noaa_us_cities.csv
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
View 2012_natural_earth_populated_places.csv
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
View 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 Oct 31, 2013
bash script to encode two-pass WEBM video.
View ffmpeg to webm
#!/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
View gia-button.css
/* 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;