Skip to content

Instantly share code, notes, and snippets.

@jrudolph
jrudolph / analysis.txt
Last active November 2, 2016 05:49
Release Train for 2.12.0-M5
TargetVersion: Scala 2.12.0-M5 LastVersion: Scala 2.11
26 libraries available for Scala 2.12.0-M5 (see the end for sbt config lines)
akka-actor 1 versions: 2.4.8
akka-stream 1 versions: 2.4.8
akka-http 1 versions: 2.4.8
akka-osgi 1 versions: 2.4.8
akka-slf4j 1 versions: 2.4.8
akka-testkit 1 versions: 2.4.8
slick 1 versions: 3.2.0-M1
@jrudolph
jrudolph / processEvent.txt
Last active February 8, 2016 14:10
Process disassemblage
[info] Decoding compiled method 0x00007f64092da790:
[info] Code:
[info] [Entry Point]
[info] [Constants]
[info] # {method} {0x00007f63ff054808} 'processEvent' '(I)V' in 'akka/stream/impl/fusing/GraphInterpreter'
[info] # this: rsi:rsi = 'akka/stream/impl/fusing/GraphInterpreter'
[info] # parm0: rdx = int
[info] # [sp+0x50] (sp of caller)
[info] 0x00007f64092daae0: mov 0x8(%rsi),%r10d
[info] 0x00007f64092daae4: shl $0x3,%r10
@jrudolph
jrudolph / README.md
Created October 3, 2015 10:05
Creating and unpacking and updating Android backups
@jrudolph
jrudolph / branch-targets.sbt
Last active August 29, 2015 14:25
Setup per-branch target directories in sbt
// Helper snippet to enable per-git-branch target directories
//
// This will move the target directory for a sub-module away
// from <project-root>/<sub-module-name>/target
// to <project-root>/per-branch-targets/<branch-name>/<sub-module-name>
//
// Why?: shorter wait times if you switch branches often enough
// (Example: Akka's project file take 20+ seconds to compile and
// a single line change in AkkaBuild.scala will always
// trigger a complete rebuild.)
@jrudolph
jrudolph / analysis.txt
Last active November 2, 2016 05:46
Release Train for 2.12.0-M3
TargetVersion: Scala 2.12.0-M3 LastVersion: Scala 2.11
25 libraries available for Scala 2.12.0-M3 (see the end for sbt config lines)
akka-actor 3 versions: 2.4.3, 2.4.2, 2.4.1
akka-stream 2 versions: 2.4.3, 2.4.2
akka-http 2 versions: 2.4.3, 2.4.2
akka-osgi 3 versions: 2.4.3, 2.4.2, 2.4.1
akka-slf4j 3 versions: 2.4.3, 2.4.2, 2.4.1
akka-testkit 3 versions: 2.4.3, 2.4.2, 2.4.1
scala-xml 1 versions: 1.0.5
@jrudolph
jrudolph / TestMultipartFileUpload.scala
Last active February 13, 2023 18:09
akka-http Multipart file-upload client + server example
package akka.http.scaladsl
import java.io.File
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.util.ByteString
import scala.concurrent.duration._
import akka.actor.ActorSystem
@jrudolph
jrudolph / WhatScalaGenerates.scala
Created April 29, 2015 06:35
ParameterDirectives
// generated using a simple showTree macro:
parameter("name") // expands to:
parameters(directives.this.ParamDefMagnet.apply[String]("name")(directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String])))))
parameter("name", "address") // expands to (shapeless 1):
parameters(directives.this.ParamDefMagnet.apply[(String, String)](scala.Tuple2.apply[String, String]("name", "address"))(directives.this.ParamDefMagnet2.forTuple[(String, String), shapeless.::[String,shapeless.::[String,shapeless.HNil]], this.Out](shapeless.this.HListerAux.tupleHLister2[String, String], directives.this.ParamDefMagnet2.forHList[shapeless.::[String,shapeless.::[String,shapeless.HNil]]](shapeless.this.LeftFolder.leftFolder[shapeless.::[String,shapeless.::[String,shapeless.HNil]], spray.routing.Directive0, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.R](shapeless
@jrudolph
jrudolph / ClientFileUpload.scala
Created February 11, 2015 09:52
spray file upload example
import akka.actor.ActorSystem
import spray.client.pipelining._
import spray.http.{MediaTypes, BodyPart, MultipartFormData}
object UploadFileExample extends App {
implicit val system = ActorSystem("simple-spray-client")
import system.dispatcher // execution context for futures below
val pipeline = sendReceive
val payload = MultipartFormData(Seq(BodyPart(new File("/tmp/test.pdf"), "datafile", MediaTypes.`application/pdf`)))
@jrudolph
jrudolph / trace.log
Created December 19, 2014 13:02
Akka HttpServer trace
> 01 0 0 flow-1-1-map got ExposedPublisher
< 01 0 0 flow-1-1-map got ExposedPublisher
> 02 0 0 flow-1-1-map got SubscribePending$
< 02 0 0 flow-1-1-map got SubscribePending$
> 01 0 0 flow-1-2-1-foreach-stageFactory got ExposedPublisher
< 01 0 0 flow-1-2-1-foreach-stageFactory got ExposedPublisher
> 02 0 0 flow-1-2-1-foreach-stageFactory got SubscribePending$
< 02 0 0 flow-1-2-1-foreach-stageFactory got SubscribePending$
> 03 0 0 flow-1-2-1-foreach-stageFactory got OnSubscribe
< 03 0 0 flow-1-2-1-foreach-stageFactory got OnSubscribe
object Tcp {
trait ConnectionDescriptor {
def remoteAddress: InetSocketAddress
def localAddress: InetSocketAddress
}
sealed trait ConnectionFlow extends Flow[ByteString, ByteString] {
def remoteAddress(mMap: MaterializedMap): InetSocketAddress
def localAddress(mMap: MaterializedMap): InetSocketAddress