Skip to content

Instantly share code, notes, and snippets.

View dhanji's full-sized avatar

Dhanji R. Prasanna dhanji

View GitHub Profile
@dhanji
dhanji / gist:8482ddbe3099f7309a9d
Created July 27, 2015 22:02
disposable email domains
"0815.ru0clickemail.com",
"0wnd.net",
"0wnd.org",
"10minutemail.com",
"20minutemail.com",
"2prong.com",
"3d-painting.com",
"4warding.com",
"4warding.net",
"4warding.org",
-Xmx10g
m2.xlarge (4 virtual cores)
Both Jetty and Netty execute the same code--generate 8k of random bits and compute a sha1, returning it over the wire.
INTERNAL (Benchmark tool runs on same machine)
--------
Jetty:
Monaco: What's Yours Is Mine
FEZ
Thomas Was Alone
English Country Tune
Capsized
Oil Rush
Awesomenauts
The Basement Collection
Offspring Fling
Dungeon Defenders + All DLC Steam key
@dhanji
dhanji / BigInt.hs
Last active August 29, 2015 14:07
Add two big integers
add [] [] c = show c
add ls [] c = add ls (replicate (length ls) '0') c
add [] ls c = add (replicate (length ls) '0') ls c
add (x:xs) (y:ys) c = (add xs ys carry) ++ (show result)
where
addInt x y z = (read x :: Int) + (read y :: Int) + z
addition = addInt [x] [y] c
carry = addition `quot` 10
result = addition `mod` 10
val active: ConcurrentMap[String, Long] = CacheBuilder.newBuilder()
.build[String, Long]()
.asMap()
/**
*
scala: type arguments [String,Long] conform to the bounds of none of the overloaded alternatives of
value build: [K1 <: Object, V1 <: Object]()com.google.common.cache.Cache[K1,V1] <and> [K1 <: Object, V1 <: Object](x$1: com.google.common.cache.CacheLoader[_ >: K1, V1])com.google.common.cache.LoadingCache[K1,V1]

###Sitebricks Quickstart

curl https://raw.github.com/dhanji/sitebricks/master/sitebricks-cloud/src/main/resources/sitebricks.sh > /usr/local/bin/sitebricks
mkdir myproject
cd myproject
sitebricks init com.example:myproject:1.0
sitebricks

You should see something like:

@At("/person") @Service
public class PersonService {
@Get
@As(Json.class) Reply<List<Person>> getRelatives(@As(Json.class) Person p) {
return Reply.with(relativesOf(p));
}
}
@dhanji
dhanji / gist:4014182
Created November 4, 2012 22:51
Completely type-safe query-DSL for Java
Person p = query.topic(Person.class);
List<Person> results = query.from(p)
.where(p.getName(), is("Jason"))
.and(p.getAge(), greaterThan(10))
.and(p.getCountry(), like("Canad*"))
.or()
.where(p.getName(), is("Dhanji"))
.and(p.getCountry(), not("Canada"))
.list();
@dhanji
dhanji / gist:1841835
Created February 16, 2012 03:57
License scanner report
Scanning...
CacheStorage.java: [asl1.0: 52%, asl1.1: 66%]
ClassTemplateLoader.java: [asl1.0: 52%, asl1.1: 66%]
ConcurrentCacheStorage.java: []
ConcurrentMapFactory.java: []
FileTemplateLoader.java: [asl1.0: 52%, asl1.1: 66%]
MruCacheStorage.java: [asl1.0: 52%, asl1.1: 66%]
MultiTemplateLoader.java: [asl1.0: 52%, asl1.1: 66%]
NullCacheStorage.java: [asl1.0: 52%, asl1.1: 66%]
@dhanji
dhanji / Cookies.java
Created December 8, 2011 23:29
Tools for manipulating cookies
package com.wideplay.mailsy.web.auth;
import com.wideplay.mailsy.data.index.Ids;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author [email protected] (Dhanji R. Prasanna)