Skip to content

Instantly share code, notes, and snippets.

[ david@samwise ] $ cat salt.sls
/etc/salt/minion:
file:
- managed
- owner: root
- group: root
- mode: 444
- source: salt://salt/files/salt-minion.config
- template: jinja
- context: {
[ david@samwise ] $ cat salt.sls
/etc/salt/minion:
file:
- managed
- owner: root
- group: root
- mode: 444
- source: salt://salt/files/salt-minion.config
- template: jinja
- context: {

Keybase proof

I hereby claim:

  • I am trane on github.
  • I am andrewk (https://keybase.io/andrewk) on keybase.
  • I have a public key whose fingerprint is 8F19 9936 E354 E9F6 0B91 042A 986F A6BA 0BEB EE51

To claim this, I am signing this object:

# case class Stuff(name: String, value: String)
# Set[Stuff]
[{"name": "a", "value": "1"}, {"name": "123", "value": "something"}, {"name": "$#!@", "value": "other"}]
# What if the key constructors are inferred?
# How do you create a Set[Stuff]?
{"a": "1", "123": "something", "$#!@": "other"}
# this is relatively easy to do via an intermediate representation
# Map[String, String] -> Set[Stuff]
def merge[A](t: (List[A], List[A]))(implicit p: (A, A) => Boolean): List[A] = {
t match {
case (as, Nil) => as
case (Nil, bs) => bs
case (a :: as, b :: bs) => if (p(a, b)) a :: merge((as, t._2))
else b :: merge((t._1, bs))
}
}
def split[A](s: List[A]): (List[A], List[A]) =
import argonaut._
import Argonaut._
case class Session0(request: Int, data: Int) extends Session[Int, Int]
case class Session1(request: Int, data: String) extends Session[Int, String]
case class Session2(request: Int, data: Session0) extends Session[Int, Session0]
implicit def Session0CodecJson: CodecJson[Session0] =
casecodec2(Session0.apply, Session0.unapply)("request", "data")
implicit def Session1CodecJson: CodecJson[Session1] =
package com.twitter.zipkin.collector
import com.twitter.conversions.time._
import com.twitter.finagle.stats.InMemoryStatsReceiver
import com.twitter.util.{Await, Future, FuturePool}
import java.util.concurrent.CountDownLatch
import org.scalatest._
/**
* Tests the BlockingItemQueue to make sure that it can store and consume elements even when adding
@trane
trane / ringAroundTheMonad.scala
Last active August 29, 2015 14:27
playing with Coyoneda+Free Monad for algebraic Rings.. and funsies
import algebra._, std.int._
import cats._, free._, Free._
trait Expr[A]
case class Const[A](term: A) extends Expr[A]
case class Add[A](e1: Expr[A], e2: Expr[A])(implicit val r: Ring[A]) extends Expr[A]
case class Sub[A](e1: Expr[A], e2: Expr[A])(implicit val r: Ring[A]) extends Expr[A]
case class Mul[A](e1: Expr[A], e2: Expr[A])(implicit val r: Ring[A]) extends Expr[A]
type Exp[A] = FreeC[Expr, A]
package com.lookout.borderpatrol.example
import java.net.InetSocketAddress
import java.nio.ByteBuffer
import com.twitter.finagle.stats.{Counter, Gauge, Stat, StatsReceiver}
import java.nio.channels.DatagramChannel
import com.twitter.io.Buf
val a = Some(1)
val b = Some(2)
val c = Some(3)
for {
x <- a
y <- b
z <- c
} yield x + y + z // Some(6)