Skip to content

Instantly share code, notes, and snippets.

@thediveo
thediveo / custom.css
Created February 28, 2025 19:37
Dockerizable filemanager noauth setup
// branding/custom.css
.ace_editor {
font-size: 100% !important;
}
@thediveo
thediveo / duckypadpro-rgb-dial.txt
Created February 19, 2025 22:01
RGB Chooser for DuckyPad Pro
// RGB Chooser for DuckyPad Pro
// DuckyPad Pro: https://github.com/dekuNukem/duckyPad-Pro/
VAR $r = 0
VAR $g = 0
VAR $b = 0
VAR $rselect = 18
VAR $gselect = 19
VAR $bselect = 20
@thediveo
thediveo / pype.py
Created December 21, 2023 19:50
Detecting the reader of a named pipe disconnecting (or not, I'm looking at you, macOS)
import os
import tempfile
import atexit
import shutil
import time
import select
def writer(fifoname):
print("writer: start...")
w = open(fifoname, 'w')
@thediveo
thediveo / !DockerGoWorkspaces.md
Last active September 27, 2024 01:04
Dynamic Go workspace Docker build contexts

(gist title)

This gist assumes the following directory structure:

  • foobar-ws/
    • bar/
      • bar.go
      • go.mod
    • foo/
  • foo.go
@thediveo
thediveo / !netlinknetns
Last active April 29, 2023 20:47
Discovering the network namespace an (RT)NETLINK socket connects to
gist title
@thediveo
thediveo / nsfdref.py
Created January 9, 2020 20:05
Demonstrates keeping namespaces alive by keeping an open fd for them, as well as how the discovery powers of "lsns" and "lsuserns" differ.
# nsfdref.py
#
# Creates two network namespaces, referencing the first one by fd, and
# showing the output of "lsns" versus "lsuserns". "lsuserns" is able
# to discover the first network namespace from the fd which keeps the
# namespace alive.
#
# Requires these Python3 packages:
# - pip3 install unshare
# - pip3 install python-prctl
@thediveo
thediveo / inversehierarchy.sh
Last active December 23, 2019 08:30
Can child(!) PID namespaces be owned by parent(!) user namespaces?
#!/bin/bash
# Test the hypothesis that PID namespace hierarchy cannot "run on reverse" to
# the user namespace hierarchy. In particular, a PID child namespace cannot be
# owned by a parent user namespace. However, a PID namespace can be a child of a
# PID namespace owned by a parent user namespace.
echo "trying to create a child PID namespace which is owned by a parent user namespace..."
NSTEXTREPR='([[:alpha:]]+):\[([[:digit:]]+)\]'
SECTION="--------------------"
@thediveo
thediveo / runwithkp.sh
Created July 12, 2019 18:29
Starts local Kubernetes API proxy and creates a suitable context, runs application, then stops the proxy after the application has finished.
#!/bin/bash
CONTEXT="minikube"
PROXYCONTEXT="proxykube"
function cleanup {
kubectl config delete-context $PROXYCONTEXT 2>/dev/null
kubectl config delete-cluster $PROXYCONTEXT 2>/dev/null
}
@thediveo
thediveo / transcode-raw-screenrecording.sh
Created May 16, 2019 19:45
Correctly transcode in-device Android screen recordings (which were created by ffmpeg), so that they can be correctly edited and processed further during post. In particular, enforces a fixed framerate and the correct color coefficients.
#!/bin/bash
# Correctly transcode in-device screen recordings from Android, so they
# do not cause all kinds of mishaps later down the editing and rendering
# pipeline. In particular, enforces a fixed framerate to avoid problems
# with widely varying dynamic frame rates, which can go from anywhere
# a frame every 10s of seconds to 100fps or so. Additionally, we
# enforce the correct color coefficients for the transcoding to avoid
# video tools to guesstimate completely nonsense transformation -- ffmpeg,
# I'm looking at you here.
shopt -s extglob
@thediveo
thediveo / registry.sh
Created April 6, 2019 15:56
Operate a host-local Docker container registry for kubeadm-dind clusters.
#!/bin/bash
# TheDiveO
function log {
local OPTS=""
if [[ "$1" = "-n" ]]; then
shift; OPTS+="-n"
fi
MSG="$1"
shift