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
import sys
import requests
from requests.auth import HTTPBasicAuth
def go(username, password):
"""
Example of programmatically accessing Sentinel data.
:param username:
@kapadia
kapadia / copy.py
Last active August 29, 2015 14:03
import sys
import numpy as np
import rasterio as rio
def copy(srcpath, dstpath):
with rio.drivers():
with rio.open(srcpath, 'r') as src:
metadata = src.meta
@kapadia
kapadia / README.md
Created August 26, 2014 01:43 — forked from dfm/README.md

This will change your life. Add this as a git pre-push hook.

How, you ask?

wget https://gist.github.com/dfm/5828028/raw/772270b65a804678db70012d3406f41c79cb53a5/pre-push
chmod +x pre-push
mv pre-push /path/to/your/favorite/repo/.git/hooks
cd /path/to/your/favorite/repo
git push
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