Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
graph Doskvol {
subgraph legend {
color = black;
label = "Legend";
"Tier I"--"Tier II"--"Tier III"--"Tier IV"--"Tier V"
leophys / godoc.zsh
Last active August 28, 2023 05:16
Optionally colored and fuzzy findable godoc
### colored and fuzzy go doc
if which bat > /dev/null; then
function _godoc() {
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
go doc ${@} | bat -p -l md
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
wijayaerick / slog_console_handler.go
Last active November 25, 2023 06:40
Example ConsoleHandler for Logger
// ConsoleHandler formats slog.Logger output in console format, a bit similar with Uber's zap ConsoleEncoder
// The log format is designed to be human-readable.
// Performance can definitely be improved, however it's not in my priority as
// this should only be used in development environment.
// e.g. log output:
// 2022-11-24T11:40:20+08:00 DEBUG ./main.go:162 Debug message {"hello":"world","!BADKEY":"bad kv"}
// 2022-11-24T11:40:20+08:00 INFO ./main.go:167 Info message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}}
// 2022-11-24T11:40:20+08:00 WARN ./main.go:168 Warn message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}}
iNetJoJo / workload.go
Created October 31, 2022 12:46
cool util for starting alot of gorutines with error handling
package workload
import (
type Worker func() error
StevenACoffman / main.go
Created September 2, 2022 18:26 — forked from pteich/main.go
Example for using go's sync.errgroup together with signal detection signal.Notify to stop all running goroutines
package main
import (
preslavrachev / do.go
Last active August 4, 2022 13:15
Do is an experiment in mimicking the Result type (known from languages like Rust and Haskell). The idea is to minimize the amount of error checking and let the developer focus on the happy path, without undermining the power of Go's errors. The code below requires Go 1.18+, as it makes use of generic type parameters.
package do
type Void struct{}
type Result[T any] interface {
Unwrap() (T, error)
type defaultResult[T any] struct {
val T
StevenACoffman /
Created October 3, 2021 15:49

After reading Rouan Wilsenach’s article on Ship / Show / Ask, I realized that when creating a pull request, I’m thinking about:

  • How can I confidently get my code out of the door?
  • Will my changes pass the automated CI checks?
  • Will my changes pass a self-review? I.e. would I approve my own PR?
  • Will my colleagues be able to give me good feedback?

So this gives us 7 types of pull-request:

No Pull Request / Ship
StevenACoffman /
Created October 3, 2021 00:09
Get Source code from Stack overflow
rafi /
Last active August 21, 2023 23:55
Keycloak and oauth2-proxy using k3d & ngrok:

K3d and Keycloak


Ensure docker, k3d and ngrok are installed.

brew update
brew install --cask docker ngrok
brew install k3d