This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun drug-log () | |
"Log medication in org-roam daily with timestamp, amount, and type." | |
(interactive) | |
(org-roam-dailies-goto-today) | |
(let ((amount (read-string "Amount: ")) | |
(medicine (read-string "Medicine: "))) | |
(org-insert-heading) | |
(insert (format-time-string "%H:%M")) | |
(newline) | |
(insert (format "Amount: %s\nMedicine: %s" amount medicine)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq meow-paren-keymap (make-keymap)) | |
(meow-define-state paren | |
"meow state for interacting with smartparens" | |
:lighter " [P]" | |
:keymap meow-paren-keymap) | |
(setq meow-cursor-type-paren 'hollow) | |
(meow-define-keys 'paren | |
'("<escape>" . meow-normal-mode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun nb/quick-repo-clone (repo) | |
"Clone a GitHub repo to /tmp/ and open it in a buffer." | |
(interactive "sEnter GitHub repo URL: ") | |
(let* ((url (url-generic-parse-url repo)) | |
(path (url-path-and-query url)) | |
(dir-name (file-name-nondirectory (car path))) | |
(dir (expand-file-name dir-name "/tmp/"))) | |
(message "Cloning %s to %s..." repo dir) | |
(shell-command (format "git clone %s %s" repo dir)) | |
(when (file-directory-p dir) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-context-aware-help-at-point () | |
"Call sly-describe-symbol in sly buffers, otherwise helpful-at-point." | |
(interactive) | |
(if (or (derived-mode-p 'lisp-mode) | |
(bound-and-true-p sly-mode) | |
(member major-mode '(sly-mrepl-mode | |
sly-inspector-mode | |
sly-db-mode | |
sly-xref-mode | |
sly-stickers-mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun nb/stitch-images () | |
"Stitch images together horizontally or vertically using ImageMagick." | |
(interactive) | |
(let* ((files (completing-read-multiple "Select images (comma-separated): " | |
(directory-files default-directory t "\\.\\(jpg\\|png\\|gif\\)$"))) | |
(direction (completing-read "Direction (h/v): " '("h" "v"))) | |
(output-file (expand-file-name (read-file-name "Save as: "))) | |
(append-type (if (string= direction "h") "+append" "-append")) | |
(status (apply #'call-process "magick" nil "*magick-output*" nil | |
(append files (list append-type output-file))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defgroup gptel-context nil | |
"Context helpers for gptel." | |
:group 'gptel) | |
(defcustom gptel-context-lines-around 10 | |
"Number of lines above and below point to add as context." | |
:type 'integer | |
:group 'gptel-context) | |
(defun gptel-context-add-lines-around () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- lexical-binding: t -*- | |
(require 'request) | |
(require 'json) | |
(defun sd-webui-generate-image (prompt) | |
(interactive "sPrompt: ") | |
(let* ((api-url "http://192.168.1.47:7860/sdapi/v1/txt2img") | |
(prog-url "http://192.168.1.47:7860/sdapi/v1/progress") | |
(out-file (expand-file-name | |
(format "sd-%s.png" (format-time-string "%Y%m%d%H%M%S")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'url) | |
(require 'dom) | |
(require 'cl-lib) | |
(defvar myrient-max-recursion-depth 5 | |
"Max recursion depth for scraping Myrient files.") | |
(defun myrient-valid-subdir-p (url base-url) | |
"Check if URL is a valid subdirectory under BASE-URL without malformed parts." | |
(and (string-prefix-p base-url url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun pacman-run-command (command &optional special-buffer) | |
"Run shell COMMAND in a dedicated buffer and switch to it." | |
(let ((buffer (get-buffer-create (or special-buffer "*Pacman Output*")))) | |
(with-current-buffer buffer | |
(setq buffer-read-only nil) | |
(erase-buffer) | |
(compilation-mode) | |
(setq buffer-read-only t)) | |
(async-shell-command command buffer) | |
(pop-to-buffer buffer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar my-emms--temp-file nil | |
"Full path of the temporary file that EMMS is currently playing. | |
The value is set by `my-emms-play-remote' and cleared by `my-emms--cleanup'.") | |
(defun nb/emms-play-remote (tramp-path) | |
"Play a remote audio file via EMMS (mpv backend). | |
TRAMP‑PATH is a Tramp‑style file name, e.g. | |
`/ssh:nullbath@homelab:/home/nullbath/music/track.mp3'. |