Skip to content

Instantly share code, notes, and snippets.

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

@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 / 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 / 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)

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 / 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)
@rkuhn
rkuhn / Trial2712.scala
Last active February 27, 2019 17:32
Trying out workarounds for SI-2712: we are running into it when trying to generically extend the FlowOps / FlowOpsMat types in Akka Streams’ Scala DSL.
import scala.annotation.unchecked.uncheckedVariance
object Trial2712 {
trait NotUsed
import language.higherKinds
/*
* The following are simplified versions of FlowOps / FlowOpsMat and their
* concrete subtypes.
*/

Some limits of equational reasoning

This is a follow-up on a discussion on gitter I had with Rob Norris. Gitter is great, but it is easier to make a coherent argument in a gist.

The monad laws allow us to assert that in the following the two results will describe computations that eventually yield the same value:

val fut1 = Future(<comp1>)
val fut2 = Future()
package akka.typed
import scala.concurrent.duration._
import org.coroutines._
object Coroutines {
/**
* This will be a collection of all the management commands that are sent
* to a Session-hosting Actor via its main channel (i.e. the ActorRef that
* is returned directly for it).
@rkuhn
rkuhn / Client.java
Last active January 27, 2017 14:36
demo of missing backpressure propagation in ReactiveSocket Java (Jan 27, 2017)
package com.rolandkuhn.rs;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import io.reactivesocket.ReactiveSocket;
import io.reactivesocket.client.KeepAliveProvider;
import io.reactivesocket.client.ReactiveSocketClient;