Skip to content

Instantly share code, notes, and snippets.

@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 / raspberry-pi-cec-client.md
Created May 13, 2019 09:49
Using cec-client on a Raspberry Pi to control TV power and inputs via HDMI

Using cec-client on a Raspberry Pi

Most modern HDMI connected devices support Consumer Electronics Control (CEC). It allows devices to send commands to each other, typically to get the TV to switch input and control volume. If you have ever turned on a Game Console and had your TV automatically change input to that device you have seen CEC in action. It is very convenient and useful, sort of a universal remote that works.

Every manufacturer seems to have it’s own branding of CEC (e.g. Samsung Anynet+, LG SimpLink, Sharp Aquos Link) but it may need to be enabled. Check your manual for details.

Using a Raspberry Pi connected to a TV that supports CEC, you can use the command line cec-client application to control the inputs and the TV itself. These are notes on how to use cec-client and understand the different options.

Details

@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 / postgres-json-cheatsheet.md
Last active October 22, 2023 12:16
Using JSON in Postgres by example

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

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 / index.js
Created August 1, 2017 11:31
Node Chrome Headless wait until element exists
const chromeLauncher = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const sleep = require('sleep-async');
// Optional: set logging level of launcher to see its output.
// Install it using: yarn add lighthouse-logger
// const log = require('lighthouse-logger');
// log.setLevel('info');
/**
@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 / 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 |