Skip to content

Instantly share code, notes, and snippets.

View mafredri's full-sized avatar

Mathias Fredriksson mafredri

View GitHub Profile
@mafredri
mafredri / zsh-histdb-tabulation.zsh
Last active December 21, 2021 18:36
Custom tabulation command for zsh-histdb
# This is a custom tabulation command implemented fully in zsh that
# produces simple output suitable for zsh-histdb.
#
# The `column` command on macOS has a silly limitation max 2048 line
# length, it's unsuitable for tabulating long paths and commands. It
# also produces somewhat unexpected results with regards to column
# length and placement.
#
# Features:
# - Right indent for number columns
@mafredri
mafredri / timemachine-zfs-snapshot
Last active December 16, 2022 02:41
Time Machine backup snapshotting on ZFS using zrepl for snapshot purging (for Samba server)
# /etc/cron.d/samba-timemachine-zfs-snapshot
# Create snapshots after completed Time Machine backups.
# Runs every two minutes to allow creating backups only after cleanup is
# completed.
*/2 * * * * root /usr/local/bin/timemachine-zfs-snapshot.sh rpool/share/timemachine
@mafredri
mafredri / rm-backup.sh
Last active January 18, 2024 21:15
Scripts for the reMarkable tablet (backup and factory reset)
# Creates remarkable_backup-(date).tar.gz with todays date, backs up /home/root.
(
ssh root@10.11.99.1 'tar cf - .' \
| gzip >remarkable_backup-$(date '+%Y-%m-%d').tar.gz
) 2 >err.log
cat err.log
@mafredri
mafredri / smb.conf
Last active January 29, 2024 20:42
Samba config for Open PS2 Loader (PlayStation 2)
# This setup works pretty well for OPL with a network link that travels through
# two UniFi switches and connects to a Samba server running inside Docker. The
# host OS is Debian with a ZFS filesystem and the container OS is also Debian.
# Latest Samba (4.11+).
[global]
# ======================
# General Samba settings
# ======================
log level = 1