Skip to content

Instantly share code, notes, and snippets.

@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 September 22, 2023 16:26
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;
}
@xrstf
xrstf / README-setup-tunnel-as-systemd-service.md
Created November 11, 2017 09:52 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@xrstf
xrstf / letsencrypt.md
Last active October 30, 2024 07:03
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

Keybase proof

I hereby claim:

  • I am xrstf on github.
  • I am xrstf (https://keybase.io/xrstf) on keybase.
  • I have a public key whose fingerprint is C642 F564 4F2E 15B1 7B90 1AB7 3CB6 C042 20FF 1254

To claim this, I am signing this object: