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