Skip to content

Instantly share code, notes, and snippets.

@lord-carlos
lord-carlos / 8mb2.bash
Last active September 21, 2022 19:29
Window WSL bash script to encode videos to under 8mb for discord sharing. Needs ffmpeg.exe in path
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
#set -x #Debug
#
# Re-encode a video to a target size in MB.
# Example:
@lord-carlos
lord-carlos / badblocks.sh
Last active October 22, 2019 14:36
What to run on new HDDs to check for health and stuff.
#Non distructive read only or something.
sudo badblocks -nsv -b 4096 /dev/sdb1
#Distructive read/write test. Best.
sudo badblocks -b 4096 -ws /dev/sdg1
@lord-carlos
lord-carlos / convert.fish
Created March 30, 2019 11:34
For loop in fish shell, converting opus files to ogg with ffmpeg
for i in *.opus
set name (echo $i |cut -d'.' -f1);
echo $name:
ffmpeg -i "$i" -c:a libvorbis -q 8 convert/$name.ogg;
end
@lord-carlos
lord-carlos / pause.gcode
Last active November 6, 2020 17:26
Pause prusa printer, wait for user input. mk3, gcode, m600
;by joan.t
G1 X10.000 Y200.000 E0; parking position GET THE PRUSA TO STICK IT'S TONGUE OUT!
M1; user stop
M105; return to current temp
@lord-carlos
lord-carlos / convert.fish
Last active July 20, 2019 10:28
fish loop to resize images to be max 2048px in any size and annotate with name. imagemagick and convert
mkdir export
for f in *jpg
convert $f -resize "2048x2048>" -quality 95 \
-gravity southeast -pointsize 20 \
-stroke '#000C' -strokewidth 2 -annotate 0 'Name ' \
-stroke none -fill white -annotate 0 'Name ' export/$f
end
@lord-carlos
lord-carlos / airsonic_scan_fix.sql
Created January 4, 2019 15:18
Resetting the last updated / scanned on airsonic / libresonic / subsonic database. Enter it in <BASE_URL>/db.view
UPDATE MEDIA_FILE SET children_last_updated = '1970-01-01 01:00:00.0' WHERE TYPE IN ( 'ALBUM', 'DIRECTORY')
@lord-carlos
lord-carlos / ytdl.sh
Last active August 5, 2023 03:19
Uses youtube-dl with 15 threads
#!/bin/bash
#youtube-dl --external-downloader axel --external-downloader-args "-n 15 -a -k" "$@"
youtube-dl --external-downloader aria2c --external-downloader-args "-c -j 5 -x 10 --summary-interval=0" "$@"