Skip to content

Instantly share code, notes, and snippets.

@aphexmunky
aphexmunky / benchmark.groovy
Last active September 27, 2018 14:31
benchmark closure
def benchmark = { closure ->
start = System.currentTimeMillis()
closure.call()
now = System.currentTimeMillis()
now - start
}
def originalTime = benchmark {
productList.each { productId ->
def param = [productId]
@aphexmunky
aphexmunky / # magic-wormhole - 2018-07-02_10-48-58.txt
Created July 2, 2018 09:49
magic-wormhole on Ubuntu 18.04 LTS - Homebrew build logs
Homebrew build logs for magic-wormhole on Ubuntu 18.04 LTS
Build date: 2018-07-02 10:48:58
@aphexmunky
aphexmunky / # consul - 2018-06-27_10-51-22.txt
Created June 27, 2018 10:18
consul on Ubuntu 18.04 LTS - Homebrew build logs
Homebrew build logs for consul on Ubuntu 18.04 LTS
Build date: 2018-06-27 10:51:22
@aphexmunky
aphexmunky / # consul - 2018-06-27_10-09-13.txt
Created June 27, 2018 09:11
consul on Ubuntu 18.04 LTS - Homebrew build logs
Homebrew build logs for consul on Ubuntu 18.04 LTS
Build date: 2018-06-27 10:09:13
@aphexmunky
aphexmunky / download-latest.sh
Created January 11, 2018 10:21
Downloads the latest file in the root of an s3 bucket presuming the directory has the same name as the bucket
#!/bin/bash │2017-12-28 17:35:07 93049433 location-report-28-12-2017-17:00:22.csv
│2017-12-29 00:35:07 92385322 location-report-29-12-2017-00:00:21.csv
dir=`basename $PWD` │2017-12-29 10:34:04 88874615 location-report-29-12-2017-10:00:21.csv
download=`aws s3 ls s3://$dir/ | sort | tail -n 1 | awk '{print $4}'` │2017-12-29 17:34:40 89295406 location-report-29-12-2017-

Keybase proof

I hereby claim:

  • I am aphexmunky on github.
  • I am aphexmunky (https://keybase.io/aphexmunky) on keybase.
  • I have a public key ASCpxQwtuGY_YUiDTSvo4dinYyFuJdubxExTRNxQqlX_ogo

To claim this, I am signing this object:

@aphexmunky
aphexmunky / BatikResource.java
Last active May 3, 2017 22:04
Using batik in a servlet
package com.aphexmunky.batiksample.facade;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.fop.svg.PDFTranscoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import akka.actor.{ActorSystem, Actor, Props, PoisonPill}
import akka.routing.BroadcastRouter
object Clicker extends App {
val system = ActorSystem("clicker")
main
@aphexmunky
aphexmunky / ReCaptcha.scala
Created July 16, 2013 11:00
Scala with Spring Autowired constructors
trait ReCaptchaVerifier {
def validate(reCaptchaRequest: ReCaptchaSecured): Boolean
}
@Service
class HttpClientReCaptchaVerifier @Autowired()(
httpClient: HttpClient,
servletRequest: HttpServletRequest,
@Value("${recaptcha_url}") recaptchaUrl: String,
@aphexmunky
aphexmunky / SpringApp.scala
Created May 23, 2013 08:48
Quick snippet of using spring in scala app
object SpringApp extends App {
val ctx = new AnnotationConfigApplicationContext
ctx.scan(/* FIXME: update to correct value */"base.namespace")
ctx.refresh()
val system = ctx.getBean(classOf[ActorSystem])
}