Skip to content

Instantly share code, notes, and snippets.

View lisanna-dettwyler's full-sized avatar
🌸

Lisanna Dettwyler lisanna-dettwyler

🌸
View GitHub Profile
@lisanna-dettwyler
lisanna-dettwyler / help.md
Created September 6, 2021 22:45 — forked from LisannaAtHome/help.md
Lisanna's eclectic nix troubleshooting guide for suicidal power users

Lisanna's eclectic nix troubleshooting guide for suicidal power users

tar fails with exit code 1

unpacking 'https://example.com/nixexprs.tar.xz'...
tar: Error opening archive: Failed to open '/nix/store/411sszfqfya5ad2wllmqcr15z5d30575-nixexprs.tar.xz'
error: program 'tar' failed with exit code 1

Discussion:

@lisanna-dettwyler
lisanna-dettwyler / io-timeout.sh
Last active June 21, 2023 15:42
Progress-based timeout
#!/usr/bin/env bash
# This is an alternative for the GNU coreutils timeout, which resets the timer
# when the program writes to stdout. This allows setting much smaller timeout
# values for programs that regularly print progress messages, which allows
# progress stalls to be detected more quickly, saving execution time in testing
# contexts.
set -e
@lisanna-dettwyler
lisanna-dettwyler / retry.sh
Last active April 8, 2023 03:37
Retry with stdin replay
#! /usr/bin/env bash
# usage: retry ATTEMPTS COMMAND [...]
#
# This script provides a retry function capable of capturing and replaying data
# from stdin to the command being retried, so that each attempt receives the
# input. The data from stdin is streamed to the command immediately, it is not
# pre-buffered, and thus will not lock up if the input from stdin never ends.
#
# If ATTEMPTS is 0, COMMAND is retried forever until it succeeds.