Useful Scripts
Collection of useful scripts for Windows and Linux
ProfessorShroom š Scripts
Just a useful collection of scripts for Linux and Windows.
Docker
- dockerInstallPi.sh - Install Docker on a Raspberry Pi.
- dockerInstallUbuntu.sh - Install Docker on Ubuntu.
- updateDockerContainers.sh - Updates all Docker containers, assuming all are held within the same directory.
For example, if all containers are held within/mnt/docker/you just add the name of the subfolder.
Change the following line to your Docker directory:
dockerDir="/path/to/docker/containers"
and then input your containers like below:
containers="
Jellyfin
Radarr
SABnzbd
Sonarr
"
Fedora
- audioSwitch.sh - Toggles the default PulseAudio/PipeWire audio sink between two configured output devices (e.g., Speakers and Behringer UMC204HD interface). Dynamically transfers all active playing audio streams to the newly selected output without interrupting playback and triggers a desktop notification[cite: 1].
Find your audio sink names by runningpactl list short sinksin your terminal, then update the following variables in the script:
SINK1="your_first_sink_name"
SINK2="your_second_sink_name"
You can also customize the display names shown in notifications:
NAME1="Speakers"
NAME2="Behringer UMC204HD"
- updateSystem.sh - Automates system package maintenance by upgrading Fedora system packages (
dnf upgrade), removing orphaned dependencies (dnf autoremove), and updating Flatpak applications (flatpak update). Includes a 30-second timed pause upon completion before automatically closing the terminal window.
MergerFS
- mergerFSBalance.sh - Balances my MergerFS volume, but excludes a directory on one of the drives I do not want balanced:
-e /mnt/drive1/Docker/
means that the Docker folder within drive 1 is excluded from the balance process.
Metadata
- removeImgMetadata.sh - Removes metadata from all images.
You set the directory by changing:
TARGET_DIR="$BASE_DIR/location/of/images"
Leave $BASE_DIR to run a relative path from the location of the script, removing it will allow you to input an absolute path.
Will install exiftool if not already installed
- removeImgMetadata.ps1 - Exactly the same as above, but for Windows.
Nextcloud
- nextcloudSync.sh - Runs a two-way Nextcloud sync to a specified location.
Change:
WATCH_DIR="/path/to/Nextcloud"
to change the location of Nextcloud on the local drive.
- nextcloudService.service - SystemD service file for the above script. Only errors are logged to avoid clogging up the log file.
Change:
RequiresMountsFor=/path/to/nextcloud
to the drive that the Nextcloud folder is located in.
Change
/path/to/nextcloudSync.sh
under ExecStart= to wherever the script is located.
Change User=user to your username.
Change
EnvironmentFile=/home/user/nextcloud.env
to the location of your env file.
-
nextcloudService.timer - SystemD service timer file for the above script, this is delayed for 2 minutes after booting and will run every 5 minutes unless an instance is already running.
-
nextcloud.env - Environment file containing your credentials.
Change:
REMOTE="https://username:password@nextcloud.domain.com"
to suit your username, password (app password if using MFA), and Nextcloud domain.
Iād suggest locking it by running
sudo chmod 600
and
sudo chown root:root
on the file after entering your credentials.
Virtualization
- setupBridgeNetwork.sh - Creates a NetworkManager bridge (
br0) forvirt-manager/libvirtVMs, attaches your physical network interface to it, and clones the original MAC address to prevent connection issues.
Run the script withsudoprivileges:
sudo ./setup-bridge.sh
You will be prompted to select your network interface (e.g., enp3s0).
To change the default bridge name, modify the following variable in the script:
BRIDGE_NAME="br0"
Windows
- ClearFileExplorer.vbs - Clears the file explorer history.
- EmptyRecycleBin.vbs - Empties the recycle bin.