Skip to content

Instantly share code, notes, and snippets.

View goose-ws's full-sized avatar
🪿

Nick Bradshaw goose-ws

🪿
View GitHub Profile
@goose-ws
goose-ws / minmax.bash
Last active February 24, 2025 11:23
They say if it's more than 100 lines, you should write it in a real language, instead of bash. I say, with enough semicolons, any bash script can be a one line bash script.
while IFS= read -r line; do while [[ "${line:0:1}" =~ ($'\t'| ) ]]; do line="${line:1}"; done; if [[ "${line:0:1}" == "#" || -z "${line}" ]]; then continue; fi; if [[ "$line" =~ [^\\#][[:space:]]+# ]]; then line="${line% #*}"; fi; if [[ -n "${line}" ]]; then [[ "$line" =~ \b(do|then)$ ]] && output+="$line " || output+="$line; "; fi; done < "${1}"; output="${output//;;/;}"; echo "${output#;}"
@goose-ws
goose-ws / Subtitles.md
Last active March 29, 2025 04:46
List of Subtitle Codes

Please note, this is not an exhaustive list, only what I was able to find so far. Please comment with any additional languages found and I'll add them to the table.

Language Code Language Name Description
ar Arabic Standard Arabic
cs Czech Czech language
da Danish Danish language
de German Standard German
el Greek Modern Greek
en English English (generic)
@goose-ws
goose-ws / captive-dns.sh
Last active February 17, 2023 18:32
Forces captive DNS on a UDM Pro
This script has been moved to my bash scripts repository:
https://github.com/goose-ws/bash-scripts
@goose-ws
goose-ws / tiny-video.bash
Last active February 7, 2025 01:39
Usage is: ./tiny-video.bash "/path/to/input/file.mkv" "/path/to/output/file.mp4"
#!/usr/bin/env bash
target_size=$(( 6 * 1000 * 1000 * 8 )) # 6MB
length="$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${1}")"
length_round_up=$(( ${length%.*} + 1 ))
total_bitrate=$(( target_size / length_round_up ))
audio_bitrate=$(( total_bitrate / 5 )) # 20% of the total bit rate
video_bitrate=$(( total_bitrate - audio_bitrate ))
ffmpeg-bar -i "${1}" -b:v ${video_bitrate} -maxrate:v ${video_bitrate} -bufsize:v $(( ${target_size} / 20 )) -b:a ${audio_bitrate} -ac 1 -vf scale=-1:144 "${2}"
ffmpeg-bar -i "${2}" -map_metadata -1 -c:v copy -c:a copy -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "${2%.mp4}-2.mp4"
@goose-ws
goose-ws / Get Telegram Channel ID.md
Last active February 17, 2023 17:41
Get Telegram Channel ID
@goose-ws
goose-ws / fix-tba.sh
Last active August 29, 2024 20:30
Script to fix TBA titled episodes in Sonarr
This script has been rewritten and improved, and is now located in my `bash scripts` repository: https://github.com/goose-ws/bash-scripts
More specifically, here is the script: https://github.com/goose-ws/bash-scripts/blob/main/sonarr-update-tba.bash
And here is the corresponding `.env` file you need to put in the same directory as the script: https://github.com/goose-ws/bash-scripts/blob/main/sonarr-update-tba.env.example
# This script has been replaced by https://github.com/goose-ws/bash-scripts/blob/main/update-plex-in-docker.bash
@goose-ws
goose-ws / Evolve Lore.md
Last active February 23, 2025 15:27
Lore of Evolve

Foreword: This work is originally by Matt Colville. It's the lore to the 2015 video game Evolve. The lore originally was posted on the game's forums, which have since been taken down and are no longer accessible. Fearing that this could someday happen, I archived a copy of the lore. I formatted it to look pretty in a gist, and corrected the few mis-spelled words I came across. Otherwise, it is all Matt's work, the order of the stories, emphasis with bold, italics, images, and all. I'll try to keep this alive indefinitely, via Gist, as well as a copy on my personal server. Enjoy.


"So we're going down there?" Val asked.

"That's where the monster is," Griffin said, grinning. He looked hungry, feral.

"You got another option, darlin', we're all ears," Hank said.