commit b1d56209f7f24d149bb879a078d6e89624022b9d
parent 432b838b35b2fc0f01203a99fcad78d65f619f71
Author: Lukas Henkel <lh@entf.net>
Date: Tue, 20 Jul 2021 21:53:41 +0200
Add utils
Diffstat:
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/config.org b/config.org
@@ -130,6 +130,17 @@ Doesn't have a default keybinding.
#+begin_src emacs-lisp
(global-set-key (kbd "C-x C-M-t") #'transpose-regions)
#+end_src
+* Dependencies
+** request
+#+begin_src emacs-lisp
+ (use-package request
+ :straight t)
+#+end_src
+** uuidgen
+#+begin_src emacs-lisp
+ (use-package uuidgen
+ :straight t)
+#+end_src
* Basic QOL Packages
** which-key
Shows the possible keybindings in a neat menu.
@@ -372,9 +383,14 @@ Emacs EPub reader.
:straight t
:mode ("\\.epub\\'" . nov-mode))
#+end_src
+** utils
+#+begin_src emacs-lisp
+ (require 'utils)
+#+end_src
* Private stuff
#+begin_src emacs-lisp
(let ((path (expand-file-name "private.el" user-emacs-directory)))
(when (file-exists-p path)
(load path)))
#+end_src
+
diff --git a/lisp/utils.el b/lisp/utils.el
@@ -0,0 +1,17 @@
+ ; This file contains a bunch of utilities
+ ; both for use in scripts, but also interactive functions
+
+(require 'uuidgen)
+
+(defun util-insert-uuid ()
+ "Insert UUID at point"
+ (interactive)
+ (insert (uuidgen-4)))
+
+(defun util-base64-encode-file (filename)
+ (with-temp-buffer
+ (insert-file-contents filename)
+ (base64-encode-region (point-min) (point-max))
+ (buffer-string)))
+
+(provide 'utils)