From 9d30ab98bf2efcaf9cbfa95921e2b69401c79367 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Mon, 9 Jun 2025 15:23:47 -0400 Subject: [PATCH] [lib] begin work on the lib --- lib/lib-advent.org | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/lib-advent.org diff --git a/lib/lib-advent.org b/lib/lib-advent.org new file mode 100644 index 0000000..87f6533 --- /dev/null +++ b/lib/lib-advent.org @@ -0,0 +1,22 @@ +#+title: A collection of helper functions for Advent of Code +* inout manipulation +#+begin_src emacs-lisp :results none + (require 'dash) + (defun advent/replace-multiple-regex-buffer (regex-list) + "Takes REGEX-LIST as an alist ( regex . replacement ) + and applies each substitiution + " + (insert-file-contents "input") + (goto-char (point-min)) + (replace-regexp "\\([0-9]+\\),\\([0-9]+\\)" "(\\1 \\2)") + (goto-char (point-min)) + (insert "(setq data '(") + (goto-char (point-max)) + (insert "))") + (eval-buffer)) + (setq width 71 ;71 + height 71 + start-pos '(0 0) + end-pos (list (- width 1) (- height 1))) + (setq full-data data) +#+end_src