Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (75 sloc) 2.33 KB
(require 'request)
(defun get-password (name)
(let* ((results (auth-source-search :host name))
(result (car results))
(secrets (plist-get result
(secret (first (aref (aref secrets 2) 0)))) secret))
(defun microblog ()
"Post without title."
(if (yes-or-no-p "Are you sure you want to post this? ")
(switch-to-buffer (org-md-export-as-markdown))
(request ""
:type "POST"
:data `(("h"."entry")
("content" .
:headers `(("Authorization" . ,(format "Bearer %s" (get-password "microblog"))))
:success (cl-function (lambda
(message "Success")))))))
;; Create new blank buffer. Stolen from;
(defun new-empty-buffer ()
"Create a new empty buffer."
(let (($buf (generate-new-buffer "untitled")))
(switch-to-buffer $buf)
(funcall initial-major-mode)
(setq buffer-offer-save t)
;; Check if current system is windows
(defun is-windows ()
(eq system-type 'windows-nt))
;; Check if current system is not windows
(defun is-not-windows ()
(not (eq system-type 'windows-nt)))
(defun is-mac ()
(eq system-type 'darwin))
(defun is-linux ()
(eq system-type 'gnu/linux))
(defun save-all ()
(save-some-buffers t))
(defvar current-date-time-format "%a %b %d %H:%M:%S %Z %Y"
"Format of date to insert with `insert-current-date-time' func
See help of `format-time-string' for possible replacements")
(defun get-url()
(format-time-string "/%Y/%m/%d/"))
(defun get-datestring()
(format-time-string "%Y-%m-%dT%T"))
(defun get-timestring()
((lambda (x)
(concat (substring x 0 3) ":" (substring x 3 5)))
(format-time-string "%z")))
(defun get-timezone() (format-time-string "%z"))
(defun insert-datetime ()
(insert (concat (format-time-string "%Y-%m-%dT%T")
((lambda (x)
(concat (substring x 0 3) ":" (substring x 3 5)))
(format-time-string "%z")))))
(defun eshell-new()
"Open a new instance of eshell."
(eshell 'N))
(provide 'funcs)
You can’t perform that action at this time.