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"
)
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]
// check to see if we've already sent this alert recently
func alreadySentRecently(res reservation) bool {
timeNow := time.Now().UTC()
mapKey := res.App + res.Component
waitForNotifyTime := time.Duration(cfg.Main.HoursBetweenAlerts) * time.Hour
_, ok := sentAlerts[mapKey]
if !ok {
sentAlerts[mapKey] = timeNow
l.info("Sending new alert for [%s/%s]", res.App, res.Component)
jim@ubuntu:~/Code/projects/go-lang-idea-plugin$ ant -f build-package.xml
Buildfile: /home/jim/Code/projects/go-lang-idea-plugin/build-package.xml
clean:
[delete] Deleting directory /home/jim/Code/projects/go-lang-idea-plugin/build
init:
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/build
[echo] Using IDEA build from: /home/jim/Downloads/idea-IC-138.2458.8
jim@ubuntu:~/Code/projects/go-lang-idea-plugin$ ant -f build-package.xml
Buildfile: /home/jim/Code/projects/go-lang-idea-plugin/build-package.xml
clean:
[delete] Deleting directory /home/jim/Code/projects/go-lang-idea-plugin/build
init:
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/build
[mkdir] Created dir: /home/jim/Code/projects/go-lang-idea-plugin/dist
[echo] Using IDEA build from: /home/jim/Downloads/idea-IC-135.1289
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():
jim@localhost: ~/temp
➺ fab stats -H 100.100.1.113,100.100.2.220 -P -f fab-count.py
[100.100.1.113] Executing task 'stats'
[100.100.1.113] Executing task 'get_stats'
[100.100.2.220] Executing task 'get_stats'
[100.100.2.220] sudo: lsof -i -sTCP:ESTABLISHED | wc -l
[100.100.1.113] sudo: lsof -i -sTCP:ESTABLISHED | wc -l
[100.100.2.220] out: 36
[100.100.2.220] out:
override def next : Option[Job] = {
log.info("I FINISHED PROCESSING!")
val results = Tsv(outputdir).readAtSubmitter[String].foreach(line => {
log.info("LINE: " + line)
})
None
}
override def next : Option[Job] = {
println("I FINISHED PROCESSING!")
None
}
override def init(config : javax.servlet.ServletConfig) {
// val names = config.getInitParameterNames
println("PRINTING CONFIG")
println(config.getInitParameter("env"))
}