Skip to content

Instantly share code, notes, and snippets.

View arjones's full-sized avatar

Gustavo Arjones arjones

View GitHub Profile
@arjones
arjones / User.java
Created December 28, 2011 03:49
Mapping from Microsoft Membership .NET 2.0 to PlayFramework
package models;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
@arjones
arjones / indextank-engine.sh
Created December 22, 2011 04:59
IndexTank Start Script
{
"max_variables": 3,
"functions": {
"0": "-age"
},
"index_code": "dgmqn",
"allows_facets": true,
"ram": 600,
"log_server_host": "index123.localhost",
"autocomplete": true,
@arjones
arjones / WordCountTimeFrame.java
Created September 25, 2011 20:58
WordCount Bolt with Timer to Emit()
package storm.starter.bolt;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import org.joda.time.DateTime;
@arjones
arjones / gist:1239358
Created September 24, 2011 14:01 — forked from stonegao/gist:1044641
MD5 in scala
object MD5 {
def hash(s: String) = {
val m = java.security.MessageDigest.getInstance("MD5")
val b = s.getBytes("UTF-8")
m.update(b, 0, b.length)
new java.math.BigInteger(1, m.digest()).toString(16)
}
}
@arjones
arjones / gist:1123656
Created August 3, 2011 20:19
Sample collection handling
// This is a sample of handling collections with Scala
// It receives the .xml from your delicious account and generates an output to plot
// the count of tags on a timeframe
//
// Please, if you know better ways to do the same processing, please let me know: @arjones
//
import scala.xml._
import org.joda.time._
@arjones
arjones / .gitignore
Created July 8, 2011 21:33 — forked from karmi/.gitignore
Visualizing timelines with Protovis and date histogram facet in ElasticSearch
.DS_Store
tmp/
@arjones
arjones / .gitignore
Created July 8, 2011 19:21 — forked from karmi/.gitignore
Donut Chart from ElasticSearch Terms Facet
.DS_Store
tmp/
@arjones
arjones / gist:784413
Created January 18, 2011 13:15
Kestrel Producer/Consumer example in Java
package net.arjones.sandbox;
import net.lag.configgy.Config;
import net.lag.kestrel.PersistentQueue;
public class KestrelTest {
public static void main(String[] args) throws InterruptedException {
Config config = new Config();
#Author: Marcel Pinheiro Caraciolo
#Confusion Matrix Generator
#Version: 0.1
#email: caraciol at gmail . com
from pprint import pprint as _pretty_print
import math
class ConfusionMatrix(object):
require 'benchmark'
require 'logger'
class Module
def alias_method_chain( target, feature )
alias_method "#{target}_without_#{feature}", target
alias_method target, "#{target}_with_#{feature}"
end
end unless Module.public_method_defined?(:alias_method_chain)