Skip to content

Instantly share code, notes, and snippets.

@mmguero
mmguero / ethernet-wifi-failover.md
Created September 3, 2026 03:02
setup ethernet to wifi failover using networkmanger on a fresh debian installation

Debian NetworkManager wired-first Wi-Fi fallback

This runbook migrates a remotely administered Debian host from ifupdown with dhcpcd and wpa_supplicant to NetworkManager. It then configures this policy:

  • Use Ethernet on enp1s0 whenever it has carrier and a global IP address.
  • Disconnect Wi-Fi on wlo1 while Ethernet is usable.
  • Connect the saved Wi-Fi profile when Ethernet loses carrier or its address.

The migration is staged so the existing SSH connection remains available until a timed, rollback-protected handoff.

@mmguero
mmguero / facebook-real-auto-rotate.js
Created August 11, 2026 20:36
facebook reel auto rotate
// ==UserScript==
// @name Facebook Reels Auto Next with Smart Video Watcher
// @namespace http://tampermonkey.net/
// @version 3.1
// @description Auto-advances Facebook Reels when the current video ends
// @author Shilo Tobin
// @match https://www.facebook.com/reel/*
// @grant none
// ==/UserScript==
@mmguero
mmguero / get-docker-shasums.sh
Created May 5, 2026 20:28
get the sha256 sums of some docker images matching a pattern
for IMG in $(docker images --format json | jq -r '"\(.Repository):\(.Tag)"' | grep -P "idaholab/malcolm.+:26\.05\.0"); do img='IMAGE:TAG'; docker inspect --format='{{range .RepoDigests}}{{println .}}{{end}}' "$IMG" | awk -v repo="${IMG%:*}" '$0 ~ "^"repo"@sha256:" {print; exit}'; done
@mmguero
mmguero / resize-image.sh
Created April 23, 2026 20:38
resize raspberry pi .img file
#!/bin/bash
set -euo pipefail
usage() {
cat <<EOF
Usage:
$0 <image-file> [new-size] [partition-number]
Arguments:
image-file Path to the disk image
@mmguero
mmguero / age-functions.sh
Created April 4, 2026 21:44
wrappers for password-based decrypt/encrypt with age
# shred a file if possible, and rm it if not
function shred_file {
TARGET="$1"
if [[ -n $TARGET ]] && [[ -f "$TARGET" ]]; then
type shred >/dev/null 2>&1 && shred -f -u "$TARGET" || rm -f "$TARGET"
fi
[[ -n $TARGET ]] && [[ ! -f "$TARGET" ]] && return 0 || return 1
}
# shred a file with user-provided confirmation
@mmguero
mmguero / .envrc
Last active March 10, 2026 20:11
pull artifacts from GitLab and load with docker
export GITLAB_URL=https://repo.example.org
export GITLAB_ACCESS_TOKEN=
export PROJECT_ID=
export PROJECT_BRANCH=development
export JOB_ID=create-tar
export OUTPUT_DIR=./artifacts
export CLEAN_OUTPUT_DIR=true
export EXTRACT_ARTIFACTS=true
@mmguero
mmguero / pcap-times.sh
Created February 19, 2026 18:35
PCAP file time ranges
for f in *.*; do
IFS=$'\t' read -r start end <<EOF
$(capinfos -a -e "$f" |
awk -F'time:[[:space:]]*' '/time:/{sub(/\..*/,"",$2); print $2}' |
paste -sd $'\t' -)
EOF
jo -n -- "$f=$(jo start="$start" end="$end")"
done
@mmguero
mmguero / llama-server.sh
Created January 9, 2026 05:02
run llama-server on a CPU-only box with a bunch of RAM
File: llama-server.sh
#!/usr/bin/env bash
# Paths
LLAMA_BIN="./llama.cpp/build/bin/llama-server"
MODELS_DIR="./models"
# Network
HOST="127.0.0.1"
PORT="8081"
@mmguero
mmguero / redis-keys.sh
Last active January 8, 2026 22:20
get redis keys/values
export REDISCLI_AUTH="$REDIS_PASSWORD" && \
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" --scan |
while read -r key; do
type=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" TYPE "$key")
echo "KEY: $key ($type)"
case "$type" in
list)
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_FILESCAN_PRESERVATION_DATABASE" LRANGE "$key" 0 -1 | jq
;;
esac
@mmguero
mmguero / inpainting_experiment.json
Created December 11, 2025 04:28
inpainting_experiment.json
{
"id": "5f2a65e4-b103-48d4-9c24-daefba71eeff",
"revision": 0,
"last_node_id": 23,
"last_link_id": 37,
"nodes": [
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [