Skip to content

Instantly share code, notes, and snippets.

@akssri
Created September 1, 2025 10:50
Show Gist options
  • Select an option

  • Save akssri/92a3b240c89212815a66e86c60eabde8 to your computer and use it in GitHub Desktop.

Select an option

Save akssri/92a3b240c89212815a66e86c60eabde8 to your computer and use it in GitHub Desktop.
totp.el
(defun call-function-on-region (cmd args &optional b e)
(let ((buf (buffer-substring b e)))
(with-temp-buffer
(apply #'call-process cmd nil t nil (append args (list buf))) ;;(split-string buf)))
(let ((bufstr (buffer-string)))
(x-select-text bufstr)
(kill-new bufstr)
(princ bufstr)))
(deactivate-mark)))
(defun totp (&optional b e)
(interactive "r")
(call-function-on-region "oathtool" '("--totp" "-b" "-d 6") b e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment