Skip to content

Instantly share code, notes, and snippets.

View etyurkin's full-sized avatar

Evgeniy Tyurkin etyurkin

  • Toronto
View GitHub Profile
;;; Major mode for uLisp
;;; M-x ulisp-connect (or C-u M-x ulisp-connect to change the default serial device).
;;;
;;; C-x C-e eval last sexp
;;; C-c C-e eval defun
;;; C-c C-k eval buffer
;;; C-c C-k eval region
;;; C-c C-t terminate running program
(require 'inf-lisp)
@etyurkin
etyurkin / org-babel-to-buffer.el
Last active September 2, 2020 23:51
C-c C-e to evaluate org source blocks to a separate buffer.
(defun kwarks--org-babel-get-result ()
"Get the result of the current source block."
(let ((location (org-babel-where-is-src-block-result)))
(when location
(save-excursion
(goto-char location)
(when (looking-at (concat org-babel-result-regexp ".*$"))
(buffer-substring
(save-excursion
(skip-chars-backward " \r\t\n")
@etyurkin
etyurkin / tree.el
Last active January 17, 2022 04:07
Emacs frontend for unix "tree" command
(require 'json)
(defvar tree-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "v" 'kwarks/tree-view-file)
(define-key map "o" 'kwarks/tree-find-file)
(define-key map (kbd "RET") 'kwarks/tree-find-file)
(define-key map "c" 'kwarks/tree-copy-node-path)
(define-key map "s" 'kwarks/tree-subtree)
(define-key map "r" 'kwarks/tree-reload)
@etyurkin
etyurkin / virtualbox.el
Last active January 4, 2019 17:38
Control VirtualBox VMs from Emacs with Helm
(defun helm--virtualbox-vms ()
(mapcar (lambda (str) (string-trim (car (split-string str " ")) "\"" "\""))
(split-string (trim (shell-command-to-string "VBoxManage list vms")) "\n")))
(defun helm--virtualbox-sources ()
`((name . "Virtual Box")
(candidates . ,(helm--virtualbox-vms))
(action . (("Status" . (lambda (candidate)
(let ((vm-info (shell-command-to-string (format "VBoxManage showvminfo \"%s\"" candidate))))
(save-match-data
@etyurkin
etyurkin / canadapost-status.el
Last active October 13, 2018 00:14
Emacs Lisp: check parcel location and status from Canada Post
(require 'json)
(defun canadapost-status (tracking-number)
"Check parcel location and status from Canada Post"
(interactive "MTracking number: ")
(with-temp-buffer
(url-insert-file-contents
(format "https://www.canadapost.ca/trackweb/rs/track/json/package?pins=%s" tracking-number))
(let* ((json-object-type 'hash-table)
(json-array-type 'list)
(defun org-display-decrypted-entry ()
"Display decrypted content of the current headline in a new read-only buffer."
(interactive)
(require 'epg)
(unless (org-before-first-heading-p)
(org-with-wide-buffer
(org-back-to-heading t)
(let ((heading-point (point))
(heading-was-invisible-p
(save-excursion
;; hash-pass http://hashapass.com/
(defvar hash-pass-password-wait-time "30 sec"
"The default period to wait before erasing the password from the clipboard.
Must be compatible with `run-at-time'.")
(defun string->clipboard (string)
"Copy STRING to system clipboard."
(funcall interprogram-cut-function string))
(defun hash-pass ()