Skip to content

Instantly share code, notes, and snippets.

@NiklasZ
NiklasZ / deploy_service.sh
Last active January 25, 2026 08:43
Deploy Systemd service
#!/bin/bash
# Lazy script I use to validate and deploy systemd services.
# Exit immediately if a command exits with a non-zero status
set -e
# Function to print status messages
log_info() {
echo -e "\033[0;32m[INFO]\033[0m $1"
}
@NiklasZ
NiklasZ / prune_branches.sh
Last active March 15, 2021 15:15
Delete old git branches
#!/bin/bash
# Removes old git branches with no commits in >= 6 months.
# Instructions
# 1. Copy to directory of git repo
# 2. Run once to see list of branches
# 3. Once confident, export $DRY_RUN = false and run again to delete them locally and remotely.
exempt_branches=("example-branch-name" "example-branch-name-2")
ECHO='echo '