Skip to content

Instantly share code, notes, and snippets.

View PaulGoldschmidt's full-sized avatar
🎯
Focusing

Paul Goldschmidt PaulGoldschmidt

🎯
Focusing
View GitHub Profile
@PaulGoldschmidt
PaulGoldschmidt / filerename.sh
Created August 29, 2021 20:50
Rename Files in Linux by adding leading current date
#!/bin/bash
today=`date '+%Y-%m-%d_'`;
basedir=/some/path/
for filename in $basedir*.jpg; do
cutfilename=$(basename $filename)
new_filename=$basedir$today$cutfilename
mv -v $filename $new_filename
done
@PaulGoldschmidt
PaulGoldschmidt / docker-compose.yml
Last active January 5, 2024 00:16
Docker Compose for Piaware and Fr24feeder using an USB RTL-SDR
version: '2.0'
services:
piaware:
image: mikenye/piaware:latest
tty: true
container_name: piaware
mac_address: de:ad:be:ef:13:37
restart: always
@PaulGoldschmidt
PaulGoldschmidt / split-mariadb-dump.sh
Created May 5, 2023 21:22
A small script that is able to split one big MariaDB-SQL-Dump into seperate DBs.
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No dump file specified. Usage: ./extract_dbs.sh dumpfile.sql"
exit 1
fi
# Extract database names from the dump file
databases=$(grep -oE '^CREATE DATABASE( IF NOT EXISTS)?( .*)? `[^`]+`(.*)?;' "$1" | sed -r 's/^CREATE DATABASE( IF NOT EXISTS)?( .*)? `(.*)`(.*)?;/\3/')
@PaulGoldschmidt
PaulGoldschmidt / QR-Coder.py
Created May 13, 2023 12:15
A small python-script that creates qr-codes in a given number range.
import os
import qrcode
import time
# Define the range of five-digit numbers to generate
start_number = 10000
end_number = 99999
# Create the export folder if it doesn't exist
export_folder = './export'
@PaulGoldschmidt
PaulGoldschmidt / hdd-tester.sh
Created June 26, 2023 10:05
A small bash script that logs a S.M.A.R.T.-Test and Benchmark to a file with date and drive UUID. Tested under Ubuntu 22.04 LTS.
#!/bin/bash
# AUTO-TESTER FOR HDDs - Logs a S.M.A.R.T.-Test and Benchmark to a file with date and drive UUID. By Paul Goldschmidt, 2023-06-26 (HEIDELBERG)
# Ask for a HDD to test
read -p "Enter HDD to test (e.g., /dev/sdb): " HDD
# Perform a short smarttest
echo "Starting S.M.A.R.T. short test on $HDD..."
sudo smartctl -t short $HDD
@PaulGoldschmidt
PaulGoldschmidt / update-nextcloud.sh
Last active August 27, 2023 20:21
Simple Nextcloud-Dockerized update script w/ libmagickcore & db:add-missing-indices
containterName="nextcloud"
sudo docker exec --user www-data $containterName php occ -V
docker-compose stop && docker-compose rm --force && docker-compose pull && docker-compose build --pull && docker-compose up -d
docker exec $containterName /bin/bash -c 'apt update && apt install -y libmagickcore-6.q16-6-extra'
sudo docker exec --user www-data $containterName php occ db:add-missing-indices
sudo docker exec --user www-data $containterName php occ db:convert-filecache-bigint -q
sudo docker exec --user www-data $containterName php occ -V
@PaulGoldschmidt
PaulGoldschmidt / storagealert.sh
Last active September 7, 2023 11:14
A small script to notify via telegram if the storage on a linux server runs low. Tested on Ubuntu.
#!/bin/bash
# Telegram Bot API Token and Chat ID
TELEGRAM_API_TOKEN="YOUR_TELEGRAM_BOT_API_TOKEN"
CHAT_ID="YOUR_CHAT_ID"
# Set the threshold for used storage in percentage
THRESHOLD=85
# Function to check used storage
@PaulGoldschmidt
PaulGoldschmidt / mils-dpi_to_resolution.py
Created December 4, 2023 00:02
Calculating the resolution needed to fill a canvas from mm with a given DPI.
# Convert millimeters to inches and then to pixels at given DPI
# Dimensions in millimeters
width_mm = 420
height_mm = 594
# Conversion factor from mm to inches
mm_to_inch = 1 / 25.4
# Convert dimensions to inches
@PaulGoldschmidt
PaulGoldschmidt / creostarter.bat
Created December 10, 2023 18:12
A helper script for CREO 10 at the HAW Hamburg (Dep. TI/M+P) to autostart and confirm the creo config with the VPN-Setup.
:: By Paul Goldschmidt, 12-10-2023 | https://paul-goldschmidt.de/
@echo off
start "" "C:\Program Files\eduVPN\Core\eduVPN.Client.exe"
:: Countdown timer for 5 seconds
for /l %%i in (5,-1,1) do (
cls
echo Waiting for confirmation... (%%i seconds remaining)
timeout /t 1 /nobreak >nul
@PaulGoldschmidt
PaulGoldschmidt / Caddyfile-beta2
Created February 1, 2024 19:47
Minimal dual reverse proxy setup with Caddy Servers
{
auto_https off
}
:80 {
root * /site
file_server
}