Skip to content

Instantly share code, notes, and snippets.

View unsound's full-sized avatar

Erik Larsson unsound

View GitHub Profile
@unsound
unsound / qdl
Created August 31, 2025 16:44
qdl - A download script that reads URLs from a file and downloads the specified URL into a subdirectory name following the URL in the file.
#!/bin/sh
# Queued download script.
# Takes one or more download list files as arguments.
# Each line in a list file has the format: <url> <download directory name>
# (Use '%20' for spaces in the URL.)
if [ $# -lt 1 ]; then
echo "usage: qdl <download list file...>"
exit 1
@unsound
unsound / dkiocinfo.c
Last active August 31, 2025 16:42
dkiocinfo.c - A Solaris/Illumos utility for getting information about the disk controller (DKIOCINFO ioctl).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/dkio.h>
int main(int argc, char **argv)
@unsound
unsound / cksha
Last active August 31, 2025 11:06
cksha - Script to check SHA-1/224/256/384/512 checksum files recursively.
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: `basename $0` <directory>"
exit 1
fi
find "$@" '(' -name '*.sha512' -or -name '*.sha384' -or -name '*.sha256' -or -name '*.sha224' -or -name '*.sha1' ')' -exec bash -c '
pushd "$(dirname "$0")" > /dev/null
filename="$(basename "$0")"
#!/bin/bash
if [ "${BASH_VERSINFO[0]}" -lt 5 ]; then
echo "You need bash 5.0 or higher to run this script because of associative arrays."
exit 1
fi
declare -A names
declare -a ordered
count=0
@unsound
unsound / scanext4.c
Created March 18, 2025 14:36
scanext4 utility - Scan for an ext4 signature on a device and print the byte offset / sector.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
@unsound
unsound / temps
Last active March 16, 2025 13:56
temps: Small script for my PowerMac G5 Dual-core to monitor CPU temperatures in the Linux terminal
#!/bin/sh
while true; do
for i in /sys/devices/platform/windfarm.0/cpu-temp-*; do
echo -n "CPU Core $(echo "$i" | cut -d - -f 3): $(cat "$i")°C "
done
sleep 1
printf '\r'
done