Skip to content

Instantly share code, notes, and snippets.

View jiminoc's full-sized avatar

Jim Plush jiminoc

View GitHub Profile
@jiminoc
jiminoc / boltdb.go
Created February 10, 2016 16:46
testing write/read timing with bolt.db
package main
import (
"fmt"
"log"
"flag"
"github.com/boltdb/bolt"
"time"
)
from fabric.api import task,runs_once,execute,sudo
from fabric.colors import green
# Example of how to combine the output from multiple hosts
# This is a toy example, just to show you how you can loop and combine the results together
@task
def get_stats():
import scalaz._
import scalaz.std.list._
import scalaz.syntax.monad._
import scalaz.syntax.monoid._
import scalaz.syntax.traverse.{ToFunctorOps => _, _}
class Foo[F[+_] : Monad, A, B](val execute: Foo.Request[A] => F[B], val joins: Foo.Request[A] => B => List[Foo.Request[A]])(implicit J: Foo.Join[A, B]) {
def bar: Foo[({type l[+a]=WriterT[F, Log[A, B], a]})#l, A, B] = {
type TraceW[FF[+_], +AA] = WriterT[FF, Log[A, B], AA]
override def init(config : javax.servlet.ServletConfig) {
// val names = config.getInitParameterNames
println("PRINTING CONFIG")
println(config.getInitParameter("env"))
}
class MyServletSpec extends MutableScalatraSpec {
tester.getContext.setInitParameter("env", "prod")
addServlet(classOf[MyServlet], "/*")
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
class MyTest extends MutableScalatraSpec {
addServlet(classOf[MyServlet], "/*")
"calling query should" should {
"set the status code" in {
get("/query") {
println(response.getContent)
status mustEqual 200
class MyTest extends MutableScalatraSpec {
addServlet(classOf[MyServlet], "/*")
"calling query should" should {
"set the status code" in {
get("/query") {
println(response.getContent)
status mustEqual 200
object Settings {
var field1:String = _
var field2:String = _
def load(config:Config) {
field1 = config.getString("field1")
field2 = config.getString("field2")
}
}
import zmq
context = zmq.Context()
# Socket to talk to server
print "Connecting to server"
socket = context.socket(zmq.REQ)
socket.connect ("tcp://127.0.0.1:5559")
print 'Client started'
poll = zmq.Poller()