Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
@wsargent
wsargent / README.md
Created September 8, 2016 00:37 — forked from loicknuchel/README.md
Missing features in Play i18n
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.util.Timeout;
import scala.compat.java8.FutureConverters;
import scala.concurrent.Future;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
public class JavaActorLookup {
@wsargent
wsargent / TracerBulletController.scala
Last active January 23, 2018 17:23
Supports tracer bullet dynamic logging
package controllers
import javax.inject._
import play.api.mvc._
@Singleton
class TracerBulletController @Inject() extends Controller {
private val logger = org.slf4j.LoggerFactory.getLogger("application")
/*
@wsargent
wsargent / Scala-Play-App-Docker-Deploy.md
Created July 15, 2016 00:21 — forked from IncludeSecurity/Scala-Play-App-Docker-Deploy.md
Deploying Scala Play Framework Applications on AWS Beanstalk using Docker containers
// a Train "at" time produces a TrainFromOps
// a TrainFromOps "from" station produces a Train
// a TrainInfo "at" time produces a TrainInfoFromOps
// a TrainInfoFromOps "from" station produces a TrainInfoAtOps
// a TrainInfoAtOps "at" time produces a TrainFromOps
// TrainOps(train)
// TrainInfoOps(info: TrainInfo)
// TrainFromOps(info, scheudle, time)
import play.api.libs.ws.ahc.AhcWSClient
import akka.stream.ActorMaterializer
import akka.actor.ActorSystem
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
val ws = AhcWSClient()
val req = ws.url("http://example.com").get().map{
resp => resp.body
// GeneratePolicyFromDeniedPermissions - timestamp: Thu Dec 17 13:24:58 PST 2015
grant codeBase "file:/home/wsargent/work/activator-play-tls-example/target/universal/activator-play-tls-example-1.0.0/lib/activator-play-tls-example.activator-play-tls-example-1.0.0-sans-externalized.jar" {
permission java.io.FilePermission "certs/clientca.jks", "read";
permission java.io.FilePermission "certs/example.com.jks", "read";
permission java.io.FilePermission "certs/password", "read";
permission java.util.PropertyPermission "play.ssl.needClientAuth", "read";
};
grant codeBase "file:/home/wsargent/work/activator-play-tls-example/target/universal/activator-play-tls-example-1.0.0/lib/ch.qos.logback.logback-classic-1.1.3.jar" {
@wsargent
wsargent / Hello.scala
Last active December 17, 2015 21:50
Prograde example
package com.example
object Hello {
def main(args: Array[String]): Unit = {
val runtime = Runtime.getRuntime
val cwd = System.getProperty("user.dir")
val process = runtime.exec(s"$cwd/testscript.sh") // pick something harmless
println("Process executed without security manager interference!")
}
}
> testOnly play.it.http.websocket.AkkaHttpWebSocketSpec
[info] AkkaHttpWebSocketSpec
[info]
[info] Plays WebSockets should
[info] allow handling WebSockets using Akka streams
[info] + allow consuming messages
[info] + allow sending messages
[info] + close when the consumer is done
[info] + allow rejecting a websocket with a result
#!/usr/bin/env bash
#
# A more capable sbt runner, coincidentally also called sbt.
# Author: Paul Phillips <paulp@typesafe.com>
# todo - make this dynamic
declare -r sbt_release_version=0.13.5
declare -r sbt_unreleased_version=0.13.5
declare -r buildProps=project/build.properties