Skip to content

Instantly share code, notes, and snippets.

@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 / letsencrypt.md
Last active April 18, 2023 05:01
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:

@xrstf
xrstf / PasswordStrength.php
Created June 13, 2012 21:36
Wolfram|Alpha password strength calculation in PHP 5.2+
<?php
/**
* Wolfram|Alpha password strength calculation
*
* @see https://gist.github.com/1514997 (original source this class is based on)
* @see http://www.wolframalpha.com/input/?i=password+strength+for+god
* @see https://github.com/rchouinard/phpass
* @license MIT
*/
@xrstf
xrstf / setup.md
Last active October 3, 2022 13:30
Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 Setup

Info

This guide sets up a non-clustered Nutch crawler, which stores its data via HBase. We will not learn how to setup Hadoop et al., but just the bare minimum to crawl and index websites on a single machine.

Terms

  • Nutch - the crawler (fetches and parses websites)
  • HBase - filesystem storage for Nutch (Hadoop component, basically)
@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/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target