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
@kapadia
kapadia / gist:3956486
Created October 26, 2012 01:43
Endianness in JavaScript
// Endian Differences When Interpreting Binary Data in JavaScript
// Let's make a request for a binary file
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data/m101.fits');
xhr.responseType = 'arraybuffer';
xhr.onload = function() {
var buffer = xhr.response;
@kapadia
kapadia / README.md
Created November 7, 2012 15:47
Safari WebGL Issues

Safari WebGL Issues

@kapadia
kapadia / matcher.py
Created February 13, 2013 21:16
Use OpenCV to match features between two images
import numpy
import cv2
original = "original.tif"
cropped = "cropped.jpeg"
def matcher():
@kapadia
kapadia / Ruse IPython Notebook
Last active December 21, 2015 20:09
WebGL plotting in IPython Notebook
{
"metadata": {
"name": "Ruse Integration"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@kapadia
kapadia / rgz-classification.json
Last active December 22, 2015 11:49
Classification Format from Radio Galaxy Zoo
{
"_id":ObjectId("522a21647b9f9937fd00006d"),
"subject_ids":[
ObjectId("520be919e4bb21ddd3000314")
],
"annotations":[
{
"0":{
"radio":{
"0":{
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "Radio Galaxy Zoo Beta"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@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.
@kapadia
kapadia / scale-me.sh
Created September 25, 2014 17:42
Scaling Bit Depth with GDAL
# Converting from 16bit to 8bit
gdal_translate -ot Byte -scale 0 65535 0 255 sixteen.tif eight.tif
# Converting from 8bit to 16bit
gdal_translate -ot Uint16 -scale 0 255 0 65535 eight.tif sixteen.tif