Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@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"

The New Jersey style (aka "Worse is Better") a model of software design and implementation which has the characteristics (in approximately descending order of importance):

  1. Simplicity: The design must be simple, both in implementation and interface. It is more important for the implementation to be simple than the interface. Simplicity is the most important consideration in a design.

  2. Correctness: The design should be correct in all observable aspects. It is slightly better to be simple than correct.

  3. Consistency: The design must not be overly inconsistent. Consistency can be sacrificed for simplicity in some cases, but it is better to drop those parts of the design that deal with less common circumstances than to introduce either complexity or inconsistency in the implementation.

  4. Completeness: The design must cover as many important situations as is practical. All reasonably expected cases should be covered. Completeness

<!DOCTYPE html>
<html lang="en">
<head>
<title>D3-Dag</title>
</head>
<body>
<div id="wrapper"></div>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/[email protected]"></script>
<script src="./zchart.js"></script>
@StevenACoffman
StevenACoffman / time-test.md
Created March 25, 2022 00:37
Time Tested techniques for testing time

You can use an unexported package variable pointing to the time.Now function.

var (
    timeNow   = time.Now
    timeAfter = time.After
)

// ...

type Obj struct{}

@StevenACoffman
StevenACoffman / kubernetes-gitops-secrets.md
Last active June 23, 2023 21:11
Kubernetes GitOps Secrets
@StevenACoffman
StevenACoffman / static.md
Last active January 21, 2022 19:09
Static binaries for various languages
@StevenACoffman
StevenACoffman / go-mod-update.md
Last active November 14, 2021 16:20
go mod update

If you use cgo, then a lot of go module tools get really slow per golang/go#29427

For example, this is really slow:

go list -m -u all

Maybe Instead:

@StevenACoffman
StevenACoffman / pull-request-types.md
Created October 3, 2021 15:49
pull-requests-types.md

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
StevenACoffman / stackoverflow-source.md
Created October 3, 2021 00:09
Get Source code from Stack overflow