mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
Merge pull request #293 from ryan4yin/feat/genpass-nu-command
feat(shells): add genpass nu command to generate random passwords
This commit is contained in:
1 parent
8427dee2e6
commit
621da40081
1 file changed
+6
@@ -88,6 +88,12 @@ def dus [path: string = ""] {
|
||||
}
|
||||
}
|
||||
|
||||
# Generate a secure random base64 password of `length` characters (default 12).
|
||||
def genpass [length: int = 12] {
|
||||
let bytes = (($length * 3 + 2) / 4 | math ceil) + 3
|
||||
^openssl rand -base64 $bytes | str trim | str substring 0..<$length
|
||||
}
|
||||
|
||||
# ---------------------------
|
||||
# Commandline Editor Settings
|
||||
# ---------------------------
|
||||
|
||||
Reference in new issue
Block a user