diff --git a/emacs/.emacs.d/config/init-lib.el b/emacs/.emacs.d/config/init-lib.el index 3784768..ce0b693 100644 --- a/emacs/.emacs.d/config/init-lib.el +++ b/emacs/.emacs.d/config/init-lib.el @@ -126,4 +126,12 @@ (use-package shut-up :commands (shut-up)) +(defun urandom (len) + "Generate a random string of length LEN using /dev/urandom." + (interactive "nLength: ") + (let ((rand (shell-command-to-string (format "head -c %d /dev/urandom | base64" len)))) + (when (called-interactively-p 'any) + (kill-new (message rand))) + rand)) + (provide 'init-lib)