Skip to content

Instantly share code, notes, and snippets.

View jboner's full-sized avatar

Jonas Bonér jboner

View GitHub Profile
@jboner
jboner / akka-cluster-implementation-notes.md
Last active March 4, 2023 22:30
Akka Cluster Implementation Notes

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation:

@jboner
jboner / BloomFilter.scala
Created August 7, 2013 13:47
Bloom filter in Scala taken from Twitter's Algebird project.
/*
Copyright 2012 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@jboner
jboner / lostincallbackhell.js
Created April 26, 2013 13:10
Lost In Callback Hell
lost(arg, function(err, result) {
if(err) return console.log(err);
In(result, function(err, result) {
if(err) return console.log(err);
callback(result, function(err, result) {
if(err) return console.log(err);
hell(result);
});
});
});
@jboner
jboner / SimpleAkkaIoHttpClient.scala
Created January 4, 2013 10:17
Nice simple Akka IO HTTP Client by @patriknw
import akka.actor._
import java.net.InetSocketAddress
import akka.util.ByteString
class SimpleClient(destAddress: InetSocketAddress) extends Actor {
val socket = IOManager(context.system) connect (destAddress)
val state = IO.IterateeRef.sync()
@jboner
jboner / typesafe-project-and-developer-guidelines.md
Last active October 9, 2022 21:58
Typesafe Project & Developer Guidelines

Typesafe Project & Developer Guidelines

These guidelines are meant to be a living document that should be changed and adapted as needed. We encourage changes that makes it easier to achieve our goals in an efficient way.

These guidelines mainly applies to Typesafe’s “mature” projects - not necessarily to projects of the type ‘collection of scripts’ etc.

General Workflow

This is the process for committing code into master. There are of course exceptions to these rules, for example minor changes to comments and documentation, fixing a broken build etc.

@jboner
jboner / cloc-akka.txt
Created October 3, 2012 15:42
cloc on akka
jboner at sarek in ~/src/akka-stuff/akka on master
[130] $ cloc . 5244 text files.
2647 unique files.
3822 files ignored.
http://cloc.sourceforge.net v 1.56 T=52.0 s (41.8 files/s, 13040.5 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
HTML 1473 39655 1 529371
@jboner
jboner / latency.txt
Last active April 18, 2024 17:18
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jboner
jboner / .ctags
Created February 17, 2012 18:50
Scala CTags config file
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/r,cclasses/
--regex-Scala=/^[ \t]*case[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/r,cobjects/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,aclasses/
--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*[:=]/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
@jboner
jboner / SBT.sublime-build
Created May 6, 2011 09:47
Sublime Editor SBT build setup
{
"cmd": ["sbt-no-color compile"],
"file_regex": "^\\[error\\] ([.a-zA-Z0-9/-]+[.]scala):([0-9]+):",
"selector": "source.scala",
"working_dir": "${project_path:${folder}}",
"shell": "true"
}
package com.earldouglas.remoteakka
import akka.actor.Actor
import akka.actor.Actor._
case object Greeting
case class Jar(val bytes: Array[Byte])
case class RegisterRemote(val name: String, val className: String)
object Runner {