Skip to content

Instantly share code, notes, and snippets.

Some Dude ericacm

Block or report user

Report or block ericacm

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
View json.rb
#!/usr/bin/ruby
require 'json'
DESC_HEAD = /^\.([^\.\[]+)/
DEREF_HEAD = /^\[(\d+)\]/
def usage
$stderr.puts <<USAGE
usage: json descriptor
@aphyr
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._
View sbt-osx-keychain.md

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. repo1.maven.org) and replace USERNAME with your repository user.

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

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
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
mnadel / DatabaseCallable.java
Last active May 18, 2018
Dropwizard + Hystrix + Hibernate
View DatabaseCallable.java
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
ryanlecompte / gist:9745983
Created Mar 24, 2014
lazily recurse files in a root directory
View gist:9745983
import java.io.File
/**
* 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
jboner / how-akka-maps-to-eai-patterns.txt
Last active Sep 5, 2019
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.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
@ericacm
ericacm / MessageSequence.scala
Last active Aug 22, 2017
Implements the Message Sequence pattern from EIP (http://www.eaipatterns.com/MessageSequence.html)
View MessageSequence.scala
package akka.contrib.pattern
import akka.actor.{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.