Skip to content

Instantly share code, notes, and snippets.

@rotaliator
rotaliator / b64encode.clj
Last active February 19, 2025 11:58
base64 encode clojure
(import '(java.util Base64))
(defn b64encode-to-bytes [to-encode]
(.encode (Base64/getEncoder) (.getBytes to-encode)))
(defn b64encode [to-encode]
(.encodeToString (Base64/getEncoder) (.getBytes to-encode)))
(defn b64decode [to-decode]
(String. (.decode (Base64/getDecoder) (.getBytes to-decode))))
@rotaliator
rotaliator / elisp-time-duration.el
Created November 23, 2023 16:56
Elisp time between
(defun rot-time-duration (begin &optional end)
(if end
(org-minutes-to-clocksum-string
(- (org-duration-to-minutes end)
(org-duration-to-minutes begin)))
(seq-let (begin end) (mapcar 's-trim (s-split "-" begin))
(rot-time-duration begin end))))
;; (rot-time-duration "9:00" "17:00")