docs(Emacs elisp, misc): migrate custom functions to package
All checks were successful
deploy / build (push) Successful in 3m22s
All checks were successful
deploy / build (push) Successful in 3m22s
This commit is contained in:
parent
00b40eca02
commit
27e912d9a1
@ -40,34 +40,8 @@ APPEND and COMPARE-FN, see `add-to-list'."
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Generate and insert random passwords
|
** Generate and insert random passwords
|
||||||
#+begin_src emacs-lisp
|
These functions got replaced by my custom package, see [[file:./misc.md#password-generator][Password
|
||||||
(defun my/generate-password (nb-chars)
|
generator]].
|
||||||
"Generate an alphanumeric password of NB-CHARS."
|
|
||||||
(shell-command-to-string
|
|
||||||
(concat "tr -dc 'A-Za-z0-9!@#$%^&*' < /dev/urandom | head -c "
|
|
||||||
(number-to-string nb-chars))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defun my/copy-generated-password (&optional prefix)
|
|
||||||
(interactive "P")
|
|
||||||
(kill-new
|
|
||||||
(my/generate-password (if prefix
|
|
||||||
(string-to-number
|
|
||||||
(completing-read "Amount of characters: " nil))
|
|
||||||
32))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defun my/insert-generated-password (&optional prefix)
|
|
||||||
(interactive "P")
|
|
||||||
(insert
|
|
||||||
(my/generate-password (if prefix
|
|
||||||
(string-to-number
|
|
||||||
(completing-read "Amount of characters: "
|
|
||||||
nil))
|
|
||||||
32))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Handle new windows
|
** Handle new windows
|
||||||
The two functions below allow the user to not only create a new window
|
The two functions below allow the user to not only create a new window
|
||||||
|
@ -244,6 +244,20 @@ and builds a heatmap out of it.
|
|||||||
"Main Page")))) ; Default page
|
"Main Page")))) ; Default page
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Password generator
|
||||||
|
I used to have some simple Elisp functions in my config that would
|
||||||
|
generate passwords on the fly, but they were a bit too limited in my
|
||||||
|
opinion. So instead, I went on to create a full package that would
|
||||||
|
help me create one from a transient menu with enough options for my
|
||||||
|
liking.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package password-gen
|
||||||
|
:straight (password-gen :build t
|
||||||
|
:type git
|
||||||
|
:repo "https://labs.phundrak.com/phundrak/password-gen.el.git")
|
||||||
|
:defer t)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Pinentry
|
** Pinentry
|
||||||
I like to use Emacs as my pinentry program. Mainly because it’s the
|
I like to use Emacs as my pinentry program. Mainly because it’s the
|
||||||
easiest way for me to type then when I’m SSHing into my machine, but
|
easiest way for me to type then when I’m SSHing into my machine, but
|
||||||
|
Loading…
Reference in New Issue
Block a user