Skip to content

Instantly share code, notes, and snippets.

@rkuhn
rkuhn / MergeSorted.scala
Created November 18, 2015 16:09
MergeSorted
class MergeSorted[T: Ordering] extends GraphStage[FanInShape2[T, T, T]] {
private val left = Inlet[T]("left")
private val right = Inlet[T]("right")
private val out = Outlet[T]("out")
override val shape = new FanInShape2(left, right, out)
override def createLogic(attr: Attributes) = new GraphStageLogic(shape) {
import Ordering.Implicits._
setHandler(left, ignoreTerminateInput)

The akka/akka Gitter Channel

This channel is available for all Akka enthusiasts—newbies as well as gurus—for the exchange of knowledge and the coordination of efforts around Akka; it is a community effort and resource and not backed by Typesafe. For more structured discussions please refer to the akka-user mailing list.

Instead of a long Code of Conduct we rely upon common sense: be kind and respectful to those who are already here and to those who come after you, harassment of any kind will not be tolerated; in case of trouble contact akka.official.

Please also note that this is not an official Akka support channel, for commercial support please contact Typesafe or visit Typesafe.com.

@rkuhn
rkuhn / stacktrace_lambda.txt
Created April 1, 2015 13:08
lambdas vs stacktraces
java.lang.RuntimeException: buh
at docs.actor.ActorDocTest.lambda$t$207(ActorDocTest.java:86)
at docs.actor.ActorDocTest$$Lambda$21/1048855692.doit(Unknown Source)
at docs.actor.ActorDocTest.m(ActorDocTest.java:80)
at docs.actor.ActorDocTest.t(ActorDocTest.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
@rkuhn
rkuhn / output
Created December 28, 2014 17:43
HdrHistogram log blows up HistogramLogProcessor
1419785841.280,1.214,0.207,HISTggAAC5B42u2dd7AkRR3Hp3tmdmZ3Z3dm973jCCd4COqhD04PcylgQurOAGYw5ypQkRJzAAQVLRVELFOZcxbFhDknEC0wixlFLcuEiun8g89YNb+qqX373m2Yfd/vP9/q6Z6e7v7F7nlvZ8uZ550euOFpwbUIYXdtaffuI/4YCMKs4abUv1vj8/yY97sx+43hds39vqZ/b+y6BXfhHF6CI/OcwrRPTLvQPCcx5ZIzOK0pt8w8O6acmufZ+5Ka/jPTX2HK5f19M89lsy7lOu1leD/4hvAN4EPhA+F94a3w9eEtZr33gYfwZvi6pry/uX9v+DpmXAeadtvMvA424z3EjG+rue8W8A74JuZ6ybeEbwM/AL4XfGv4PvDD4KfBJ8LHwg+Bj4CPNM8r290NvjN8b/jh8DPhx8Fnw8+AzzDtnwA/HX4JfDr8VPgx8KPhJ5p5vBt+Mfwu+KvwFfDH4M/BX4R/Bl8Ofxb+PvwF+Ifwn+FPwlfCl8LfhH8J/xz+C+4jNe6s1M+/Ue7ByM/dHz4cRt6OdXVPgc+En2Pqnw3fBT4ORl7udTByc+fBp8JvhZGP+zDuBzt1P4H/yXXswa/A5bivNNdfASMnz3g88vMvM4y8/aPg7TB65Heafn6KWzuI8qcoY//hPWH8ln8TfBl8Ncz8PHINsVvPfEP8Q4hdh7eCbwufBZ8CM77wfbh7/E1EvxF+LvoI7XZTxt4j7DP6Fnwj2v2HMuOIXgTjpyPsNkJ/I9Ynwt4i7Cx6I+GB9Y3+QRk/FZ8P/xi+MXw7mHVt4fci7CrGH8bMu8U8Y8YZ34HrT6b8XZjxxm+nnv5a1LfoL2F8yW8IV+hnQjxNsLPWdyiTfSfYW4I/T/Dfyddp/1vKxMeUcSa/gLGn5LmEG/Q9vTlMfEt/Tz12kF4Fs57pfeGvwb+CsccU/5L+mn7K+/Ff6SsJv/jlDvGsTdxqs37dC6lHLzrkAR38Xg997b6Z66xnh7jSZV5d4
@rkuhn
rkuhn / LineNumbers.scala
Last active August 29, 2015 14:10
getting line number range for class definition
import java.io.DataInputStream
import scala.annotation.tailrec
object LineNumbers {
sealed trait Result
case object NoSourceInfo extends Result
case class SourceFile(filename: String) extends Result {
override def toString = filename
}
case class SourceFileLines(filename: String, from: Int, to: Int) extends Result {
@rkuhn
rkuhn / keybase.md
Created July 25, 2014 12:26
keybase.io verification post

Keybase proof

I hereby claim:

  • I am rkuhn on github.
  • I am rkuhn (https://keybase.io/rkuhn) on keybase.
  • I have a public key whose fingerprint is A5B2 DDE7 843E 7CA3 E8CA ABD0 2383 163B C408 44FD

To claim this, I am signing this object:

rk:~ rkuhn$ tracert.pl youtube.com
traceroute: Warning: youtube.com has multiple addresses; using 173.194.113.136
traceroute to youtube.com (173.194.113.136), 64 hops max, 52 byte packets
1 fritz.box (192.168.178.1 [PRIVATE-ADDRESS-CBLK-RFC1918-IANA-RESERVED]) 0.933 ms 0.772 ms 0.707 ms
2 213.191.89.55 (213.191.89.55 [HANSENET]) 25.085 ms 25.208 ms 25.241 ms
3 62.53.12.0 (62.53.12.0 [DE-MEDIAWAYS-970527]) 25.232 ms 25.375 ms 26.425 ms
4 ge8-0.br50.fra.de.hansenet.net (62.109.70.21 [DE-HANSENET-20010803]) 25.899 ms 25.569 ms 40.448 ms
5 de-cix10.net.google.com (80.81.192.108 [DE-CIX-FRA-IXP]) 26.053 ms 25.781 ms 25.564 ms
6 209.85.240.64 (209.85.240.64 [GOOGLE]) 34.697 ms 26.763 ms
209.85.241.110 (209.85.241.110 [GOOGLE]) 26.022 ms
@rkuhn
rkuhn / Bounded.scala
Created July 12, 2014 12:34
Performance assessment of bounded vs unbounded requests across an asynchronous boundary
package rs
import org.openjdk.jmh.annotations._
import org.reactivestreams.Publisher
import org.reactivestreams.Subscriber
import org.reactivestreams.Subscription
import java.util.concurrent.atomic.AtomicLong
import java.util.Queue
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
@rkuhn
rkuhn / WatcherForwarder.java
Created October 1, 2013 09:36
Staying in Contact with an Actor’s Acquaintances
import java.util.concurrent.TimeUnit;
import scala.concurrent.duration.Duration;
import akka.actor.ActorIdentity;
import akka.actor.ActorPath;
import akka.actor.ActorRef;
import akka.actor.Identify;
import akka.actor.ReceiveTimeout;
import akka.actor.Terminated;
import akka.actor.UntypedActorWithStash;
@rkuhn
rkuhn / Build.scala
Created August 24, 2013 10:38
A small experiment to integrate akka.Main with sbt-start-script (applying https://github.com/sbt/sbt-start-script/pull/43). sbt> start-script will generate a runner which executes the Actor `org.example.Main`
import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtStartScript.{startScriptForClassesSettings => startScript}
import com.typesafe.sbt.SbtStartScript.StartScriptKeys._
object AkkaProjectInScalaBuild extends Build {
lazy val akkaProjectInScala = Project(
id = "akka-project-in-scala",
base = file("."),