Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@vrabbi
vrabbi / README.md
Last active June 12, 2025 17:54
Crossplane and Backstage POC

This works with backstage 1.33

Plugin overviews

There are 2 plugins in this POC:

  1. Kubernetes Ingestor - this plugin is a catalog entity provider which creates catalog entities directly from kubernetes resources. it has the ability to ingest by default all standard k8s workload types, allows supplying custom GVKs, and has the ability to auto-ingest all crossplane claims automatically as components. There are numerous annotations which can be put on the kubernetes workloads to influence the creation of the component in backstage. It also supports creating backstage templates and registers them in the catalog for every XRD in your cluster for the Claim resource type. currently this supports adding via a PR to a GitHub repo or providing a download link to the generated yaml without pushing to git.
  2. Crossplane Resource Frontend - this is a frontend plugin which provides visibility into the crossplane claim, composite resource and managed resources associated with a component. This relies heavily on system
@salrashid123
salrashid123 / workload_federation_dwd.go
Last active January 30, 2025 01:24
Access GCP and workspace APIs using GCP Workload Identity Federation usign Domain Delegation
package main
import (
"fmt"
"log"
"context"
"cloud.google.com/go/storage"
@0xdevalias
0xdevalias / converting-json-to-openapi-swagger-spec.md
Created June 2, 2023 01:09
Exploring tools that allow converting a JSON response automagically into an OpenAPI / Swagger spec.

Converting JSON to OpenAPI / Swagger spec

Exploring tools that allow converting a JSON response automagically into an OpenAPI / Swagger spec.

Test JSON Response

{
    "accounts": {
        "default": {
graph Doskvol {
concentrate=true;
edge[color=forestgreen]
subgraph legend {
color = black;
label = "Legend";
"Tier I"--"Tier II"--"Tier III"--"Tier IV"--"Tier V"
}
@tp-hk
tp-hk / Clean Architecture.md
Last active April 12, 2025 21:38
Tech Books Summary

Clean Architecture (2022 H2)

Good architecture:

  • good architecture = allow changes w/ flexibility + delay decision

Business rules:

  • Entities: pure; small sets of critical business rules. Should be most independent & reusable. Can be an object with methods or data structures & functions
  • Use case: not as pure; is an object. contains data elements & operations.
  • Entities are lower level than (don’t depend on) use cases since use cases are closer to inputs/outputs.
  • Entities & use cases are 2 layers
@kostyay
kostyay / service-account-admin-sdk.go
Last active May 5, 2025 14:49
[Golang] Use google admin sdk from service account impersonating as user #adminsdk
// It took me few hours how to get this to work
// Have a service account in GCP which wanted to use Admin SDK with Google Workspace
// The service account needs to have the following role: `roles/iam.serviceAccountTokenCreator`
// You need to create a domain wide delegation for the service account client id
import (
"google.golang.org/api/impersonate"
"google.golang.org/api/option"
"context"
)
@leophys
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
else
@wijayaerick
wijayaerick / slog_console_handler.go
Last active July 27, 2024 08:05
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
// 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
iNetJoJo / workload.go
Created October 31, 2022 12:46
cool util for starting alot of gorutines with error handling
package workload
import (
"context"
"golang.org/x/sync/errgroup"
"time"
)
type Worker func() error
@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"