Skip to content

Instantly share code, notes, and snippets.

@uhthomas
uhthomas / deduplicate_slice.go
Last active November 8, 2024 14:43
deduplicate go slice
func DeduplicateSlice[T cmp.Ordered](in []T) []T {
slices.Sort(in)
out := in[:0]
for i := 0; i < len(in); i++ {
var n int
for j := i + 1; j < len(in); j++ {
if in[i] != in[j] {
break
@uhthomas
uhthomas / README.md
Last active January 8, 2025 13:52
Recover rook ceph after catastrophic monitor store loss

Recover rook ceph after catastrophic monitor store loss

The OS SSD died on my kubernetes/rook/ceph cluster which left the cluster with catastrophic monitor store loss. The process for recovering from just OSDs is not well documented, especially not when combined with rook and cephfs with multiple data pools. The last of which may never have been done before.

I am writing this document after the fact, so I may be missing some things, or they may be out of order. I will try my best though as I think it could be helpful.

@uhthomas
uhthomas / main.go
Last active August 27, 2024 22:49
improved docker distrubtion invalid repository finder and deleter
package main
import (
"context"
"flag"
"fmt"
"log"
"path"
"github.com/aws/aws-sdk-go/aws"
{
"__inputs": [
{
"name": "DS_VICTORIAMETRICS",
"label": "VictoriaMetrics",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
// You can edit this code!
// Click here and start typing.
package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"strings"
)
spec:
retentionPeriod: 2y
replicationFactor: 2
vmselect:
replicaCount: 3
securityContext:
runAsUser: 1000
runAsGroup: 3000
runAsNonRoot: true
fsGroup: 2000
Computer Information:
Manufacturer: Gigabyte Technology Co., Ltd.
Model: X570 AORUS ELITE
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 9 3950X 16-Core Processor
CPU Family: 0x17
diff --git a/go/tools/builders/nogo_main.go b/go/tools/builders/nogo_main.go
index 631cf0e5..29722f35 100644
--- a/go/tools/builders/nogo_main.go
+++ b/go/tools/builders/nogo_main.go
@@ -26,18 +26,23 @@ import (
"flag"
"fmt"
"go/ast"
+ "go/format"
"go/parser"
{
"checksum": "c9e5131ae990b727ccac9092dd45e167bd9248752177a2e4ca035cf723fa43eb",
"crates": {
"cfg-if 1.0.0": {
"name": "cfg-if",
"version": "1.0.0",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/cfg-if/1.0.0/download",
"sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"