Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am stephenh on github.
* I am stephenhaberman (https://keybase.io/stephenhaberman) on keybase.
* I have a public key ASBgKUp5p77PdVZdtSABrgJit4xQ9iahkzipyPmQwPAPuQo
To claim this, I am signing this object:
role1 = { name, perms: [p1, p2, p3] }
role2 = { name, perms: [p3, p4] }
roles = [role1, role2, ...]
# put lists in sorted sort
# O(N_roles * N_permissions log N_permissions)
roles.forEach { sortInPlace(_.perms) }
# compare each role to the other, N^2 = 16m comparison
newtype Nut = Nut Int deriving Show
newtype Bolt = Bolt Int deriving Show
compareNutBolt :: Nut -> Bolt -> Int
compareNutBolt (Nut i) (Bolt j) = i - j
-- given a compare function, breaks [a] into smaller/equal/bigger
partition :: (a -> Int) -> [a] -> ([a], [a], [a])
partition f [] = ([], [], [])
[shaberma@shaberma-ld1 ~ master]$ java -Xmx1G -cp mirror-all.jar mirror.MirrorServer ~/linkedin 10000
2016-03-18 09:57:42 INFO mirror.MirrorServer initialSync Starting new session
2016-03-18 09:57:48 INFO mirror.MirrorServer initialSync Server has 49517 paths
2016-03-18 09:57:48 INFO mirror.MirrorServer initialSync Client has 7050 paths
2016-03-18 09:57:48 INFO mirror.MirrorSession seedQueueForInitialSync Queueing 43891 paths to send to the remote host
...
2016-03-18 10:00:11 SEVERE mirror.MirrorServer$1 onError Error from incoming client stream
io.grpc.StatusException: CANCELLED [43/17808]
at io.grpc.Status.asException(Status.java:509)
at io.grpc.stub.ServerCalls$2$1.onCancel(ServerCalls.java:227)
and here is the same request from 208.43.121.200 (and it fails validation because request chain is terminated with content-type text/html ):
curl -i -c poker_cookies.txt -L -H'User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.30729)' 'http://api.bizographics.com/v2/getuid?api_key=3d2e5d0fe63241629dab1e775752758a&redirect_url=http%3A%2F%2Ftags.bluekai.com%2Fsite%2F23060%3Fid%3D%24UID%26kid%3D0'
HTTP/1.1 302 Found
Date: Thu, 09 Jul 2015 01:02:31 GMT
Location: http://api.bizographics.com/v2/getuid?api_key=3d2e5d0fe63241629dab1e775752758a&redirect_url=http%3A%2F%2Ftags.bluekai.com%2Fsite%2F23060%3Fid%3D%24UID%26kid%3D0&3pc=true
Server: nginx
Set-Cookie: BizoID=9993950c-83c6-4b58-bf74-b7315e663a2f; Domain=.bizographics.com; Expires=Thu, 07-Jan-2016 13:02:31 GMT; Path=/
Content-Length: 0
Connection: keep-alive
@stephenh
stephenh / font-awesome.css
Created May 8, 2015 15:35
font awesome stub
@external *;
.fa {}
.fa-2x {}
.fa-3x {}
.fa-4x {}
.fa-5x {}
.fa-adjust {}
.fa-adn {}
.fa-align-center {}
import scala.collection.mutable.Buffer
/**
* An object into a process under to test to, at test time, purposefully cause it to fail.
*
* A typical usage might be:
*
* class SomeProcess(..., testBaton = NoopBaton() {
* def run() {
* val items = findSomeWorkItems()
// with 2.6.0
function com_google_gwt_dom_client_StyleInjector_StyleInjectorImpl(){
switch (permutationId) {
case 0:
case 4:
return new StyleInjector$StyleInjectorImpl_0;
}
return new StyleInjector$StyleInjectorImplIE_0;
}
package temp;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
System.out.println(toSeventeenDigits(1000));
System.out.println(toSeventeenDigits(100));
System.out.println(toSeventeenDigits(10));
13/08/24 14:38:52 INFO cluster.TaskSetManager: Loss was due to java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
at java.lang.Runtime.addShutdownHook(Runtime.java:211)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1441)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:256)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:187)
at org.apache.hadoop.mapred.LineRecordReader.<init>(LineRecordReader.java:77)
at org.apache.hadoop.mapred.TextInputFormat.getRecordReader(TextInputFormat.java:51)
at spark.rdd.HadoopRDD$$anon$1.<init>(HadoopRDD.scala:79)
at spark.rdd.HadoopRDD.compute(HadoopRDD.scala:70)