Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
@wsargent
wsargent / gist:5860224
Created June 25, 2013 16:58
Using ning async http client
import play.api.libs.ws.Response
import scala.concurrent.{Future, Promise}
import com.ning.http.client._
import com.ning.http.client.{Response => AHCResponse}
import com.ning.http.client.AsyncCompletionHandler
val url = "http://google.com"
val config = new AsyncHttpClientConfig.Builder()
@wsargent
wsargent / gist:6640993
Created September 20, 2013 17:32
logging dead letter
class DeadLetterLogger extends Actor with ActorLogging {
def receive = {
case DeadLetter(message, sender, recipient) =>
log.info("DeadLetter message {}", message)
}
}
val deadLetterLogger = system.actorOf(Props(classOf[DeadLetterLogger]))
system.eventStream.subscribe(deadLetterLogger, classOf[DeadLetter])
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@wsargent
wsargent / gist:7906205
Last active December 31, 2015 00:19 — forked from tomdz/gist:5339163

Setup vagrant vm

vagrant box add precise64 http://files.vagrantup.com/precise64.box
vagrant init precise64
sed -i '.bak' 's/# config.vm.network :private_network/config.vm.network :private_network/' Vagrantfile
vagrant up
vagrant ssh

Install base software and apache (to have something to proxy)

Useful Scalac Flags

So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings. I highly recommend a set of options something like those below.

scalacOptions ++= Seq(
  "-deprecation",           
  "-encoding", "UTF-8",       // yes, this is 2 args
  "-feature",                
 "-language:existentials",

Keybase proof

I hereby claim:

  • I am wsargent on github.
  • I am will_sargent (https://keybase.io/will_sargent) on keybase.
  • I have a public key whose fingerprint is CD69 70B7 2D00 E5BE 9A33 0EF3 C1E8 BF06 2BC6 C4B7

To claim this, I am signing this object:

@wsargent
wsargent / deploy.sh
Created April 11, 2014 23:52 — forked from gre/deploy.sh
#!/bin/bash
REMOTE=play@SERVER_IP
REMOTE_APP=/home/play/PROJECT_NAME/
sbt stage || exit 1;
ssh $REMOTE "cd $REMOTE_APP; ./stop.sh";
rsync -va target/ $REMOTE:$REMOTE_APP/target
ssh $REMOTE "cd $REMOTE_APP; ./start.sh";
@wsargent
wsargent / genclient
Last active October 23, 2019 18:43
Create a working(!) client certificate for use with nginx, using only keytool
#!/bin/bash
export PW=`pwgen -Bs 10 1`
echo "$PW" > password
# Create a self signed certificate & private key to create a root certificate authority.
keytool -genkeypair -v \
-alias clientCA \
-keystore client.jks \
@wsargent
wsargent / genca.sh
Last active May 7, 2021 15:16
Generate a certificate authority and trust anchor keystore, using only keytool
#!/bin/bash
export PW=`cat password`
# Create a self signed key pair root CA certificate.
keytool -genkeypair -v \
-alias exampleca \
-dname "CN=exampleCA, OU=Example Org, O=Example Company, L=San Francisco, ST=California, C=US" \
-keystore exampleca.jks \
-keypass:env PW \
@wsargent
wsargent / gentrustanchor.sh
Last active August 29, 2015 14:00
Creates a JKS keystore that uses exampleCA as a trust anchor.
#!/bin/bash
export PW=`cat password`
# Create a JKS keystore that trusts the example CA, with the default password.
# This is used by the client.
keytool -import -v \
-alias exampleca \
-file exampleca.crt \
-keypass:env PW \