Bash Snippets
Youtube-dl into Ffmpeg
Benötigt youtube-dl, parallel und ffmpeg.
Holt sich die direkte Video-URL via youtube-dl und piped die Video und Sound-Url direkt in ffmpeg.
Ermöglicht alles was ffmpeg kann, z.B. herauschneiden eines Clips:
URL=[url]
START=[start]
TIME=[time]
youtube-dl -g $URL | parallel -N 2 ffmpeg -ss $START -i {1} -i {2} -ss $START -map 0:v -map 1:a -t $TIME -c copy out.webm
#audio stream doesnt seem to allow input seeking (returns 403)
#so we need to do output seeking, which is... slow
#TODO: maybe find some way around that
Archive Stream
STREAM=[URL]
OUTPUT=[PATH]
# as apache to write directly to webdir
sudo -u apache /usr/local/bin/streamlink -o $OUTPUT $STREAM best
# alternative: use at to run at specified time
echo "sudo -u apache /usr/local/bin/streamlink -o $OUTPUT $STREAM best" | at [TIMESPEC]
DD with gzip
# create image
dd if=/dev/[DEVICE] | gzip > [IMAGE].gz
# apply image
gunzip -c [IMAGE].gz | dd of=/dev/[DEVICE]
Filtered Chmod
find . [filters here] -exec chmod [MOD] -- {} +
#z.B. chmod nur Dateien
find . -type f -exec chmod 644 -- {} +
chmod kann bei execute-Rechten nativ Ordner und Dateien unterscheiden:
# setzt +x bei Ordnern, aber behält das execute-Flag bei Dateien unberührt
chmod -R +X [PFAD]
# geht natürlich mit dem vollen Syntax von chmod, z.B.:
chmod -R u=Xrw,g=r,o= [PFAD]
Forge Install
java -jar forge-[version]-installer.jar --installServer
Alacritty Terminfo
# on source
infocmp > alacritty.terminfo
# sftp transfer to target
# on target
tic -x alacritty.terminfo
Telegraf Repo
Debian
curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
DISTRIB_ID=$(lsb_release -c -s)
echo "deb https://repos.influxdata.com/debian ${DISTRIB_ID} stable" | tee /etc/apt/sources.list.d/influxdb.list
IP
if up/down
ip link set dev <interface> up
ip link set dev <interface> down
htpasswd
# create
htpasswd -c -B -b </path/to/users.htpasswd> <user_name> <password>
# add/change
htpasswd -B -b </path/to/users.htpasswd> <user_name> <password>
openssl
create pkcs12/pfx
openssl pkcs12 -export -out OUT.pfx -inkey KEY.key -in CERT.cer -in INTERMEDIATE.cer -in ROOT.cer