Skip to content

Instantly share code, notes, and snippets.

View thrawn01's full-sized avatar
🎯
Focusing

Derrick J. Wippler thrawn01

🎯
Focusing
View GitHub Profile
@thrawn01
thrawn01 / LICENSE.txt
Created August 1, 2011 17:53 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@thrawn01
thrawn01 / gist:1753234
Created February 6, 2012 16:47
rebinds output of the currently running shell
#! /usr/bin/env bash
echo "before exec"
TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"}
LOGFILE=test.$(date "+$TIMESTAMP_FORMAT")
# Redirect stdout/stderr to tee to write the log file
exec 1> >( tee "${LOGFILE}" ) 2>&1
echo "after exec"

Keybase proof

I hereby claim:

  • I am thrawn01 on github.
  • I am thrawn01 (https://keybase.io/thrawn01) on keybase.
  • I have a public key whose fingerprint is 6EA5 522C 9421 E0DF 5977 5DD0 EED2 42A0 8260 A66E

To claim this, I am signing this object:

package main
import (
"fmt"
"log"
"os"
"time"
etcd "github.com/coreos/etcd/client"
"github.com/thrawn01/args"
func (c *TagsAPIController) List(w http.ResponseWriter, r *http.Request, params map[string]string) (interface{}, error) {
val := NewValidator()
val.Param("limit").IsInt().Default("1000").Max(1000).Min(0)
val.Param("resolution").Allowed([]string{"month", "day", "year"})
val.Param("page").Allowed([]string{"first", "last", "next", "prev"}).Default("first")
val.Param("prefix")
val.Param("tag")
params, err := val.Validate(r)
if err != nil {
return nil, err
// I would like to see somthing like this
limit, err := validate.Int(r, "limit").Max(1000).Min(0).Default(1000).Value()
if err != nil {
return nil, err
}
// Over this
limit, err := scroll.GetIntField(r, "limit")
if err != nil {
if (err != scroll.MissingFieldError{"limit"}) {
@thrawn01
thrawn01 / tag-aggregation.md
Created November 2, 2016 20:09
TAG Aggregation Implementation

TAG Aggregation

  1. scout.Watcher will be notified whenever a tag is used by an event and track each tag in a map[].
  2. Periodically (every 10 seconds) scout.Watcher will iterate over the map[] and call the method WorkerPool.UpdateTags() which will run a job inside a go routine that runs the following
func (t *tagAggregate) Update(id types.LevelID, tag string) {

	// Retrieve the tag entry
func (t *tagAggregate) findFirstSeen(id types.LevelID, tag string) time.Time {
// Start time is always the date scout started counting tags
timeLine := types.NewTimeLine(time.Date(2014, 1, 1, 0, 0, 0, 0, time.UTC), time.Now(), types.Month)
timeStamps := timeLine.ToStringArray()
records := make(chan *counter.Record, 20)
for event := range []string{"accepted", "rejected"} {
for _, timeStamp := range timeStamps {
go func() {
package tagger
import (
"time"
"fmt"
"github.com/mailgun/sandra"
"github.com/mailgun/scout/config"
"github.com/mailgun/scout/model/types"
thrawn at Derricks-MBP in ~/mesos
$ ls ~/.minimesos/bin/minimesos
/Users/thrawn/.minimesos/bin/minimesos
thrawn at Derricks-MBP in ~/mesos
$ cat ~/.minimesos/bin/minimesos
#!/usr/bin/env bash
set -e