Skip to content

Instantly share code, notes, and snippets.

View geraldurbas's full-sized avatar

Gerald Urbas geraldurbas

View GitHub Profile
@geraldurbas
geraldurbas / psql-with-gzip-cheatsheet.sh
Created December 16, 2024 12:06 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@geraldurbas
geraldurbas / zfs_cleanup.sh
Last active October 15, 2024 22:40 — forked from jstutters/zfs_cleanup.sh
Find and delete multiple ZFS snapshots
zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 echo
# zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 zfs destroy
zfs list -r -t snapshot -o name BusinessData/Strato-varwww | grep "2024-07" | xargs -n1 echo
zfs list -r -t snapshot -o name BusinessData/Strato-varwww | grep "2024-07" | xargs -n1 zfs destroy
For TrueNAS SCALE Only
sed -i 's/auth.generate_token",\[300/auth.generate_token",\[14400/g' /usr/share/truenas/webui/*.js
For TrueNAS CORE Only
sed -ie 's/auth.generate_token",\[300/auth.generate_token",\[14400/g' /usr/local/www/webui/*.js
#14400 = 4h
#129600 = 36h
# Proxmox VE Installation on Hetzner Server via Rescue System
Follow these steps to install Proxmox VE on a Hetzner server via the Rescue System. The Rescue System is a Linux-based environment that can be booted into to perform system recovery tasks. We'll be using it to install Proxmox VE.
In order to complete the process, it is indeed necessary to first boot into the Rescue System and then connect to it via SSH. This will allow you to run the commands for installing Proxmox VE. Here are the steps:
### Starting the Rescue System
1. Log into the Hetzner Robot.
2. Under "Main Functions; Server" select the desired server and then open the tab "Rescue".
@geraldurbas
geraldurbas / db_backup.sh
Created July 1, 2022 09:12 — forked from janit/db_backup.sh
Rotating PostgreSQL Backup Script
#!/bin/bash
# for use with cron, eg:
# 0 3 * * * postgres /var/db/db_backup.sh foo_db
if [[ -z "$1" ]]; then
echo "Usage: $0 <db_name> [pg_dump args]"
exit 1
fi