Installing FFMPEG on a Windows system

Had to do this, so I make a note of it.

  1. Download the latest ffmpeg build:
    Full: https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-full.7z
    Essentials: https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z
  2. Buy this dude a coffee: https://www.buymeacoffee.com/gyan
  3. Unpack your downloaded software
  4. Create a folder in your root, like C:\ffmpeg
  5. Move the three folders BIN, DOCS, PRESETS into the ffmpeg folder
  6. Open CMD with admin rights
  7. Paste the following into the command terminal and hit enter:
    setx /m PATH "C:\ffmpeg\bin;%PATH%"
  8. Type “ffmpeg” in the terminal and you should see a reply from the software.
  9. Done.

Loading

WireGuard – Allow Local Network

the logo of a VPN app named WireGuard, depicting a white dragon against a red background

And by Local Network, I mean here on my workstation, not at the peer or VPN docker/server/provider.

I am not very knowledgeable with VPNs but I got to learn something new and when I do, I make a note of it. The problem was that when I have my VPN active to poke things at home, I could not print documents at my workstation at work.

Googled a lot, trid a few things and then realised that adding IP addresses to AllowedIPs in the PEER section, adds an exception for an IP address on the server’s side, NOT my workstation.

“Ooooh, what does this checkmark do?”

Confusingly enough, WireGuard names things differently between the Windows and the iOS app. So here’s what you need to check to gain access to your workstation’s local network:

  1. Open the WireGuard control panel.
  2. Click once on the vpn you want to change
  3. Click the EDIT button on the bottom right
  4. iOS: UN-Tick the box on the bottom left that says: “Exclude private IPs”, then click SAVE
    Windows: UN-Tick the box on the bottom left that says: “Block untunneled traffic (kill-switch)”, then click SAVE

Yes ,this poses a security risc, so I made two VPN profiles. One with and one without so I can easily switch from one to the other.

Loading

[Solved] MySQL docker on Unraid does an unwanted upgrade

the logo of mysql, showing the name and the outline of a dolphin.

I usually do not fear updates, but when it comes to databases, I am getting really careful with updating them. It wouldn’t be the first time when a database goes plonk after this.

So what happened? My MySQL docker got updated becuase I simply misclicked and of course, the thing broke. The update script, which was set to “latest”, performed an upgrade to 9.x instead of sticking to the latest 8.x version.

After some research, I read that one can enter “mysql:8.2.0” in the repository field. After entering this and starting the docker, the software got reinstalled with the proper version and everything worked again. I must’ve been lucky that the database itself was not migrated to v9 already, I guess.

Loading

Side-project: I’ll just build my own dashcam.

While I am trying to repair the Koonlung K1S Dashcam, I am going to build my own dashcam. Sure, I can buy one and pay a ridiculous amount of money for a half-way decent one, but I paid € 230 for the K1S which I assumed did not turn out to be trash.

And so, I am going to build one myself and learn from it in the process. The project was first going to be a pwnagotchi, but I think building a dashcam is more useful. For now @_@

While I am waiting for the auxiliary battery, I will have to start with soldering the 40-pin header onto the board. And if you wonder why I didn;t buy one with a header soldered on it already, my answer is: “I had no idea that this was an option!!1 D: ”

A box of parts that will become a dashcam at some point. There is a raspberri Pi Zero board, a E-Inkt screen, a clock timer, a camera and some wiring
The box of stuff!

Loading

Function to change ownership of the www folder

Just another snippet of code that can be implemented somewhere:

set-perms.sh
#!/bin/bash

# Function to change ownership of the www folder
change_ownership() {
    sudo chown -R "$1":www-data /var/www
    echo "Ownership of the www folder has been set to $1:www-data."
}

# Loop until a valid username is provided
while true; do
    # Prompt the user to enter the desired username
    read -p "Enter the username for permissions: " username

    # Check if the username provided exists
    if id "$username" &>/dev/null; then
        change_ownership "$username"
        break  # Exit the loop if a valid username is provided
    else
        echo "Error: User $username does not exist."
    fi
done

echo "done!"

To make the script executable:

sudo chmod +x set-perms.sh

and run it with

sudo ./set-perms.sh

Loading

Setting up an automated mySQL / MariaDB backup schedule

Just digging deeper in automating thing, so I made two scripts:

backup_cron.sh
#!/bin/bash

# Define the path to the backup script
BACKUP_SCRIPT="/backup_mysql.sh"

# Define the cron job command to run the backup script once a week (every Sunday at midnight)
CRON_COMMAND="0 0 * * 0 $BACKUP_SCRIPT"

# Add the cron job to the crontab
(crontab -l 2>/dev/null; echo "$CRON_COMMAND") | crontab -

echo "Backup cron job set up successfully."

And the script that executes the backup every Sunday:

backup_mysql.sh
#!/bin/bash

# Define the directory where backup files will be stored
BACKUP_DIR="/var/backups/mysql"

# Ensure the backup directory exists
mkdir -p "$BACKUP_DIR"

# Define the filename for the backup file (include date in the filename)
BACKUP_FILE="$BACKUP_DIR/mysql_backup_$(date +%Y-%m-%d_%H-%M-%S).sql"

# Define the compressed filename
COMPRESSED_FILE="$BACKUP_FILE.gz"

# Define MySQL username and password (replace with your MySQL credentials)
DB_USER="USERNAME"
DB_PASS="PASSWORD"

# Dump all databases into a single SQL file
mysqldump -u "$DB_USER" -p"$DB_PASS" --all-databases > "$BACKUP_FILE"

# Add permissions to the backup file
chmod 600 "$BACKUP_FILE"

# Compress the backup file
gzip "$BACKUP_FILE"

echo "Database backup completed. Backup stored in: $COMPRESSED_FILE"

To make the script executable:

sudo chmod +x backup_cron.sh
sudo chmod +x backup_mysql.sh

and run it with

sudo ./backup_cron.sh

Loading