Skip to content

Instantly share code, notes, and snippets.

Subnet Cheat Sheet

CIDR Subnet mask Wildcard mask # of IP addresses # of usable IP addresses
/32 255.255.255.255 0.0.0.0 1 1
/31 255.255.255.254 0.0.0.1 2 2*
/30 255.255.255.252 0.0.0.3 4 2
/29 255.255.255.248 0.0.0.7 8 6
/28 255.255.255.240 0.0.0.15 16 14
/27 255.255.255.224 0.0.0.31 32 30
@rmtsrc
rmtsrc / rpi-check-throttling.py
Created December 21, 2022 09:44
Check if a Raspberry Pi is being throttled due to under-voltage or over-heating
#!/usr/bin/env python
# https://github.com/HarlemSquirrel/scripts/blob/master/rpi-check-throttling.py
# https://blog.mccormack.tech/shell/2019/01/05/monitoring-raspberry-pi-power-and-thermal-issues.html
# https://github.com/raspberrypi/firmware/commit/404dfef3b364b4533f70659eafdcefa3b68cd7ae#commitcomment-31620480
# 1110000000000000010
# ||| |||_ under-voltage
# ||| ||_ currently throttled
# ||| |_ arm frequency capped
@rmtsrc
rmtsrc / _setup-tingbot-display.md
Last active January 29, 2024 11:00
Tingbot display revival

Tingbot display revival

  1. Download & install the Raspberry Pi Imager

  2. Choose Device: Raspberry Pi 3

  3. Choose OS: Raspberry Pi OS (other) > Raspberry Pi OS Lite (Legacy, 64-bit)

  4. Click Next then Edit Settings and set Username/Password or SSH key

@rmtsrc
rmtsrc / Shared-Windows-WSL-SSH-GPG-key-agents.md
Last active December 22, 2023 01:40
Automatically unlock your password protected SSH/GPG keys on Windows and WSL persisted across restarts

Shared Windows/WSL SSH/GPG key agents

By default, SSH and GPG key agents are not shared between Windows and WSL.

This means that by default if your SSH/GPG keys are encrypted with a password, you will be prompted for them each time unless you add them a key agent on both Windows and WSL.

Using win-gpg-agent allows you to add your SSH and GPG keys to the agent and also allows you to save your password, so that you don't need to enter it each time for each platform or after a restart. While keeping it secured via password encryption on disk and protected by your Windows account.

Disable Windows ssh-agent (if enabled)

@rmtsrc
rmtsrc / README.md
Last active March 31, 2024 05:38
Remove existing fingerprints from Goodix BIOS via libfprint

Install

Fixes issue with Goodix fingerprint reader when a fingerprint has already been enrolled in the BIOS, but then the OS has been removed (without un-enrolling the fingerprint first). I.e. fprintd device reported an error during enrol: Finger is too similar to another, try use a different finger

sudo pamac install base-devel meson gobject-introspection gtk-doc

git clone https://gitlab.freedesktop.org/libfprint/libfprint.git

cd libfprint
@rmtsrc
rmtsrc / git-update-all-emails.sh
Created January 30, 2021 15:27
Update all old email addresses in commits from all existing GitHub repos
# Requires `git filter-repo` https://github.com/newren/git-filter-repo
mkdir tmp && cd tmp
export USERNAME="github-username"
export TOKEN="github-token-with-repo-access"
curl -u "$USERNAME:$TOKEN" "https://api.github.com/search/repositories?q=user:$USERNAME" |
grep -e 'ssh_url*' |
cut -d \" -f 4 |
@rmtsrc
rmtsrc / Dockerfile
Last active August 22, 2021 16:43 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# use bash so we can source files
SHELL ["/bin/bash", "-c"]
# update the repository sources list
# and install dependencies
RUN apt-get update \
@rmtsrc
rmtsrc / README.md
Last active July 16, 2020 14:02
Quickly and easily deploy an Eleventy Static Site to GitHub Pages with a custom domain

Deploying an Eleventy Static Site to GitHub Pages with a custom domain

Quickly and easily deploy an Eleventy Static Site to GitHub Pages with an optional custom domain.

Setup

  1. Use or create a new Eleventy project and commit and push it to a GitHub repo.
  2. In the root folder of your Eleventy project create a new file deploy.sh and copy the contents into it and on the commandline run chmod +x deploy.sh
  3. Edit your package.json file adding "deploy": "./deploy.sh" into the bottom of the scripts: section.
@rmtsrc
rmtsrc / Dockerfile
Last active July 13, 2019 10:34
Docker Android build container
FROM openjdk:8-jdk-slim-stretch
SHELL ["/bin/bash", "-c"]
# Install build tools & newer version of cmake from Debian backports
RUN echo "deb http://deb.debian.org/debian stretch-backports main contrib non-free" >> /etc/apt/sources.list.d/backports.list \
&& apt-get update \
&& apt-get install -y \
build-essential \
bzip2 \
@rmtsrc
rmtsrc / autostart
Last active October 22, 2019 09:12
Auto start Raspberry Pi Chromium fullscreen from a list of bookmarks
# /home/pi/.config/lxsession/LXDE-pi/autostart
@bash /home/pi/chromium-monitoring.sh