Skip to content

Instantly share code, notes, and snippets.

Some Dude ericacm

View GitHub Profile
View json.rb
require 'json'
DESC_HEAD = /^\.([^\.\[]+)/
DEREF_HEAD = /^\[(\d+)\]/
def usage
$stderr.puts <<USAGE
usage: json descriptor
aphyr / zfs-sync
Created Feb 7, 2015
Sync ZFS filesystems, incrementally if possible.
View zfs-sync
#!/usr/bin/env ruby
# Synchronizes ZFS filesystems.
# Takes three args: source pool, destination pool, and filesystem name.
# Syncs most recent snapshot of filesystem from source to destination pool,
# using incremental transfer if possible.
# Take a snapshot line from zfs list -t snapshot and emit a struct
View scodec.scala
package com.rr.experiment
import org.specs2.ScalaCheck
import org.specs2.mutable._
import org.scalacheck._
import scalaz._
import scodec._

Reading SBT Credentials from OS X Keychain

In the following, replace the REPO_NAME value with the natural-language name of your repository, replace REPOSITORY with the domain name (e.g. and replace USERNAME with your repository user.

credentials += {
  val Password = """.*password: "([^"]+)".*""".r
  var lines: String = ""
  val logger = new ProcessLogger {
    def info(s: => String) = {}
kevinwright /
Last active Mar 8, 2018
Scaladays 2014 slides

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

rbuckland / sealed-abstract-case-class-copy for Command messages.scala
Last active May 9, 2017
Sometimes you just want to call the copy method for the same "parameters", but not care about what underlying type it is.Because case class .copy() methods are auto generated per case class, you can't call copy on the abstract class, so this approach uses some scala foo to generate a scala Function that generates the correct magic for you.
View sealed-abstract-case-class-copy for Command messages.scala
package com.soqqo.luap.messages
import com.soqqo.luap.messages.ContextMetaData
import com.soqqo.luap.messages.NoContextMetaData
import com.soqqo.luap.messages.RegisterNewPerson
import io.straight.fw.model.Uuid
import scala.reflect.api.JavaUniverse
import scala.reflect.api
import io.straight.fw.jackson.JacksonBindingSupport._
import scala.Some
mnadel /
Last active May 18, 2018
Dropwizard + Hystrix + Hibernate
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Callable;
* A database session and transaction-aware Callable
class DatabaseCallable<T> implements Callable<T>
ryanlecompte / gist:9745983
Created Mar 24, 2014
lazily recurse files in a root directory
View gist:9745983
* Iterate all files in the given directory recursively.
* @param root the root directory to traverse
* @return an Iterator[File] of traversed files
def listFiles(root: File): Iterator[File] = {
def rec(files: List[File]): Stream[File] = {
files match {
jboner / how-akka-maps-to-eai-patterns.txt
Last active Mar 1, 2020
How Akka maps to EAI Patterns
View how-akka-maps-to-eai-patterns.txt
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
Point to Point Channel Regular Actor Communication
Event-Driven Consumer Regular Actor Receive
Message Selector Actor with Stash
ericacm / MessageSequence.scala
Last active Aug 22, 2017
Implements the Message Sequence pattern from EIP (
View MessageSequence.scala
package akka.contrib.pattern
import{Cancellable, ActorLogging, ActorRef, Actor}
import java.util
import akka.serialization.SerializationExtension
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.util.{Try, Failure, Success}
import scala.language.existentials
import java.util.UUID
You can’t perform that action at this time.