Skip to content

Instantly share code, notes, and snippets.

@haxwithaxe
haxwithaxe / quickshare
Created June 22, 2026 21:51
A script to quickly share a file over http without exposing an entire directory (on-demand snakeoil TLS in the future)
#!/usr/bin/env python3
"""Quickly share a file or files without exposing a whole directory."""
import argparse
import contextlib
import http
import http.server
import html
import io
import logging
@haxwithaxe
haxwithaxe / nulliter.sh
Created June 19, 2026 21:32
Consume a null separated list on stdin and do something with each element.
#!/bin/bash
set -e
SCRIPT_NAME="${0##./}"
# shellcheck disable=SC2120
print_help() {
local exit_error
exit_error="${1:-1}"
@haxwithaxe
haxwithaxe / foo.py
Created April 2, 2026 18:37
Snippet for converting octal to symbolic permissions and symbolic to octal
"""A snippet for converting between permissions formats.
These aren't complete compared to `chmod`. They don't account for the sticky
bit, set user/group ID, or extra leading characters on octal modes.
symbolic_to_octal: Convert a set of symbolic mode permissions to its octal
string equivalent.
symbolic_to_int: Same as `symbolic_to_octal` but returns an `int` instead of an
octal string.
octal_to_symbolic: Convert octal mode permissions to symbolic mode permissions.
@haxwithaxe
haxwithaxe / findrmsgw
Last active February 8, 2026 03:51
Download or query the list of WinLink RMS gateways
#!/bin/bash
# A script to help locate winlink gateways
# Adapted from `findardop` and `getardoplist` by km4ack
# License: GPL-3-only
set -e -o pipefail
CACHE_DIR="${HOME}/.cache/$(basename "$0")"
ALL_RMS_FILE="${CACHE_DIR}/all.list"
@haxwithaxe
haxwithaxe / flatpak-binify
Created September 14, 2025 22:34
Creates a script to launch a flatpak (optionally with flatpak run args) from the cli with the app name
#!/bin/bash
set -e
usage() {
echo "$0 <app name> <flatpak> [flatpak run args]"
}
case $1 in
-h|--help|help)
@haxwithaxe
haxwithaxe / battery-charge-set
Created September 14, 2025 22:11
Set the battery charge mode for Dell XPS 9380 and probaly others
#!/bin/bash
# Requires https://www.dell.com/support/kbdoc/en-us/000178000/dell-command-configure
case $1 in
safe)
sudo cctk --PrimaryBattChargeCfg=Custom:50-80
exit 0
;;
max|full)
@haxwithaxe
haxwithaxe / celestial-nav-utils.py
Last active June 18, 2025 14:50
Tools I've made for myself for playing around with learning about celestial navigation. Updates as I progress.
"""Tools for playing with celestial navigation."""
import math
import re
from typing import Union
ANGLE_HOUR = 15 # degrees/hour
_DECIMAL_RE = r'\d+(?:\.\d+)?'
_DEG_MIN_SEC_RE = re.compile(
@haxwithaxe
haxwithaxe / cpu-gov
Created May 11, 2025 16:31
A script to quickly and dirtyly manually manage Xeon CPU governor settings.
#!/bin/bash
set_govs() {
local mode=$1
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
echo $mode | sudo tee $i
done
}
get_govs() {
@haxwithaxe
haxwithaxe / pskreporter-log.sh
Created January 7, 2025 16:20
Long term antenna test data logger
#!/bin/bash
# This script downloads an activity log from PSKReporter and some space weather
# stats.
# Create the log directory, make the script executable, and add the following
# to your crontab:
#
# @daily <Path to the script>/pskreporter-logger.sh daily
# 0 6 * * * <Path to the script>/pskreporter-logger.sh past_UTC_0000
#
# Replace `6` with the hour of the day for UTC 00:00 for your
@haxwithaxe
haxwithaxe / random-wire.py
Last active July 2, 2024 14:00
Random wire antenna length calculator.
#!/usr/bin/env python3
"""Random wire antenna length calculator.
Options:
`--help` - Show the help message.
`-i`, `--imperial` - Use imperial units (feet).
`-m`, `--metric` (default) - Use metric units (meters).
`-h`, `--harmonics <count>` - The amount of harmonics to include in the
calculations. Defaults to `5`.
`-c`, `--check <length>` - Check the given length to see if it is a good