Skip to content

Instantly share code, notes, and snippets.

View robskillington's full-sized avatar
⌨️

Rob Skillington robskillington

⌨️
View GitHub Profile
metrics:
prometheus:
handlerPath: /metrics
timerType: histogram
sanitization: prometheus
samplingRate: 1.0
extended: detailed
@robskillington
robskillington / git-author-stats.sh
Last active January 14, 2019 01:28
git log stats for author over time window with exclusion of vendor directories
#!/bin/bash
read -r -d '' REPOS << EOM
$GOPATH/src/github.com/uber-go/tally
EOM
FROM="500 weeks ago"
UNTIL="1 day ago"
curr=$(pwd)
# originally courtesy of https://gist.github.com/pkuczynski/8665367
# note: only supports 2 space indented YAML.
# additions:
# - only set environment variable if not already set
# - uppercase parsed variables to avoid case sensitivity
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
@robskillington
robskillington / counter_vector.go
Created October 18, 2017 17:15
Metrics Vector Prototype
package main
import (
"fmt"
"sync"
"sync/atomic"
)
const (
offset64 = 14695981039346656037
@robskillington
robskillington / value_pack.go
Created May 22, 2017 18:39
A value pack and unpacker
package valuepack
import (
"container/list"
"fmt"
)
type value struct {
metadata ValueMetadata
elem interface{}
@robskillington
robskillington / options.go
Last active April 25, 2016 13:13
options.go
package main
import (
"fmt"
)
type Options struct {
foo int
bar string
}
@robskillington
robskillington / gist:a674ef1069ff3f8964e4
Created October 24, 2015 17:14
Run code with Ctrl + Enter in HackerRank CodePair
javascript:(function(){ window.addEventListener('keydown', function(e) {if (e.ctrlKey && e.keyCode == 13) { $('#compilerun').click(); }}); }())
#!/usr/bin/env ruby
#vim:syntax=ruby
# Most of this borrowed from:
# https://github.com/ripienaar/monitoring-scripts/blob/master/puppet/check_puppet.rb
# A simple nagios check that should be run as root
# perhaps under the mcollective NRPE plugin and
# can check when the last run was done of puppet.
# It can also check fail counts and skip machines
# that are not enabled
@robskillington
robskillington / DictionaryExtensions
Created September 30, 2014 23:02
valueForKey for simple value or nil operation
extension Dictionary {
func valueForKey<T>(key: Key) -> T? {
if let value = self[key] as? T {
return value
} else {
return nil
}
}
}
@robskillington
robskillington / numstatall.coffee
Created September 19, 2014 16:16
numstatall - pipe the output of `git diff --numstat <commit-ish>` to get total add and deletions
#!/usr/bin/env coffee
readline = require 'readline'
rl = readline.createInterface
input: process.stdin
terminal: false
stat = {add: 0, del: 0}