Skip to content

Instantly share code, notes, and snippets.

View arosien's full-sized avatar

Adam Rosien arosien

View GitHub Profile
{
"basePath": "http://localhost:8080",
"position": 0,
"authorizations": [],
"models": {
"Pattern": {
"properties": [
{
"_2": {
"allowableValues": {},
import org.scalacheck._
import org.scalacheck.Arbitrary._
import scalaz.scalacheck.ScalazProperties._
object FooSpec extends Properties("Foo") {
class Foo(value: String)
implicit val FooEqual: Equal[Foo] = Equal.equalRef
implicit val FooArb: Arbitrary[Foo] = Arbitrary(Gen.identifier map (new Foo(_)))
checkAll(equal.laws[Foo]) // passes

Real Ultimate Power for Services

For when just having a service that does something isn't enough.

Runtime Power

For answering the question: what the hell is going on?

Request Tracing

shared identifier across requests allows visibility of the entire execution graph

When services serve requests, they often require making further requests to other services in order to produce their response...

@arosien
arosien / bloom.scala
Created April 2, 2015 19:24
WIP Bloom collections via Spire Lattices
package net.rosien.lattice
import scalaz._
import scalaz.syntax.order._
/* http://db.cs.berkeley.edu/papers/UCB-lattice-tr.pdf */
sealed trait LValue[A] {
def value: A
}
// JsonFormat is from spray-json, reproduced here
trait JsonFormat[A] {
def write(a: A): JsValue
def read(js: JsValue): A
}
implicit class FormatInvariantFunctor[A](format: JsonFormat[A]) {
def xmap[B](f: A => B, g: B => A): JsonFormat[B] =
new JsonFormat[B] {
def write(b: B): JsValue = format.write(g(b))
rrdtool create redirector.rrd --step 60 DS:registrations:COUNTER:600:U:U RRA:AVERAGE:0.5:1:3000 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797
package asr.nestedsets;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.SortedSet;
h1. Using Norbert for cluster management
h2. What is a cluster?
In Norbert parlance, a cluster is a set of Nodes with a given name. A Node is a host, port and list of partitions for which the node can handle requests. The set of member Nodes in a given cluster is centrally stored in ZooKeeper. Additionally, a Node can advertise that it is available to process requests. In general, a Node can be in one of three states:
[arosien: Most people don't know the word 'parlance'. I'd say 'In Norbert, a cluster...'.]
[arosien: So Nodes have a name, and Nodes with the same name are a Cluster? It may be easier to understand if a Node has a clusterName and all nodes with the same clusterName are the de-facto Cluster.]
[arosien: What are partitions? How are they represented? What's an example of a partition?]
[arosien: I'd use bullet points for the properties of a Node.]
@arosien
arosien / gist:1249511
Created September 28, 2011 23:05
wierd akka fsm matching problem
import org.specs2.mutable.Specification
import akka.actor.Actor
import akka.actor.FSM
import akka.testkit.TestFSMRef
import org.specs2.specification.Scope
class AkkaFSMEventSpec extends Specification {
case class A(msg: String)
@arosien
arosien / gist:1515399
Created December 23, 2011 21:27
reader monad with kleisli and tuple/untupling
import scalaz._
import Scalaz._
case class Foo(value: String)
case class Bar(value: String)
case class Baz(foo: Foo, bar: Bar)
type E = Map[String, String]
type K[M[_],A,B] = Kleisli[M,A,B]