Skip to content

Instantly share code, notes, and snippets.

@fmpwizard
fmpwizard / proxydb.lua
Created January 31, 2015 03:33
mysql proxy lua file database key value store with replication
--[[ $%BEGINLICENSE%$
Copyright (C) 2009 MySQL AB, 2009 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fmpwizard
fmpwizard / owlcrawler-sample.json
Created March 1, 2015 07:05
Sample json stored in CouchDB. Generated by OwlCrawler https://github.com/fmpwizard/owlcrawler
{
"_id": "aHR0cDovL2RyaGF5bGV5YmF1bWFuLmNvbS9zZXJlbmRpcGl0eV9hbmRfdGhlX3NlYXJjaF9mb3JfdHJ1ZV9zZWxmLmh0bWw=",
"_rev": "27-728ef0b7a325e8b376f6dbc374c82c38",
"url": "http://drhayleybauman.com/serendipity_and_the_search_for_true_self.html",
"html": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"\">\n <meta name=\"author\" content=\"\">\n <link rel=\"icon\" href=\"../../favicon.ico\">\n\n <title>Psychologist in Ashevillem NC - Serendipity and the Search for True Self - Dr Hayley Bauman</title>\n\n <link rel=\"stylesheet\" href=\"/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"/bootstrap/css/bootstrap-theme.min.css\">\n <link rel=\"stylesheet\" href=\"/site.css\">\n\n <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queri
[diego@Toshiba trade-recommender]$ go run main.go
Recommending cusip-50214A104 with score 5
Recommending cusip-112823109 with score 3.9143536352233377
Recommending cusip-87901BAA0 with score 3.9143536352233377
Recommending cusip-88160T107 with score 3.9143536352233377
Recommending cusip-84756N109 with score 3.9143536352233377
Recommending cusip-527298AY9 with score 3.9143536352233377
Recommending cusip-69360J719 with score 3.9143536352233377
Recommending cusip-165167CN5 with score 3.9143536352233377
Recommending cusip-257454108 with score 3.9143536352233377
## Fresh git clone && godep restore
$ time go build -x -tags=fetcherSched -o owlcrawler-scheduler owlcrawler_scheduler.go
WORK=/tmp/go-build789249122
mkdir -p $WORK/github.com/fmpwizard/owlcrawler/couchdb/_obj/
mkdir -p $WORK/github.com/fmpwizard/owlcrawler/
cd /home/diego/work/golang/src/github.com/fmpwizard/owlcrawler/couchdb
/usr/local/go/pkg/tool/linux_amd64/6g -o $WORK/github.com/fmpwizard/owlcrawler/couchdb.a -trimpath $WORK -p github.com/fmpwizard/owlcrawler/couchdb -complete -D _/home/diego/work/golang/src/github.com/fmpwizard/owlcrawler/couchdb -I $WORK -I /home/diego/work/golang/pkg/linux_amd64 -pack ./couchdb.go
mkdir -p $WORK/github.com/gogo/protobuf/proto/_obj/
mkdir -p $WORK/github.com/gogo/protobuf/

Keybase proof

I hereby claim:

  • I am fmpwizard on github.
  • I am fmpwizard (https://keybase.io/fmpwizard) on keybase.
  • I have a public key whose fingerprint is 8B2D 5221 E5BF E79A DD36 153B 4B47 C594 B0B6 124D

To claim this, I am signing this object:

@fmpwizard
fmpwizard / Overview.scala
Created December 17, 2010 03:53
Show a list of test names and their result status (PASS or FAIL)
package code {
package snippet {
import code.model.{AutomatedTests}
import _root_.scala.xml.{NodeSeq, Text}
import _root_.net.liftweb._
import util._
import common.Logger
@fmpwizard
fmpwizard / gist:833968
Created February 18, 2011 16:50
Add a named cometactor using Lift
object PutCometOnPage {
def render(xhtml: NodeSeq): NodeSeq = {
val id= "browser" + versionString
debug("Using CometActor with name: %s".format(id))
for (sess <- S.session) sess.sendCometActorMessage(
"BrowserDetails", Full(id), versionString
)
<lift:comet type="BrowserDetails" name={id}>{xhtml}</lift:comet>
}
}
@fmpwizard
fmpwizard / gist:834021
Created February 18, 2011 17:19
REST API
/**
* listenerFor(srvmgrVersion) returns a DispatcherActor that in turn
* will send the CellToUpdate clas class to the comet actors that are
* displaying info about the version we got json data for
*/
listenerFor(srvmgrVersion) match {
case a: LiftActor => a ! CellToUpdate(
testName, browser, srvmgrVersion, testResult, cellNotes
)
case _ => info("No actor to send an update")
@fmpwizard
fmpwizard / gist:833981
Created February 18, 2011 16:57
MyListeners object
object MyListeners extends Logger{
private var listeners: Map[String, LiftActor] = Map()
def listenerFor(str: String): LiftActor = synchronized {
listeners.get(str) match {
case Some(a) => info("Our map is %s".format(listeners)); a
case None => {
val ret = new DispatcherActor(str)
listeners += str -> ret
info("Our map is %s".format(listeners))
override def lowPriority: PartialFunction[Any,Unit] = {
case CellToUpdate(index, rowName, version, cssClass, cellNotes) => {
info("Comet Actor %s will do a partial update".format(this))
info("[API]: Updating BrowserTestResults for version: %s".format(version))
showingVersion = version
/**
* each td in the html grid has an id that is
* [0-9] + browser name
* I use this to uniquely identify which cell to update