Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / show-wasted-bits.bash
Created January 16, 2025 23:56
Analyze FLAC file to determine if it has wasted bits
#!/bin/bash
# https://hydrogenaud.io/index.php/topic,97746.0.html
temp_file="$(mktemp)"
trap 'rm -f -- "$temp_file"' EXIT
bps="$( metaflac --show-bps "$1" )"
flac --analyze --stdout "$1" 2>/dev/null | grep --fixed-strings 'wasted_bits' | cut -d '=' -f 3 | cut -f 1 > "$temp_file"
tbps=0
n=0
@gene1wood
gene1wood / show_request.py
Created November 29, 2024 18:29
Simple script to launch a Flask listener on all URLs and print out incoming requests with headers and payload
from __future__ import print_function
import sys
from flask import Flask, request
import json
app = Flask(__name__)
@app.route('/', defaults={'path': ''}, methods=['GET', 'HEAD', 'POST'])
@app.route('/<path:path>', methods=['GET', 'HEAD', 'POST'])
def show_payload(path):
@gene1wood
gene1wood / owntracks-mosquitto-lets-encrypt-certificates.md
Last active November 28, 2024 00:07
Fix for mosquitto error tlsv1 alert unknown ca

Using Let's Encrypt certificates with mosquitto to enable TLS

I had been using the cert.pem file that Let's Encrypt produces. This file contains only the certificate.

This was configured in the mosquitto config with the line

certfile /mosquitto/config/ssl/mosquitto.crt
@gene1wood
gene1wood / how-to-find-HP-retired-product-support-page.md
Created October 19, 2024 20:25
How to find the link to HP Drivers and Support for retired products

If you go to the HP support site

https://support.hp.com/us-en/drivers/desktops

And enter the serial number of your retired HP device, it will respond with an error message saying that your product is retired and that they don't provide drivers and manuals any more.

HP policy for products no longer supported HP Support may vary by product. Once a product is retired, the official HP support content (troubleshooting articles, user guides, how-to videos, etc.) for that product is removed from the HP web site. Additional support content may still be available via the HP Forums or from third-party web sites; however, HP takes no responsibility for content authored by third-parties.

@gene1wood
gene1wood / hyde_shuttle_northeast_seattle_boundaries.md
Last active August 20, 2024 20:58
Hyde Shuttle Northeast Seattle boundaries

The boundaries of the Hyde Shuttle of Seattle for the Northeast Seattle neighborhood

  • Seattle North to 145th
  • South to the Ship Canal
  • East to Lake Washington
  • And West to I-5

We do make some exceptions:

  • Northgate and adjacent medical facilities.
@gene1wood
gene1wood / [Action Advised] Timeline (formerly known as Location History) is changing.pdf
Last active June 6, 2024 21:55
[Action Advised] Timeline (formerly known as Location History) is changing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gene1wood
gene1wood / assume-role.bash
Last active April 11, 2024 17:09
One liner to assume an AWS IAM role and set environment variables to use the resulting STS credentials
#!/bin/bash -x
# Session duration
# DURATION=43200
DURATION=3600
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
if ! sts=( $(
aws sts assume-role \
@gene1wood
gene1wood / remove-keys.bash
Last active April 29, 2024 03:41
Command to remove all apt gpg keys in /etc/apt/keyrings from /etc/apt/trusted.gpg
for keyfile in /etc/apt/keyrings/*.asc; do echo "$keyfile"; cat "$keyfile" | gpg --with-colons --import-options show-only --import | awk -F: '$1 == "fpr" {print $10}' | xargs --verbose -L 1 apt-key del; done
@gene1wood
gene1wood / mount-netbird-nfs.bash
Last active January 13, 2024 19:06
Script to mount and unmount all /etc/fstab mount points that use NFS over Netbird
#!/bin/bash
if [ -z "$1" -o "$1" = "mount" ]; then
action=mount
elif [ "$1" = "umount" ]; then
action=umount
elif [ "$1" = "wait" ]; then
action=wait
else
echo "missing action"
@gene1wood
gene1wood / unifi-network-application-troubleshooting.md
Created December 10, 2023 06:51
How to get dockerized Unifi Network Application to adopt AP after "Server Reject" and How to factory reset a Unifi AC AP Pro (UAP-AC-PRO)

How to get dockerized Unifi Network Application to adopt AP after "Server Reject"

If you're running the linuxserver.io dockerized Unifi Network Application / Unifi Controller and you've SSH'd into the Unifi AP and set the inform URL as described in the README by running

set-inform http://$address:8080/inform

and when you run the info command to see the result you see the message