Skip to content

Instantly share code, notes, and snippets.

@SmartFinn
SmartFinn / dhcp-leases-to-dns.rsc
Last active April 30, 2024 12:57
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# author SmartFinn <https://gist.github.com/SmartFinn>
:local dnsTTL "00:15:00";
:local token "$leaseServerName-$leaseActMAC";
# Normalize hostname (e.g. "-= My Phone =-" -> "My-Phone")
# - truncate length to 63 chars
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian
@jkcdarunday
jkcdarunday / switch-audio.sh
Last active April 2, 2024 07:24
A shell script that switches to the next available Pulseaudio/Pipewire Pulse output device/sink
#!/bin/bash
# Author: Jan Keith Darunday <github@jkcdarunday.mozmail.com>
# Description: A shell script that switches to the next available Pulseaudio output device/sink
# Note: This uses pactl instead of pacmd since pacmd is not available in pipewire
function get_current_sink() {
pactl info | sed -En 's/Default Sink: (.*)/\1/p'
}
SINKS=$(pactl list short sinks | grep -v easyeffects)
@aojea
aojea / KIND_Networking.md
Last active March 16, 2024 07:27
Use KIND to emulate complex network scenarios

Networking scenarios [Linux Only]

KIND runs Kubernetes cluster in Docker, and leverages Docker networking for all the network features: port mapping, IPv6, containers connectivity, etc.

Docker Networking

KIND uses a docker user defined network.

It creates a bridge named kind

@thomasdarimont
thomasdarimont / readme.md
Last active March 15, 2024 08:56
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64
@kimbo
kimbo / scrape-doh-providers.py
Last active March 10, 2024 20:49
Scrape DoH provider URLs from cURL's wiki page (see https://raw.githubusercontent.com/wiki/curl/curl/DNS-over-HTTPS)
#!/usr/bin/env python
#
# Scrape Doh provider URLs from Curl's DNS-over-HTTPS wiki (https://raw.githubusercontent.com/wiki/curl/curl/DNS-over-HTTPS).
#
# Example usage: ./scrape_doh_providers.py '"{} - {}".format(o["url"], o["name"])'
#
import argparse
import re
import urllib.request
@aojea
aojea / README.md
Last active March 2, 2024 13:35
upgrade kind kubernetes cluster