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 / DevKube.yaml
Created May 14, 2017 20:20
How we might make devgun more generic and useful for others.
apiVersion: v1
downloads:
- name: "helm"
url: "https://storage.googleapis.com/kubernetes-helm/helm-v2.2.3-{{.Local.OS}}-amd64.tar.gz"
cmds:
- "tar zxpf {{.SrcFile}} -C {{.TempDir}}"
- "cp -f {{.TempDir}}/{{.Local.OS}}-amd64/helm {{.BinDir}}"
- name: "rocker"
url: "https://github.com/grammarly/rocker/releases/download/%s/rocker_%s_amd64.tar.gz"
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
package tagger
import (
"time"
"fmt"
"github.com/mailgun/sandra"
"github.com/mailgun/scout/config"
"github.com/mailgun/scout/model/types"
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() {
@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
// 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"}) {
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
package main
import (
"fmt"
"log"
"os"
"time"
etcd "github.com/coreos/etcd/client"
"github.com/thrawn01/args"

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:

@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"