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"
<!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 / 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
Last active May 6, 2025 12:39 — 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

@StevenACoffman
StevenACoffman / https-during-dev.macos.sh
Last active April 19, 2024 12:09 — forked from disintegrator/https-during-dev.macos.sh
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
# test could be anything
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@StevenACoffman
StevenACoffman / gokitlogrus.go
Last active March 24, 2023 08:32 — forked from bdimcheff/gokitlogrus.go
gokit -> logrus adapter
package log
import (
"fmt"
gokitlog "github.com/go-kit/kit/log"
"github.com/sirupsen/logrus"
stackdriver "github.com/icco/logrus-stackdriver-formatter"
)
@StevenACoffman
StevenACoffman / echo_zap.go
Created October 26, 2019 23:12 — forked from ndrewnee/echo_zap.go
ZapLogger is an example of echo middleware that logs requests using logger "zap"
package echomw
import (
"time"
"github.com/labstack/echo"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
@StevenACoffman
StevenACoffman / timeout_and_tick.go
Created October 25, 2019 14:46 — forked from ngauthier/timeout_and_tick.go
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout: