Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Plush jiminoc

View GitHub Profile
@jiminoc
jiminoc / boltdb.go
Created Feb 10, 2016
testing write/read timing with bolt.db
View boltdb.go
package main
import (
"fmt"
"log"
"flag"
"github.com/boltdb/bolt"
"time"
)
View sample.scala
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]
View gist:563ba071c63add787778
// 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)
View gist:53ebad87304ad31e6cb9
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
View gist:4db805c05cd9fb4e3e9e
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
View gist:ad1f45b4979a19458144
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():
View gist:e416adb483c4fdbb2f03
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:
View gist:8814973
override def next : Option[Job] = {
log.info("I FINISHED PROCESSING!")
val results = Tsv(outputdir).readAtSubmitter[String].foreach(line => {
log.info("LINE: " + line)
})
None
}
View gist:8814766
override def next : Option[Job] = {
println("I FINISHED PROCESSING!")
None
}
View gist:2957389
override def init(config : javax.servlet.ServletConfig) {
// val names = config.getInitParameterNames
println("PRINTING CONFIG")
println(config.getInitParameter("env"))
}