Skip to content

Instantly share code, notes, and snippets.

View scarnecchia's full-sized avatar

D. Scarnecchia scarnecchia

View GitHub Profile
@scarnecchia
scarnecchia / README.md
Last active January 14, 2016 19:21
Getting swipe between layers working with layergroups

Mapbox's demo of swiping between layers has no example of how to implement the effect with L.LayerGroup. [layerGroup].eachLayer() would be the obvious call, but I couldn't get it to work. Fortunately, it was a simple matter of determining the length of the layer group, and iterating through.

var droneArray = droneLayers.getLayers();

function clip() {
  var nw = map.containerPointToLayerPoint([0, 0]),
      se = map.containerPointToLayerPoint(map.getSize()),
      clipX = nw.x + (se.x - nw.x) * range.value;
@scarnecchia
scarnecchia / GDAL_Commands.txt
Created October 9, 2015 20:32
Doesn't do anything as a script, but I don't want to lose these commands
#!/bin/bash
#GDAL
gdal_translate -strict -of GTiff -co TILED=YES -co COMPRESS=LZW in.tif out.tif
gdalwarp -overwrite -cutline ../clippingShapes/enroute/ENR_L33.shp -crop_to_cutline -r lanczos -dstalpha -co ALPHA=YES -co TILED=YES -multi -wo NUM_THREADS=ALL_CPUS -wm 512 --config GDAL_CACHEMAX 512 "ENR_L33-2.tif" "ENR_L33-3UN.tif"
rm -r ENR_L33-2.tif
echo "*** Compress --- gdal_translate"
@scarnecchia
scarnecchia / copy_30.sh
Created September 23, 2015 20:43
Get every 30th file from a directory. Useful for culling video stills down to one per second.
#!/bin/bash
cp $(ls | awk '{nr++; if (nr % 30 == 0) print $0}') input/ output/
#!/bin/sh
#call with sudo ./ec2_deploy.sh
apt-get update -y
apt-get upgrade -y
apt-get install -y xfce4 xrdp chromium-browser xfce-terminal git
service xrdp start
passwd ubuntu