Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ihat on github.
  • I am ihat (https://keybase.io/ihat) on keybase.
  • I have a public key whose fingerprint is 4D23 79E3 8FAE 15AF 4E6B D1C0 A649 0C85 79DC 6339

To claim this, I am signing this object:

# computes area (in m^2) from shapefly polygons with lat/lon coords
# from http://gis.stackexchange.com/questions/127607/area-in-km-from-polygon-of-coordinates
def to_meter_squared(geom):
try:
return shapely.ops.transform(
partial(pyproj.transform,
pyproj.Proj(init='EPSG:4236'),
pyproj.Proj(
proj='aea',
@ihat
ihat / download_delighted.sh
Last active August 29, 2015 14:27
Download data from delighted
#!/bin/bash
DELIGHTED_API_KEY='API_KEY_HERE'
NUM_PAGES=3
OUTPUT_FILENAME="$(date +'%Y-%m-%d')_delighted.csv"
COLUMNS=id,person,score,comment,permalink,customer_type
get_data() {
curl https://api.delighted.com/v1/survey_responses.json\?per_page\=100\&page\=$1 -u $DELIGHTED_API_KEY:
}
@ihat
ihat / compress_files.rb
Created September 4, 2014 19:11
Split and compress
#!/usr/bin/env ruby
f = ARGV[0]
zipped_filename = f.split('.txt').first + ".tar.gz"
puts "Compressing #{f} to #{zipped_filename}"
`tar zcvf #{zipped_filename} #{f}`
@ihat
ihat / Entry.h
Last active August 29, 2015 13:57
Entry
#import "Schema.h"
@interface Entry : NSObject<Schema, NSCopying, NSCoding>
@property (nonatomic) NSNumber * age;
@property (nonatomic) NSString * gender;
@property (nonatomic) NSString * name;
@end
@ihat
ihat / gist:8654653
Created January 27, 2014 18:33
golang vim
filetype off
filetype plugin indent off
set runtimepath+=/usr/local/Cellar/go/1.2/libexec/misc/vim
filetype plugin indent on
syntax on
autocmd FileType go autocmd BufWritePre <buffer> Fmt
autocmd FileType go setlocal noexpandtab shiftwidth=2 tabstop=2 softtabstop=2 nolist