Skip to content

Instantly share code, notes, and snippets.

View pboothe's full-sized avatar
Always busy, always online, always ready for a cup of coffee

Peter Boothe pboothe

Always busy, always online, always ready for a cup of coffee
View GitHub Profile
package creds
func NewProvider() (Provider) {
}
type Provider interface {
FindCredentials() (Creds)
}
GeoIP_country_continent = [
"--", "AS", "EU", "EU", "AS", "AS", "NA", "NA", "EU", "AS", "NA", "AF",
"AN", "SA", "OC", "EU", "OC", "NA", "AS", "EU", "NA", "AS", "EU", "AF",
"EU", "AS", "AF", "AF", "NA", "AS", "SA", "SA", "NA", "AS", "AN", "AF",
"EU", "NA", "NA", "AS", "AF", "AF", "AF", "EU", "AF", "OC", "SA", "AF",
"AS", "SA", "NA", "NA", "AF", "AS", "AS", "EU", "EU", "AF", "EU", "NA",
"NA", "AF", "SA", "EU", "AF", "AF", "AF", "EU", "AF", "EU", "OC", "SA",
"OC", "EU", "EU", "NA", "AF", "EU", "NA", "AS", "SA", "AF", "EU", "NA",
"AF", "AF", "NA", "AF", "EU", "AN", "NA", "OC", "AF", "SA", "AS", "AN",
"NA", "EU", "NA", "EU", "AS", "EU", "AS", "AS", "AS", "AS", "AS", "EU",
run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m
# Exit code when at least one issue was found.
# Default: 1
issues-exit-code: 1
# Include test files or not.
# Default: true
tests: false
@pboothe
pboothe / clock.go
Created January 2, 2025 12:42
A clock for injecting deterministic times during unit tests and real times in production.
package timex
import "time"
type Clock interface {
Now() time.Time
Sleep(d time.Duration)
}
type SystemClock struct{}
package main
import (
"bytes"
"context"
"io"
"net/http"
"testing"
"github.com/prometheus/client_golang/prometheus/testutil/promlint"
@pboothe
pboothe / .golangci.yml
Created March 26, 2025 12:24
The golangci-lint configuration used for the Go code in Triple Pat as of 2025-03-26. Includes the reasoning behind each choice, and is set up for v2 of golangci-lint.
version: "2"
run:
issues-exit-code: 1
tests: true
output:
formats:
text:
path: stdout
print-linter-name: true
print-issued-lines: true