Skip to content

Instantly share code, notes, and snippets.

Henrik Engstrom (@h3nk3) henrikengstrom

  • NYC/NY/USA
Block or report user

Report or block henrikengstrom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@henrikengstrom
henrikengstrom / DataDogTracerFactory.scala
Last active Aug 27, 2018
Example of Cinnamon + DataDog OT integration
View DataDogTracerFactory.scala
/**
* Add the following setting to the application.conf to wire things up.
*
* cinnamon.opentracing {
* tracers = [datadog]
*
* datadog {
* factory-class = "sample.DataDogTracerFactory"
* }
* }
View HelloAkka.scala
import akka.actor.{ ActorRef, ActorSystem, Props, Actor, ActorLogging }
import scala.concurrent.duration._
object Common {
case class Greeting(greeting: String)
}
object Greeter {
def props(message: String, printerActor: ActorRef): Props = Props(new Greeter(message, printerActor))
case object Greet
View keybase.md

Keybase proof

I hereby claim:

  • I am henrikengstrom on github.
  • I am h3nk3 (https://keybase.io/h3nk3) on keybase.
  • I have a public key ASAX3TmieeXD65G9RyuVRIlnm0PC0xeetfKmZPNMboxDigo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am henrikengstrom on github.
  • I am h3nk3 (https://keybase.io/h3nk3) on keybase.
  • I have a public key whose fingerprint is 31C1 1375 AC5C 0575 AD34 EE7D 35CE 457A A97A C6B8

To claim this, I am signing this object:

@henrikengstrom
henrikengstrom / gist:2239565
Created Mar 29, 2012
Using specific config settings with TestActorRef
View gist:2239565
import akka.testkit.TestActorRef
import org.scalatest.matchers.MustMatchers
import org.scalatest.WordSpec
import com.typesafe.config.ConfigFactory
import akka.actor.{Actor, ActorSystem}
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class Example2 extends WordSpec with MustMatchers {
implicit val actorSystem = ActorSystem("TestSystem", ConfigFactory.parseString("""{ test.value = "Hey, it works!" }"""))
@henrikengstrom
henrikengstrom / gist:2239521
Created Mar 29, 2012
Using specific config settings with TestKit - example 1
View gist:2239521
import akka.testkit.{TestActorRef, TestKit}
import com.typesafe.config.ConfigFactory
import org.scalatest.matchers.MustMatchers
import org.scalatest.WordSpec
import akka.actor.{Actor, ActorSystem}
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class Example1 extends TestKit(
ActorSystem("TestSystem", ConfigFactory.parseString("""{ test.value = "Hey, it works!" }""")))
with WordSpec
View gist:1863424
def receive = {
case actors: Int =>
val futures = for (x <- 1 to actors) yield {
context.actorOf(Props[MonkeyWorker]) ? randomGenerator.nextInt(100) mapTo manifest[Set[String]]
}
Future.sequence(futures) map { wordSets =>
val mergedSet = wordSets reduce ( (a, b) => a ++ b )
val (shakespeare, unworthy) = mergedSet partition (x => Blueprint.contains(x))
Result(shakespeare, unworthy)
View gist:1863329
case POST(Path("/write")) Action { implicit request =>
val start = System.nanoTime
val numberMonkeys = writeForm.bindFromRequest.get
AsyncResult {
(shakespeare ? numberMonkeys).mapTo[Result].asPromise.map { result
// We have a result - make some fancy pantsy presentation of it
val builder = new StringBuilder
builder.append("SHAKESPEARE WORDS:\n")
result.shakespeareMagic.foreach { w => builder.append(w + "\n") }
builder.append("UNWORTHY WORDS CREATED: " + result.unworthyWords.size + "\n")
@henrikengstrom
henrikengstrom / gist:1843428
Created Feb 16, 2012
Akka2.0-RC1 example of using futures to re-start long running task
View gist:1843428
import akka.actor.{ Props, ActorSystem, Actor }
import akka.pattern.ask
import akka.util.Timeout
import akka.util.duration._
import akka.dispatch.Await
import util.Random
object DangerousOpTest extends App {
println("starting system")
val system = ActorSystem("daOp")
View gist:1539480
calculator {
include "common"
akka {
remote.netty.port = 2552
}
}
remotelookup {
include "common"
You can’t perform that action at this time.