Skip to content

Instantly share code, notes, and snippets.

@kellan
kellan / cfda.json
Created February 2, 2013 23:18
The members of Council of Fashion Designers as a JSON blob. From #fashionhack hackathon.
[{"name":"Amsale Aberra","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/Amsale-Image-400x600.jpg","cfda":"http:\/\/cfda.com\/designer\/amsale-aberra-2","website":"http:\/\/www.amsale.com","facebook":"http:\/\/www.facebook.com\/pages\/Amsale\/11144370697","twitter":"http:\/\/www.twitter.com\/amsalebridal","pinterest":null,"tumblr":null,"blog":null},{"name":"Reem Acra","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/IMG_7440-400x600.jpg","cfda":"http:\/\/cfda.com\/designer\/reem-acra","website":"http:\/\/www.reemacra.com","facebook":"http:\/\/facebook.com\/ReemAcraNY","twitter":"http:\/\/twitter.com\/#!\/Reem_Acra","pinterest":null,"tumblr":null,"blog":null},{"name":"Alexa Adams","photo":"http:\/\/cfda.com\/wp-content\/uploads\/2012\/05\/IMG_2736_\u00c2\u00a9darrenhall_2012-Edit-400x314.jpg","cfda":"http:\/\/cfda.com\/designer\/alexa-adams","website":"http:\/\/www.ohnetitel.com","facebook":"http:\/\/www.facebook.com\/#!\/pages\/Ohne-Titel\/207828522597900","twitter":null,"pinterest":null,
2013-02-10 16:21:18.372:WARN:oejs.ServletHandler:/favicon.ico
java.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:989)
at java.lang.Double.parseDouble(Double.java:510)
at com.hackdiary.geo.FlickrGeocodeServlet.doGet(FlickrGeocodeServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)

Keybase proof

I hereby claim:

  • I am kellan on github.
  • I am kellan (https://keybase.io/kellan) on keybase.
  • I have a public key whose fingerprint is 8CB7 E4FB 7173 4981 2448 20C0 886E 691B 1563 5181

To claim this, I am signing this object:

Cheshire Cat: If I were looking for a white rabbit, I'd ask the Mad Hatter.
Alice: The Mad Hatter? Oh, no no no...
Cheshire Cat: Or, there's the March Hare, in that direction.
Alice: Oh, thank you. I think i shall visit him...
Cheshire Cat: Of course, he's mad, too.
Alice: But I don't want to go among mad people!
Cheshire Cat: Oh, you can't help that. Most everyone's mad here.
update_expression, update_expression_names, update_values = generate_update(item)
resp = table.update_item(
Key=key,
UpdateExpression=update_expression,
ExpressionAttributeNames=update_expression_names,
ExpressionAttributeValues=update_values)
print(resp)
@kellan
kellan / ec2-ssh.sh
Created July 5, 2016 17:51
ec2 ssh by instance id
function ec2-ssh () {
FOO=$(aws ec2 describe-instances --filter Name=instance-id,Values=$1 | jq '.Reservations[0].Instances[0].PublicIpAddress,.Reservations[0].Instances[0].\
KeyName' | tr -d '"')
IPADDR=$(echo $FOO | cut -d" " -f1)
KEYNAME=$(echo $FOO | cut -d" " -f2)
ssh -i ~/.ssh/$KEYNAME.pem ec2-user@$IPADDR
}
@kellan
kellan / square_thumb.py
Created July 26, 2016 15:17
square thumbnails with Python PIL (Pillow), make sure to rotate correctly
from __future__ import print_function
from PIL import Image, ExifTags
def square_thumb(img, thumb_size):
THUMB_SIZE = (thumb_size,thumb_size)
exif=dict((ExifTags.TAGS[k], v) for k, v in img._getexif().items() if k in ExifTags.TAGS)
if exif['Orientation'] == 3 :
img=img.rotate(180, expand=True)
#! /bin/bash
python -m unittest $@
git filter-branch --index-filter 'git rm --cached --ignore-unmatch bad-file-to-remove.py'
const fs = require('fs');
const es = require('event-stream');
const stripBom = require('strip-bom');
let filepath = './short.tsv';
let reader = fs.createReadStream(filepath);
let keys;
reader.pipe(es.split())