dotfiles/config/nix/scripts/lestrte
Geoffrey Frogeye 1f61ceb395
nix: Migrate scripts
They're a bit slower to start :(.
Hopefully this is something that flakes will help with,
otherwise I'll find another way.
2023-11-26 21:04:58 +01:00

24 lines
492 B
Plaintext
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
#! nix-shell -p python3
import random
import sys
for line in sys.stdin:
nl = ""
word = ""
for c in line:
if c.isalpha():
word += c
else:
if len(word) > 2:
wrd = list(word)[1:]
random.shuffle(wrd)
nl += word[0] + "".join(wrd)
else:
nl += word
word = ""
nl += c
print(nl, end="")