Skip to content

Instantly share code, notes, and snippets.

View Skarlso's full-sized avatar
🚫
At KubeCon Utah

Gergely Brautigam Skarlso

🚫
At KubeCon Utah
View GitHub Profile
@Skarlso
Skarlso / bulk-delete-packages.sh
Created October 22, 2024 07:58
Delete packages for a user using a glob
#!/bin/bash
set -e
# Variables
OWNER=$1 # Replace with your GitHub username or organization name
PACKAGE_GLOB=$2 # Glob pattern for package names passed as an argument (e.g., "package*" to match all)
# Function to delete a package version
delete_package_version() {
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: capi-quickstart
namespace: default
spec:
clusterNetwork:
pods:
cidrBlocks:
- 192.168.0.0/16
@Skarlso
Skarlso / main.go
Created September 11, 2023 12:03
Downloading helm chart
package main
import (
"fmt"
"log"
"os"
"github.com/open-component-model/ocm/pkg/contexts/ocm"
"github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc"
metav1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1"
# Title above here
# Use 50 characters maximum.
# Do not use a sentence-ending period.
#
# Prefixes:
#
# bump = bump version
# chore(subtype) = chore
# docs = documentation
# feat = new feature
.....................................................................................................
.....................................................................................................
.....................................................................................................
.....................................................................................................
.....................................................................................................
.....................................................................................................
.....................................................................................................
...........................................................................iiiiijjjj.................
..........................................................................ii.......j.................
..........................................................................i........j.................
2022/07/31 14:56:21 http: panic serving 10.244.0.1:2734: runtime error: invalid memory address or nil pointer dereference
goroutine 1836 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1825 +0xbf
panic({0x2229e20, 0x3f9c090})
/usr/local/go/src/runtime/panic.go:844 +0x258
encoding/json.(*encodeState).marshal.func1()
/usr/local/go/src/encoding/json/encode.go:328 +0x6e
panic({0x2229e20, 0x3f9c090})
/usr/local/go/src/runtime/panic.go:838 +0x207
@Skarlso
Skarlso / output.txt
Last active July 29, 2022 13:54
Create Pod and get logs of the running container
go run main.go
creating pod, then creating a container...
pod created... waiting for it to be running
Pod status: Pending
Pod status: Pending
Pod status: Running
watcher stopped
Got container logs: /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"time"
@Skarlso
Skarlso / local-kind-cluster.sh
Created January 22, 2022 15:21
Local test kind cluster with registry
#!/bin/bash
set -o errexit
create() {
set +e
kind get clusters | grep "${NAME}"
exitCode=$?
set -e
if [ $exitCode -eq "0" ]; then
echo "kind cluster already exists"
@Skarlso
Skarlso / graph.go
Last active December 31, 2021 10:07
Generic Graph Implementation
// BFS returns the shortest path between two nodes,
// as a list of edges. Eq is used to determine parity between nodes. The Eq functions makes
// this function generic enough instead of trying to shoehorn some other `comparable` type
// into `Node`.
// Note, this would be much more user-friendly, if it would return a map of `cameFrom`s which
// then could be traversed back to find the shortest path, rather than returning a slice of
// edges which is difficult to follow back.
func (g *Graph[Node, Edge]) BFS(from, to Node, eq func(self, other Node) bool) []Edge {
queue := []Node{from}
path := make([]Edge, 0)