Skip to content

Instantly share code, notes, and snippets.

View aserranoni's full-sized avatar
🎯
Focusing

Ariel Serranoni aserranoni

🎯
Focusing
View GitHub Profile
@aserranoni
aserranoni / gist:a1833fba8518e317cdeb93855ff98281
Created February 28, 2024 01:40
Making pact a bit more human-readable via org-mode
(defun org-babel-execute:pact (body params)
"Execute a Pact block with specified parameters."
(let* ((tempfile (org-babel-temp-file "pact-" ".repl"))
(pact-process (start-process "pact-repl" "*pact-repl-output*" "pact"))
(load-command (format "(load \"%s\")\n" tempfile))
(output-buffer "*pact-repl-output*"))
;; Ensure the REPL is ready
(sleep-for 1) ;; Adjust based on REPL start time
;; Write body to temporary file
(with-temp-file tempfile
@aserranoni
aserranoni / fv.repl
Created February 6, 2024 23:36
Simple repl example showing bad interaction between typechecking/ formal verification with where function
(begin-tx "module")
(env-data
{ 'ns-admin-keyset: ["admin"]
, 'ns-operate-keyset: ["operate"]
, 'ns-genesis-keyset: { "keys": [], "pred": "="}
, 'ns: "la"
, 'upgrade:false})
(env-keys ["admin", "operate"])
@aserranoni
aserranoni / gist:3ff260f52a61180036e63181fc87cd77
Created October 19, 2023 01:58
A life without yabai window borders
# I've been using a combination of yabai, skhd (with modal keybindings), and sketchybar.
## Recently, with the deprecation of the window border in yabai. I had to find a way to
## keep track of the skhd current mode.
# Add the following lines to sketchybarrc:
sketchybar --add item mode_indicator left
sketchybar --set mode_indicator drawing_method=separator
sketchybar --set mode_indicator label="default-mode | "
@aserranoni
aserranoni / hist.el
Last active February 22, 2023 01:45
Homemade emacs-lisp functions to search bash history and copy commands to the clipboard
(defun ariel/get-file-lines (filename)
(with-temp-buffer (insert-file-contents filename)
(cl-remove-duplicates (split-string (buffer-string) "\n" t)))
)
(defun ariel/copy-string-to-clipboard (str)
(with-temp-buffer (insert str)
(clipboard-kill-region (point-min) (point-max))))
(defun ariel/get-command-from-bash-history ()