Skip to content

Instantly share code, notes, and snippets.

View xrstf's full-sized avatar

Christoph Mewes xrstf

View GitHub Profile
@xrstf
xrstf / with-sound.sh
Created August 12, 2025 20:28
play sounds depending on the exit code
#!/usr/bin/env bash
set +o errexit
"${@}"
EXIT_CODE=${?}
set -o errexit
SOUNDS_DIR="$HOME/bin/sounds"
SUCCESS_SOUND="yay-6120.mp3" # https://pixabay.com/sound-effects/yay-6120/
ERROR_SOUND="error-126627.mp3" # https://pixabay.com/sound-effects/error-126627/
@xrstf
xrstf / fix.md
Created July 19, 2025 12:42
Fix Windows filesystem permissions

Language Note

/D takes the localized values for yes/no, i.e. on a German system you need to give J or N.

Do it

Open a terminal with elevated privileges. Then run:

takeown /R /D J /F .
package main
import (
"context"
"log"
"time"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
@xrstf
xrstf / git-smart-prune.sh
Created July 11, 2024 22:35
git smart pruner
#!/usr/bin/env bash
# Use this when Github bugs out and refuses to delete your
# head branches after a PR got merged, even though you
# have enabled that behaviour in your fork.
set -euo pipefail
source $(dirname "$0")/src/lib.sh
@xrstf
xrstf / dum.sh
Created March 17, 2024 23:14
Drum!
#!/usr/bin/env bash
#
# Drum!
#
# Cause the repeated "docker run --rm -it" always sounds
# like "drumit" in my head.
#
# This script makes it easy to start a container.
#
@xrstf
xrstf / build.sh
Last active January 9, 2024 13:45
Generate Kubernetes GCP cloud-controller-manager.yaml
#!/usr/bin/env bash
set -euo pipefail
# This script should be placed in the root of the cloud-controller-gcp working copy.
cd $(dirname $0)
set -x
# re-generating the bazel output takes foreeeeeeever, so be careful when you
@xrstf
xrstf / go.mod
Last active March 4, 2025 11:43
Resolve Refs in OpenAPI3 spec
module testmodule
go 1.21.0
require github.com/getkin/kin-openapi v0.120.0
require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/invopop/yaml v0.2.0 // indirect
@xrstf
xrstf / main.go
Created August 1, 2023 16:48
kcp tree with controller-runtime
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"regexp"
"strings"
@xrstf
xrstf / main.go
Created May 1, 2022 21:34
BME280 RPi Fan Controller
package main
import (
"context"
"fmt"
"log"
"os"
"os/signal"
"strconv"
"time"
@xrstf
xrstf / freshservice-without-adhd.css
Last active April 12, 2022 12:18
Fix FreshService's terribly distracting UI
/* disable spinning effects */
.flip-front, .flip-back {
animation: none !important;
}
/* disable constant product update notifications */
#quick_help_container {
display: none !important;
}