- Get and Start Kong and Co
git clone git@github.com:Mashape/docker-kong.git
cd docker-kong/compose
docker-compose up
- Create Kong API Route
| postgres: | |
| image: postgres:9.4 | |
| volumes: | |
| - ./init.sql:/docker-entrypoint-initdb.d/init.sql |
| import akka.actor.ActorSystem | |
| import akka.stream._ | |
| import akka.stream.scaladsl._ | |
| import scala.io.StdIn | |
| import scala.util.Random | |
| object SimplePartitionSample extends App { | |
| implicit val system = ActorSystem() |
Recursion is beautiful. As an example, let's consider this perfectly acceptable example of defining the functions even and odd in Scala, whose semantics you can guess:
def even(i: Int): Boolean = i match {
case 0 => true
case _ => odd(i - 1)
}
def odd(i: Int): Boolean = i match {
Upon completion you will have a sane, productive Haskell environment adhering to best practices.
sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev
| object Main extends App { | |
| AvoidLosingGenericType.run() | |
| AvoidMatchingOnGenericTypeParams.run() | |
| TypeableExample.run() | |
| TypeTagExample.run() | |
| } | |
| class Funky[A, B](val foo: A, val bar: B) { | |
| override def toString: String = s"Funky($foo, $bar)" | |
| } |
| trait OrderedAtLeastOnceDelivery extends AtLeastOnceDelivery { | |
| type DeliveryId = Long | |
| private case class Delivery(destination: ActorPath, deliveryIdToMessage: (DeliveryId) => Any) | |
| private val deliveryQueue = scala.collection.mutable.Queue.empty[Delivery] | |
| override def deliver(destination: ActorPath)(deliveryIdToMessage: (DeliveryId) => Any): Unit = { | |
| if (super.numberOfUnconfirmed == 0) { | |
| super.deliver(destination)(deliveryIdToMessage) |
A lot of us are interested in doing more analysis with our service logs so I thought I'd share an experiment I'm doing with Sync. The main idea is to transform the raw logs into something that'll be nice to query and generate reports with in Redshift.
Logs make their way into an S3 bucket (lets call it the 'raw' bucket) where we've got a lambda listening for new data. This lambda reads the raw heka protobuf gzipped data, does some transformation and writes a new file to a different S3 bucket (the 'processed' bucket) in a format that is redshift friendly (like json or csv). There's another lambda listening on the processed bucket that loads this data into Redshift.
| const daggy = require('daggy') | |
| const compose = (f, g) => x => f(g(x)) | |
| const id = x => x | |
| //===============Define Coyoneda========= | |
| const Coyoneda = daggy.tagged('x', 'f') | |
| Coyoneda.prototype.map = function(f) { | |
| return Coyoneda(this.x, compose(f, this.f)) | |
| } |
| object MergeSort { | |
| // recursive merge of 2 sorted lists | |
| def merge(left: List[Int], right: List[Int]): List[Int] = | |
| (left, right) match { | |
| case(left, Nil) => left | |
| case(Nil, right) => right | |
| case(leftHead :: leftTail, rightHead :: rightTail) => | |
| if (leftHead < rightHead) leftHead::merge(leftTail, right) | |
| else rightHead :: merge(left, rightTail) |