Skip to content

Instantly share code, notes, and snippets.

View wyattjoh's full-sized avatar
🏳️‍🌈

Wyatt Johnson wyattjoh

🏳️‍🌈
View GitHub Profile
package main
import (
"bufio"
"os"
"strings"
)
// FileConfigLoader describes a file based loader which loads the configuration
// from a file listed.
@wyattjoh
wyattjoh / prometheus.py
Last active September 19, 2016 15:12
Datadog Prometheus Check
from checks import AgentCheck
import re
import requests
rx0 = re.compile(r'^# TYPE \S+ (\S+)$')
rx1 = re.compile(r'(\w+)(?:{(\S+)})? ([-+]?\d*\.\d+|\d+)')
rx2 = re.compile(r'(\w+)="(\S*?)",?')
class PrometheusCheck(AgentCheck):
@wyattjoh
wyattjoh / caddy.conf
Last active April 18, 2018 12:39
Caddy Supervisord Setup
[program:caddy]
command=/usr/bin/caddy -conf="/etc/caddy/Caddyfile"
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/caddy.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/caddy_error.log
#!/bin/sh
# Copyright 2012 The Go Authors, 2015 Wyatt Johnson. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
@wyattjoh
wyattjoh / docs.sh
Last active January 20, 2016 17:56
#!/bin/bash
# list all the packges, trim out the vendor directory and any main packages,
# then strip off the package name
PACKAGES="$(go list -f "{{.Name}}:{{.ImportPath}}" ./... | grep -v -E "main:|vendor/" | cut -d ":" -f 2)"
# loop over all packages generating all their documentation
for PACKAGE in $PACKAGES
do
package main
import (
"log"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
)
type Image struct {
package main
import (
"bufio"
"fmt"
"io"
"log"
"net"
"os"
"strings"
@wyattjoh
wyattjoh / keybase.md
Created April 14, 2015 15:40
keybase.md

Keybase proof

I hereby claim:

  • I am wyattjoh on github.
  • I am wyattjoh (https://keybase.io/wyattjoh) on keybase.
  • I have a public key whose fingerprint is FC11 AA24 1AED 0767 4501 40F1 37FC 0A49 FC15 5AD4

To claim this, I am signing this object:

[
{
"id": "123",
"name": "Blue"
},
{
"id": "234",
"name": "Red"
}
]
global
maxconn 2048
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon