Last active
May 23, 2025 09:23
-
-
Save erumoico/5effe2d59d7537562cd2741adabfac06 to your computer and use it in GitHub Desktop.
Generování náhodných českých hesel dle XKCD 936
This file contains hidden or 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/bash | |
# https://www.xkcd.com/936/ | |
# apt install xkcdpass unar | |
# https://wiki.korpus.cz/doku.php/seznamy:abc_seznamy | |
SLOVNIK_URL='https://wiki.korpus.cz/lib/exe/fetch.php/seznamy:syn2015_lemma_abc_utf8.zip' | |
SLOVNIK_ZIP="${SLOVNIK_URL##*[:/]}" | |
SLOVNIK_TSV="${SLOVNIK_ZIP%.*}.tsv" # ve formátu <pořadí> "\t" <slovo> "\t" <počet> | |
WORDFILE="${SLOVNIK_TSV%.*}.wordfile" | |
wget "${SLOVNIK_URL}" -O "${SLOVNIK_ZIP}" && | |
unar "${SLOVNIK_ZIP}" && | |
cut -f2 "${SLOVNIK_TSV}" | iconv -f UTF-8 -t ASCII//TRANSLIT | grep '^[[:lower:]]' | sort -u > "${WORDFILE}" && # odstraní diakritiku a vybere pouze slova začínající malým písmenem | |
printf "%s\n" "alias xkcdpass-cz='xkcdpass --wordfile \"$(realpath "${WORDFILE}")\"'" >> ~/.bashrc | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment