Skip to content

Instantly share code, notes, and snippets.

@frederikstroem
frederikstroem / backup.sh
Last active June 9, 2024 10:06
ZFS snapshot to Backblaze B2 rclone remote backup script. Work in progress code snapshot from self-hosted infrastructure development.
#!/bin/bash
# _ _ _
# (_)_ __ (_) |_
# | | '_ \| | __|
# | | | | | | |_
# |_|_| |_|_|\__|
# Make sure running as root.
if [ "$(id -u)" != "0" ]; then
@frederikstroem
frederikstroem / .bashrc
Created September 30, 2024 08:11
Bash alias to list or prune local tracking branches that do not exist on remote anymore.
# Source: https://web.archive.org/web/20240930075945/https%3A%2F%2Fstackoverflow.com%2Fquestions%2F13064613%2Fhow-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore#17029936
alias git-list-untracked='git fetch --prune && git branch -r | awk "{print \$1}" | grep -E -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk "{print \$1}"'
alias git-remove-untracked='git fetch --prune && git branch -r | awk "{print \$1}" | grep -E -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk "{print \$1}" | xargs git branch -d'
alias git-remove-untracked-force-unmerged='git fetch --prune && git branch -r | awk "{print \$1}" | grep -E -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk "{print \$1}" | xargs git branch -D'
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 9EA6 C866 165A 3A86 08BE 3568 EA2D C27E 87A4 94F2
Comment: Frederik Holm Strøm (https://frederikstroem.com) <[email protected]>
xjMEYcKXfhYJKwYBBAHaRw8BAQdAYYr1A3SfO/3KrCcRH1B9Auug0f2c7i7Eyik+
iNrpsOnNSkZyZWRlcmlrIEhvbG0gU3Ryw7htIChodHRwczovL2ZyZWRlcmlrc3Ry
b2VtLmNvbSkgPHBncEBmcmVkZXJpa3N0cm9lbS5jb20+wsJmBBMWCgLOAhsBBAsJ
CAcEFQoJCAUWAgMBAAIeAQIXgAIZARYhBJ6myGYWWjqGCL41aOotwn6HpJTyBQJm
+SI6RxSAAAAAABAALnByb29mQGFyaWFkbmUuaWRodHRwczovL2dpdGxhYi5jb20v
ZnJlZGVyaWtzdHJvZW0vZ2l0bGFiX3Byb29mVhSAAAAAABAAPXByb29mQGFyaWFk
@frederikstroem
frederikstroem / zfs_dataset_setup.nu
Last active February 12, 2025 03:21
Nushell ZFS dataset setup tool (2025-02-12 snapshot of script)
#!/usr/bin/env nu
use std log
$env.NU_LOG_FORMAT = "%ANSI_START%%LEVEL%: %MSG%%ANSI_STOP%"
# _ _ _
# | || |___| |_ __ ___ _ _ ___
# | __ / -_) | '_ \/ -_) '_(_-<
# |_||_\___|_| .__/\___|_| /__/
# |_|
@frederikstroem
frederikstroem / starship.nix
Created April 20, 2025 05:11
[2025-04-20 snapshot] Starship custom command for Nushell's Directory Stack (`dirs` module).
{ config, pkgs, ... }:
{
programs.starship = {
enable = true;
settings = {
custom = {
nu_dirs = {
disabled = false;
description = "Nushell `dirs` module";