Skip to content

Instantly share code, notes, and snippets.

View dhanji's full-sized avatar

Dhanji R. Prasanna dhanji

View GitHub Profile

###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:

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]
@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
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
-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:
@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",
@dhanji
dhanji / Bar.java
Last active December 8, 2015 02:07
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: bar.proto at 5:1
package com.squareup.foobar.protos.bar;
import com.squareup.wire.FieldEncoding;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import java.io.IOException;
-- Using merge to efficiently intersect two lists
ages = [1, 2, 5, 6]
names = [1, 5, 6, 7, 8, 9]
addresses = [2, 3, 7, 9, 10]
siblings = [3, 5, 6, 9]
intersect [] [] = []
intersect [] _ = []
intersect _ [] = []
-- FizzBuzz: http://wiki.c2.com/?FizzBuzzTest
fizzbuzz x
| fizz x && buzz x = "FizzBuzz"
| fizz x = "Fizz"
| buzz x = "Buzz"
| otherwise = ""
where
fizz n = (n `mod` 3) == 0
buzz n = (n `mod` 5) == 0
-- Intersect an arbitrary number of ordered lists
-- based on a problem by Alec Thomas
intersectTwo [] [] = []
intersectTwo ls [] = []
intersectTwo [] ls = []
intersectTwo (x:xs) (y:ys)
| x == y = [x] ++ (intersectTwo xs ys)
| x > y = intersectTwo (x:xs) ys