Skip to content

Instantly share code, notes, and snippets.

Al Shaw ashaw

Block or report user

Report or block ashaw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am ashaw on github.
  • I am a_l (https://keybase.io/a_l) on keybase.
  • I have a public key ASCC07IPMNPo72sD5dLL3UtrWljymJDP6G2LapRIUeUfggo

To claim this, I am signing this object:

View jankycs.sh
jankycs() {
echo "select st_astext(st_transform(st_setsrid(st_point($2, $1), 4326), 3857));" | psql houston-rain -t | perl -pe 's/[^\d\.\- ]//g' | perl -pe 's/^ //g';
printf '\n'
}
View stateline-noraphael.js
(function() {
var MapCanvas = Landline.Stateline = function(container, locality, opts) {
this.paper = {};
this.events = {};
this.attrs = {};
this.lookup = {};
this.locality = locality;
this.container = $(container);
this.container.css("position", "relative");
View slides.js
var extend = function(obj){
var others = [].slice.call(arguments,1);
others.forEach(function(other){
for(var j in other) obj[j] = other[j];
});
return obj;
}
var Node = function(value){
this.value = value;
View picturefill-rails.rb
def pf(path)
picturefill(path, "AltText") do
b = path.scan(/(^.*)\.(jpg|png|gif)/).flatten
sizes = {
:small => "#{b[0]}_small.#{b[1]}",
:medium => "#{b[0]}_medium.#{b[1]}",
:medium_high_dpi => "#{b[0]}_medium_high_dpi.#{b[1]}",
:large => "#{b[0]}_large.#{b[1]}",
:large_high_dpi => "#{b[0]}_large_high_dpi.#{b[1]}"
}
View landsat-db.rb
# get the CSV from http://landsat.usgs.gov/metadata_service/bulk_metadata_files/LANDSAT_8.csv
require 'csv'
FILE = File.expand_path("..", __FILE__) + "/initial/LANDSAT_8.csv"
SCHEMA = <<-SQL
DROP TABLE "landsat8";
CREATE TABLE "landsat8" (
"sceneid" varchar(21) not null,
sensor varchar(8) not null,
View static-dynamic-tiles.rb
class TilesController < ApplicationController
around_filter :up_s3
def tile_response(map)
respond_to do |format|
format.png {
send_data map.to_png, :content_type => Mime::Type.lookup_by_extension("png"), :disposition => "inline"
}
end
end
View wb-sync.rb
color = Dir["./west bay pass 1 color/*"]
infra = Dir["./west bay pass 1 infra/*"]
color_idx = 0
infra_idx = 0
def mk_filename(idx)
prefix = "IMG_"
no_str = idx < 1000 ? "0#{idx}" : idx
"#{prefix}#{no_str}"
View infra-sync.rb
color = Dir["./hermitage\ color/*"]
infra = Dir["./hermitage\ infra/*"]
start_color = 213
start_infra = 297
color_idx = 0
infra_idx = 0
def mk_filename(idx)
View charlie-loyd.rake
# 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 && \
You can’t perform that action at this time.