Skip to content

Instantly share code, notes, and snippets.

View hoffrocket's full-sized avatar
👋

Jon Hoffman hoffrocket

👋
  • Anomaly
  • New York, NY
View GitHub Profile
@hoffrocket
hoffrocket / Flickr.scala
Created January 4, 2011 05:57
flickr api utility
import _root_.net.liftweb.util._
import _root_.net.liftweb.json._
import _root_.net.liftweb.common._
import _root_.java.net.{HttpURLConnection, URL, URLEncoder}
import JsonAST._
import JsonDSL._
import JsonParser._
import Helpers._
//flickr uses some proprietary authentication mechanism instead of oauth
@hoffrocket
hoffrocket / jquery-emoji.js
Created January 29, 2011 04:12
query plugin to replace emoji utf-8 characters with the iPhone glyphs.
/**
* jquery plugin to replace emoji utf-8 characters with the iPhone glyphs.
* code adapted from here: https://github.com/konstantinov/jQuery.emoji
*
* Get your glyphs here:
* wget http://pukupi.com/post/1964/ -O - | perl -ne '/(e\d{3}.png)/ && print "http://pukupi.com/media/emoji/$1\n"' | xargs wget
*
* someone (Apple?) probably has copyright on the glyphs, not sure about reuse rules.
*/
$.fn.emoji = function() {
// Copyright 2011 Foursquare Labs Inc. All Rights Reserved.
package com.foursquare.snippet
import com.foursquare.lib._
import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.util._
import net.liftweb.util.Helpers._
import scala.xml._
Dear  Hoffman,
I am Barr. Chris Jacobs, an Attorney at law, and the personal lawyer/friend to late Engineer M.A. Hoffman, a foreigner who used to work with Shell International, Lome, Republic of Togo, herein, after shall be referred to as my late client/friend. I have contacted the white and yellow pages in search of his relatives but unfortunately did not succeed. As it may interest you to know, I got your contact through the internet professional Data Base by divine inspiration as I was going through some directories. I decided to contact you in order to champion a business of this magnitude without any problem.
On the 21st of April 2005, my client, his wife and their two children were involved in a car accident along Kara-Sokode Expressway while arriving from a holiday to Lome. All occupants of the vehicle unfortunately lost their lives. Since then, I have made several inquiries to their embassy to locate any of their extended relatives and this has also proved unsuccessful. I am contacting you to assist
#! /usr/bin/python
from subprocess import Popen
import sys, os, urllib2
try:
import json
except ImportError:
import simplejson as json
import commands
import pymongo
import time
from pymongo import Connection
from boto.ec2.connection import EC2Connection
host = '127.0.0.1'
timestamp = time.strftime("%Y-%m-%d-%H-%M")
@hoffrocket
hoffrocket / gmetric-kestrel.py
Created September 28, 2011 22:25
ganglia kestrel plugin
#!/usr/bin/env python
import memcache
import re
import subprocess
import sys
KESTREL_HOST = 'localhost:22133'
def record(name, value):
@hoffrocket
hoffrocket / LRUCache.java
Created March 4, 2012 01:17
Simple LRUCache in java (not threadsafe)
import java.util.HashMap;
import java.util.Map;
public class LRUCache<K, V> {
private final Map<K, Pair<Node<K>, V>> map = new HashMap<K, Pair<Node<K>,V>>();
private Node<K> head = null;
private Node<K> tail = null;
private final int maxSize;
@hoffrocket
hoffrocket / ebsdiskhealth.py
Created May 23, 2012 05:03
raid0 ebs disk health monitor
#!/usr/bin/env python
import atexit
import datetime
from datetime import timedelta
import logging
import os
import smtplib
import subprocess as sub
import sys
@hoffrocket
hoffrocket / WebServer.java
Created June 21, 2012 15:34
tracelytics java api example
package jon.trace;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executors;