Skip to content

Instantly share code, notes, and snippets.

@onebytegone
onebytegone / disk-speed-test.md
Created December 18, 2021 15:30
Testing Disk Drive Speed Via CLI
cd /tmp
time dd if=/dev/zero bs=2048k of=tstfile count=8192 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'
ls -al tstfile
time dd if=tstfile bs=2048k of=/dev/null count=8192 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }'

Note: If the machine has more than 16GB of free RAM, the read speed may be incorrect due to RAM caching.

@onebytegone
onebytegone / image-compare.sh
Created November 2, 2023 12:11
Imagemagick Image Compare Script
#!/usr/bin/env bash
# Usage: ./image-compare.sh "${URL_A}" "${URL_B}"
# Example: ./image-compare.sh https://placekitten.com/g/200/300 https://placekitten.com/200/300
TMP_DIR=$(mktemp -d)
IMG_A_URL="$1"
IMG_A_FILENAME=$(echo "${IMG_A_URL}" | sed -E 's|^.*/([^/]+)(\?.*)?$|\1|')
IMG_A_EXT=$(echo "${IMG_A_FILENAME}" | sed -E 's|^.*\.(.+)|\1|')
IMG_B_URL="$2"
@onebytegone
onebytegone / add-overlay-text.sh
Last active March 16, 2025 13:08
Overlay FPO and timecode (FFmpeg)
#!/usr/bin/env bash
# Usage: ./add-overlay-text.sh input.mp4 "For Review"
set -e
SOURCE_FILE=$1
OUTPUT_FILE="${SOURCE_FILE%.*}_overlay.${SOURCE_FILE##*.}"
OVERLAY_TEXT=$2