Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created February 8, 2022 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmarreck/46612cbc03a30c39ae485f8ca6c29635 to your computer and use it in GitHub Desktop.
Save pmarreck/46612cbc03a30c39ae485f8ca6c29635 to your computer and use it in GitHub Desktop.
destroy a random half of your files, Thanos-style, in linux or bash shell
# Wrote this on a whim. Consider it performance-art shell scripting.
# To really do this, set FFS=true, otherwise, only the paths to the files that would have been destroyed are printed.
# I take no responsibility for the use of this. Even writing it was scary, and I didn't test the whole thing (YET).
# You have been warned.
coinflip() { return $(($RANDOM%2)); }
thanos_logic() { while read -r line; do coinflip && echo "$line"; done; }
thanos_infinity_gauntlet_completed() {
if [ "$FFS" ]; then
sudo find / -type f | thanos_logic | xargs -P 16 -n 1 -r -d '\n' shred -fu
else
sudo find / -type f | thanos_logic | xargs -r -d '\n' printf "%s\n"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment