Using embark-bindings
, together with vertico, orderless, and marginalia, you can easily search through available bindings.
This file contains 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
;;===> hammerspoon-shell | |
;; Quick and dirty shell with interactive history search and persistence | |
;; Just drop into your ~/.emacs file. | |
;; | |
;; A hammerspoon buffer is any lua buffer visiting a pathname like | |
;; **/*hammerspoon**/*.lua | |
;; Usage: M-x hammerspoon-shell, or Hyper-s in a hammerspoon buffer. | |
;; In any hammerspoon buffer, Hyper-c runs dofile(file) on the visited file. | |
;; | |
;; Tip: to reload a Spoon "MySpoon" without hs.reload: |
This file contains 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
ax=hs.axuielement | |
dockAX = ax.applicationElement(hs.application("Dock")) | |
ids={"mc","mc.display","mc.spaces"} | |
scf={} | |
for i,id in ipairs(ids) do | |
table.insert(scf,ax.searchCriteriaFunction( | |
{{attribute="AXRole", value="AXGroup"}, | |
{attribute="AXIdentifier",value=id}})) |
This file contains 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
import lvgl as lv | |
import display | |
fontBase = 'font_montserrat' | |
# Colors (+ BLACK and WHITE, NONE = black) | |
# AMBER BLUE BLUE_GREY BROWN | |
# CYAN DEEP_ORANGE DEEP_PURPLE GREEN | |
# GREY INDIGO LIGHT_BLUE LIGHT_GREEN | |
# LIME NONE ORANGE PINK | |
# PURPLE RED TEAL YELLOW |
This file contains 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
import numpy as np | |
from astropy.table import Table | |
from astropy.table.pprint import TableFormatter | |
def fmt_func(fmt): | |
return lambda val: (f'{val["par"]:{fmt}} ' | |
f'({val["pmn"]:{fmt}}, {val["pmx"]:{fmt}})') | |
PAR_DTYPE = np.dtype([('par', 'f8'), ('pmn', 'f8'), ('pmx', 'f8')]) |
This file contains 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
""" %chain - IPython magic to inspect and move along exception chains. | |
JD Smith (2022) | |
Chained exceptions are associated with the messages: | |
"During handling of the above exception, another exception occurred" | |
"The above exception was the direct cause of the following exception" | |
and post-mortem debugging (%debug) by default can only examine the |
This file contains 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/org-transpose-view () | |
(interactive) | |
(let* ((tree (org-element-parse-buffer 'headline)) | |
(buf (current-buffer)) | |
(tbuf (concat "*" (buffer-name buf) "-transpose*")) | |
tp) | |
(org-element-map tree 'headline | |
(lambda (hl) | |
(if (eq (org-element-property :level hl) 2) ;only level 2 | |
(let* ((l2 (org-element-property :raw-value hl)) |
This file contains 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/org-link-heading-here (cand) | |
(when-let ((marker (get-text-property 0 'consult--candidate cand))) | |
(save-excursion | |
(with-current-buffer (marker-buffer marker) | |
(goto-char marker) | |
(org-store-link nil t))) | |
(org-insert-all-links 1 "" " "))) | |
(defvar-keymap embark-consult-org-heading-map | |
:doc "Keymap for operating on org headings" | |
:parent embark-general-map |
This file contains 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
(defmacro with-convenient-slots (slots obj &rest body) | |
"Convenience wrapper for read/write access to struct data. | |
Bind slot names SLOTS (a list) within the `my-struct' | |
record OBJ, and execute BODY." | |
`(cl-symbol-macrolet | |
,(cl-loop for slot in slots | |
collect `(,slot (,(intern (concat "my-struct-" | |
(symbol-name slot))) | |
,obj))) | |
,@body)) |
This file contains 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-local eglot-report-didChange-marker nil) | |
(defvar-local eglot-report-didChange-buffer nil) | |
(defun eglot-report-didChange (change-beg change-end prev-len) | |
"Scan eglot events buffer and report textDocument/didChange events compactly. | |
Invoke this command in a given eglot events buffer." | |
(save-excursion | |
(goto-char eglot-report-didChange-marker) | |
(while (re-search-forward | |
"(:jsonrpc \"2.0\" :method \"textDocument/didChange\"" nil t) | |
(goto-char (match-beginning 0)) |
OlderNewer