Skip to content

Instantly share code, notes, and snippets.

View chrisblech's full-sized avatar

chrisblech chrisblech

View GitHub Profile
@chrisblech
chrisblech / docker-compose.yml
Created April 19, 2025 20:56
docker-compose snippet PGAdmin4
services:
pgadmin:
image: dpage/pgadmin4:latest
restart: ${RESTART_POLICY:-unless-stopped}
environment:
- PGADMIN_DEFAULT_EMAIL=sysadmin@domain.tld
- PGADMIN_DEFAULT_PASSWORD=3DEmg3a6M6auS7jeN8c
- PGADMIN_DISABLE_POSTFIX=1
- SCRIPT_NAME=/pgadmin4
depends_on:
@chrisblech
chrisblech / docker-compose.yml
Last active April 19, 2025 18:18
Migrate Postgres Database in Docker, do a backup first
services:
webserver:
image: ghcr.io/paperless-ngx/paperless-ngx:${VERSION_PAPERLESS:-latest}
restart: unless-stopped
depends_on:
db:
condition: service_healthy
db:
image: docker.io/library/postgres:17
@chrisblech
chrisblech / matomo-cron.sh
Created February 16, 2025 21:09
Verhindert Ausgaben eines Skriptes bei längerer Laufzeit
#!/bin/bash
## Dieses Skript behandelt das Problem, dass bei langer Laufzeit des Skripts die Ausgabe nicht funktioniert
## siehe hier: https://stackoverflow.com/a/9173292
LOGFILE="/stat.hiorg-server.de/cron-matomo-archive.log"
ERR_LOG="/tmp/cron-matomo-archive.err"
## Wenn beim letzten Durchgang ein Fehler auftrat, dann gib diesen jetzt aus und brich ab
if [ -f "$ERR_LOG" ] && [ -s "$ERR_LOG" ]; then
@chrisblech
chrisblech / persist_ips.sh
Last active May 25, 2025 15:39
Persistiere eine Server-IP Konfiguration -- Quelle: https://chatgpt.com/share/c9beac3a-2f16-497b-8113-2df4506b4872
#!/bin/bash
set -euo pipefail
echo "[INFO] Netzwerk-Konfigurationsskript gestartet"
# === Benötigte Befehle ===
REQUIRED_CMDS=("ip" "grep" "awk" "cut" "sed" "cat" "date" "cp" "basename" "readlink" "ls" "apt")
MISSING_CMDS=()
@chrisblech
chrisblech / background.js
Created June 23, 2024 16:25
Chrome extension to open (ie GCal) in new window on fixed position (ie on second display)
chrome.action.onClicked.addListener(() => {
const url = 'https://calendar.google.com';
chrome.windows.create({
url: url,
left: 2950, // Anpassung für den zweiten Monitor, der rechts vom ersten Monitor liegt
top: -100,
width: 2050,
height: 1200,
type: 'normal'
});
@chrisblech
chrisblech / gist:b1e4b348db41db38565181390c37776c
Created January 13, 2024 16:48
Migrate: apt error `Schlüssel in veraltetem Schlüsselbund trusted.gpg gespeichert, siehe MISSBILLIGUNG in apt-key`
for KEY in $(apt-key --keyring /etc/apt/trusted.gpg list | grep -E "(([ ]{1,2}(([0-9A-F]{4}))){10})" | tr -d " " | grep -E "([0-9A-F]){8}\b" ); do K=${KEY:(-8)}; apt-key export $K | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/imported-from-trusted-gpg-$K.gpg; done
@chrisblech
chrisblech / docker-compose.yaml
Created November 12, 2023 23:58
Run Carbonio in Docker
version: "3.9"
services:
carbonio:
image: carbonio/ce-single-rhel8:23.10.0
hostname: carbonio.carbonio-system.svc.cluster.local
user: zextras
# entrypoint: "/opt/zextras/entrypoint.sh"
ports:
- "25:25"
@chrisblech
chrisblech / ipset-update-dyn.sh
Created October 14, 2023 11:02
opens SSH-Port for dynamic IP
#!/bin/bash
## Update ipset to let my dynamic ip in
## see: https://serverfault.com/a/1002760
## insert the following lines into your firewall config:
# ipset -exist create $SET hash:ip
# iptables -A INPUT -p tcp -m set --match-set $SET src -m state --state NEW -j ACCEPT
SET=sshdyndns
HOST=myhostname.dedyn.io
@chrisblech
chrisblech / gitlab-registry-garbage-collect.sh
Created October 10, 2023 16:57
runs GitLab registry garbage collection, and only returns output in case of an error
#!/bin/bash
LOGFILE="/tmp/gitlab-registry-garbage-collect.log"
REGEXOK='^ok: run: registry: \(pid [0-9]+\) [0-5]s$'
gitlab-ctl registry-garbage-collect 2>&1 | grep -Ev '^INFO\[0001\] .+ service=registry .+' | grep -v ' level=info ' >$LOGFILE
OK="$(cat $LOGFILE \
| grep -v ' CPU quota undefined' \
@chrisblech
chrisblech / _etc_rsyslog.d_mute-healthcheck.conf
Last active December 10, 2023 17:33
update logcheck ignore patterns for debian bookworm
if $programname contains "systemd" and $msg contains "run-docker-runtime" and $msg contains ".mount: Deactivated successfully." then {
stop
}