Skip to content

Instantly share code, notes, and snippets.

@monnoval
monnoval / ddev-off-before-shutdown.service
Last active May 14, 2025 09:16
DDEV systemd service units to auto start and off containers during boot and poweroff
[Unit]
Description=DDEV turn off all instance before shutdown
Requires=containerd.service
After=multi-user.target containerd.service
[Service]
User=ddevuser
Group=docker
Type=oneshot
RemainAfterExit=yes
@monnoval
monnoval / yt-dlp-1080.sh
Last active April 23, 2025 02:26
yt-dlp 1080 download
# Download only 1080p version
# https://github.com/yt-dlp/yt-dlp/issues/8001
yt-dlp -S res:1080,ext:mp4:m4a --recode mp4 $VIDEO_LINK
@monnoval
monnoval / sample.prf
Last active October 14, 2024 06:09
A sample one direction unison profile
# Create one config file for each folder
# /home/whois/.unison/sample.prf
# Run unison in commandline with the following
# unison sample
root = /source/directory
root = /destination/directory
force = /source/directory
@monnoval
monnoval / update-ps5-vide-clip-creation-date.sh
Created July 20, 2024 08:35
Playstation 5 / PS5 video clip filename to update file creation/modified date
#!/usr/bin/env bash
# This is to parse and update the creation date of video clips taken from
# Playstation5 (PS5). For example filenames such as
# GameTitle_20240719233528.mp4
# Transferring this file via USB would not retain the creation/modified date
# which the below bash code would solve
# https://stackoverflow.com/a/43606356
for filename in *.mp4; do # use mp4 or webm
@monnoval
monnoval / fix-dietpi-proxmox-qemu-guest-agent.sh
Created March 28, 2023 03:22
Fix not working qemu-guest-agent in Proxmox running DietPi VM
# References
# - https://dietpi.com/forum/t/qemu-guest-agent-shutdown/5898/7
# - https://pve.proxmox.com/wiki/Qemu-guest-agent
# 1. Here are the commands to run
apt install qemu-guest-agent \ # install guest agent
&& systemctl unmask systemd-logind \
&& apt install dbus \
&& systemctl start systemd-logind \
&& systemctl status systemd-logind # check status to verify
@monnoval
monnoval / commands.sh
Created March 7, 2023 14:31
Fix missing libncurses.so.5 in Debian 11, Ubuntu 22 and AlmaLinux 9.1
$ find /usr/lib/ -name *ncurses* # find ncurses library
$ sudo ln -s /usr/lib/libncurses.so.6 /usr/lib/libncurses.so.5 # do soft link
@monnoval
monnoval / num-files-per-folder.sh
Created December 19, 2022 09:27
How many files are there in each folder
# How many files are there in each folder
# https://stackoverflow.com/a/26458853
for i in */ .*/ ; do
echo -n $i": " ;
(find "$i" -type f | wc -l) ;
done
@monnoval
monnoval / heaviest-files.sh
Last active December 19, 2022 09:28
List the heaviest files in root
du --exclude="/home" -x -h -a / | sort -r -h | head -30
#!/usr/bin/env bash
# Usage:
#
# run this script as executable
# $ chmod +x update-firefox.sh
# run as sudo and add a firefox version
# $ sudo ./update-firefox.sh 95.0b10
if [[ "null" = "$1" || -z "$1" ]]; then