Scripts

Borgbackup

Prerequisite you need a remote Borg Server (Unix/Linux Machine with Borg installed) valid User and Key for SCP Transferaaaa SSH Key -> /backup/id_ed25519 Create Local Folder test -d /backup || (mkdir /backup; chmod 700 /backup) Borg Backup Script cat << 'EOF2' > /backup/borg.sh #!/usr/bin/env bash # BorgBackup Script, v1.0, 2024-04-09, by @stoege # Remote server details REMOTE_USER="borguser" REMOTE_HOST="your.remote.borg.server" REMOTE_REPO="mysamplerepo" # Local directory to backup LOCAL_DIR="/" # List of directories to exclude EXCLUDE_DIRS=( "*/.

Bash - Snippets

some Bash snippets Change Working Directory Switch the Working Directory to the Base Path where the Scripts remains. Helpfull for Includes, Log Files, Relative Path and so on … #!/usr/bin/env bash script_path=$(dirname "$0") cd "$script_path" Check Return Code Run a Command, store the Return Code, and check if it was successfull or failed #!/usr/bin/env sh check_ret () { if [[ "$ret" == "0" ]]; then echo "Command terminated sucessfully" else echo "Command returned an Error: ${ret}" fi } which bash > /dev/null 2>&1 ret=$?

Python - Little Wordcloud

Do you like Word Clouds ? I do …! following a litte Script which Parse a Website and build a appropriate Word Cloud Script mkdir ~/mywordcloud; cd ~/mywordcloud cat <<'EOF' > main.py import fire import matplotlib.pyplot as plt import pandas as pd import re import requests from bs4 import BeautifulSoup from wordcloud import STOPWORDS, WordCloud def gen_cloud_tag(url: str = "https://blog.stoege.net"): # add https if not url.startswith("https://"): url = "https://" + url # get Webpage response = requests.