Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / golangci.yaml
Created March 28, 2023 13:45 — forked from cristaloleg/golangci.yaml
Go linters configuration, the right version.
# See: https://olegk.dev/go-linters-configuration-the-right-version
run:
# Depends on your hardware, my laptop can survive 8 threads.
concurrency: 8
# I really care about the result, so I'm fine to wait for it.
timeout: 30m
# Fail if the error was met.
@StevenACoffman
StevenACoffman / dial-pq-via-ssh.go
Created March 26, 2023 16:13 — forked from vinzenz/dial-pq-via-ssh.go
Use postgres via SSH in Golang
package main
import (
"database/sql"
"database/sql/driver"
"fmt"
"net"
"os"
"time"
@StevenACoffman
StevenACoffman / slog_console_handler.go
Last active March 26, 2023 23:09 — forked from wijayaerick/slog_console_handler.go
Example ConsoleHandler for golang.org/x/exp/slog Logger
// ConsoleHandler formats slog.Logger output in console format, a bit similar with Uber's zap
// ConsoleEncoder or Apex's CLI log
// The log format is designed to be human-readable.
//
// Performance can definitely be improved, however it's not my priority as
// this should only be used in development environment.
//
// e.g. log output:
// • ./main.go:21 Debug message {"hello":"world","!BADKEY":"bad kv"}
// ℹ ./main.go:217 Info message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}}
@StevenACoffman
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 (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"os"
@StevenACoffman
StevenACoffman / gcs-signed-url-main.go
Created June 28, 2022 14:29 — forked from pdecat/gcs-signed-url-main.go
Creating a GCS Signed URL without a Service Account Key from a GCE instance or a GKE Pod using Workload Identity
package main
import (
"context"
"flag"
"log"
"net/url"
"time"
"cloud.google.com/go/compute/metadata"
<!DOCTYPE html>
<html lang="en">
<head>
<title>D3-Dag</title>
</head>
<body>
<div id="wrapper"></div>
<script src="https://unpkg.com/d3@6.7.0"></script>
<script src="https://unpkg.com/d3-dag@0.7.0"></script>
<script src="./zchart.js"></script>
@StevenACoffman
StevenACoffman / main.go
Created May 19, 2021 00:59 — forked from salrashid123/main.go
Sample golang app that uses the Google CLoud Admin SDk to create a user and then add that user to a specific google group
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"golang.org/x/net/context"
@StevenACoffman
StevenACoffman / GitCommitEmoji.md
Created December 17, 2020 15:44 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@StevenACoffman
StevenACoffman / Search my gists.md
Created April 23, 2020 15:49 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html