Skip to content

Instantly share code, notes, and snippets.

View kapadia's full-sized avatar
💭
eating a pecan bar

Amit Kapadia kapadia

💭
eating a pecan bar
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kapadia
kapadia / geojson.sh
Created October 28, 2014 00:07
geojson.sql
psql -Atc "SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type, ST_AsGeoJSON(box2d(ST_Buffer(ST_Transform(lg.wkb_geometry, 3857), 300)))::json As geometry, row_to_json((scene_id, created)) As properties FROM scenes As lg WHERE scene_id='$sceneid') As f ) As fc;" > $bounds
@kapadia
kapadia / parallel-exp.sh
Created November 6, 2014 22:19
Parallel Experiment
#!/bin/bash
set -eou pipefail
function onerror() {
echo "onerror" $?
exit 1
}
trap onerror EXIT
import click
import rasterio as rio
@click.command()
@click.argument('src_path', type=click.Path(exists=True))
@click.argument('dst_path', type=click.Path(exists=False))
def to_png(src_path, dst_path):
with rio.drivers():
@kapadia
kapadia / go.sh
Created December 11, 2014 23:48
Bash Error Handling
#!/bin/bash
# Use -e to exit the script as soon as anything returns non-zero
set -eou pipefail
function usage() {
echo ""
echo "Template script for bash error handling."
echo ""
@kapadia
kapadia / getpreview
Last active August 29, 2015 14:13
Generate preview images and upload to S3
#!/bin/bash
set -eou pipefail
function usage() {
echo ""
echo "Utility for generating preview images and uploading to S3. This script is meant to be"
echo "used in a remote environment (e.g. EC2). The environment variable WORKING_BUCKET must be"
echo "defined to an S3 bucket, of which you have access."
echo ""