This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Copyright (c) 2014, 2020 by Dr. András Korn. Implements the basic idea of a similar script by Robert Coup (2013). | |
# License: GPLv3 | |
function usage() { | |
echo 'Usage: | |
rsync_parallel [--parallel=N] <args to find(1) to generate list of stuff to transfer> -- <args to rsync> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Idea from http://log.or.cz/?p=356 | |
# | |
# Copyright (c) 2017-2020 András Korn. License: GPLv3 | |
# | |
# Run this from a user-level runsvdir (runit), or from an endless loop, or using systemd, set to restart. | |
# | |
# Make sure you start browsers in their own process group (e.g. `chpst -P browser`). (TODO: maybe support cgroups?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
zfs get all -Hp -s local,received >/var/backups/zfs-properties.txt | |
zpool get all >/var/backups/zpool-properties.txt | |
for i in $(zfs list -t filesystem,volume -H -o name); do | |
unset props | |
zfs get all -o property,value -Hp -s local,received $i | while read prop value; do | |
props=($props[@] "-o $prop"="'$value'") | |
done | |
echo zfs create ${(o)props[@]} $i | |
done >/var/backups/zfs-create-commands.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Purpose: run specified command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output. | |
# Also cache exit status and stderr. | |
# Copyright (c) 2019-2023 András Korn; License: GPLv3 | |
# Use silly long variable names to avoid clashing with whatever the invoked program might use | |
RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300} | |
RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0} | |
RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Copyright (C) 2016, 2022 András Korn. Licensed under the GPL v3. | |
# | |
# Purpose: query the status of all local SATA hard drives and summarize in a table. | |
# | |
# Not complete, but good enough for my own purposes. Patches welcome. | |
typeset -A diskattrs | |
typeset -A diskargs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Copyright (c) 2019-2022 András Korn. License: GPLv3 | |
# | |
# Take a set of network interfaces and determine which one is plugged into a specific network. Then rename the interface. | |
# | |
# This script supplies some generic functions for that purpose; the actual logic comes from configuration (you need to override the detect() function and perhaps the last_resort() function). | |
# | |
# The script is concurrency capable. It processes candidate interfaces simultaneously, obtaining a lock for each; other instances skip locked interfaces and add them to the end of their queue. | |
# Several instances can run concurrently with overlapping candidate POOLs. |