Skip to content

Instantly share code, notes, and snippets.

View cstockton's full-sized avatar

Chris Stockton cstockton

View GitHub Profile
@cstockton
cstockton / gist:4212207
Created December 5, 2012 04:19
Simple kue cleanup script
// this is a simple log action
function QueueActionLog(message) {
this.message = message || 'QueueActionLog :: got a action for job id(%s)';
this.apply = function(job) {
console.log(util.format(this.message, job.id));
return true;
};
}
#!/bin/bash
echo "If you're reading this I hope you are in a vm or I probably just saved your ass!"
exit
## Warning:
#
# This script could break the crap out of your machine, it's only for illustration. That
# said- how you manage your data is your business, but if your unsure of best practices I'll
# share the one rule I have that is unwavering:
// Package internal implements testing instrumentation for the wait package and
// serves as a staging area for experimental Waiter implementations.
package internal
import (
"fmt"
"log"
"path/filepath"
"runtime"
"strings"
package server
import (
"fmt"
"testing"
"time"
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/config"
"github.com/osrg/gobgp/packet/bgp"
// https://github.com/osrg/gobgp/pull/1334
package t0
import (
"bytes"
"fmt"
"net"
"testing"
)
package conv
// Example of fastest possible atoi in Go aside from ASM, the unsightly
// parenthesis and grouping is because I wrote this before the bounds check
// elimination improvements so having them all on one was much faster I'm not
// sure if this is still necessary, at least in the switch statement version I
// think the length check should be enough.
//
// FastInt64-24 5000000 293 ns/op
// Switch64-24 5000000 218 ns/op
package main
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/julienschmidt/httprouter"
)
//go:generate -command handy -o ./main.handy.go ./main.go
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"time"
package main
import (
"context"
"fmt"
"math/rand"
"time"
)
func NaiveRetry(attempts int, sleep time.Duration, fn func() error) error {
package main
/*
package unibox
import (
"bytes"
"strings"
"unicode/utf8"
)