Yes, the title of this article/entry is an intentional snowclone of Michelangelo's line from the 1990s Teenage Mutant Ninja Turtles movie, where he dodged a weapon and celebrated his abilities. Because I just had the same reaction with being someone who knows GNU Emacs and Elisp.

I spent today, while waiting/hoping for a call about whether or not I got a job (two weeks now, no word or response to an email I sent last week), working on doing some refactoring of the filterlog-ingest utility which I use with rsyslog to ingest the records from OPNSense's filterlog and place the data into a database table for Heimdallr. And, one of the things I did was split the utility into multiple parts, with a FilterLog class being pulled out and separated from the main routine, and instead of having the loop reading the input in the main routine, I added a method called run() to the class, which now does the looping instead of the main routine, and is now what calls a method called digest(). I am doing this because as soon as I am done with this, I am going to write another class, probably called something like HttpLog, tweak the main routine to call one or the other class depending on something, such as the name of the file with the main routine (which means 2 copies of the same file, or detecting the name of the shim file which may wrap around it), or a command line argument. And so, today was spent significantly beefing up the error handling of run() and putting it under unit tests to handle any sort of runtime error/exception which this method must catch to log and keep processing its input. Indeed, I will probably move run() into a parent class along with the __init__() method, and have things even DRYer than ever (DRY is the software development principle which comes from the phrase "Don't Repeat Yourself"), after which comes Heimdallr v2.0 (still undecided between Python/Django or Laravel, or htmx.)  But anyways, I ran into a problem... something called a "regular expression" (details in the collapsed text, below) I am using I am using in my last test is not working...

Now, we finally get to why I love knowing Emacs and Elisp. To debug my regex, I added a flag to the call to execute it, to give me something like this:

match = re.search(expected_errors_re, captured.err, re.DOTALL|re.DEBUG)

Unfortunately, this gives me a bunch of lines which read like this:

How many lines you ask... try 1781 of them... and each of those numbers represents a character, such as "32" meaning a space, "44" meaning a comma, and "101" meaning the lowercase letter "e". And here is where why I love Emacs and Elisp. Going through each of those lines one by one, looking at a table like this one, and entering each character one by one would be error prone and exhausting... But... (cue Superman theme, preferably from the first Christopher Reeve's movie)... I can do that automagically with an Elisp macro... and so, right before writing this, I wrote the following macro...

Huh?? Code blocks don't have Lisp as a text type... may have to look at that...

Anyways... I marked the text in Emacs, did what is called "narrowing" to restrict the editor to that section of the file I captured the output from the test run in, and did what in Emacs speak is:

M-x append-ascii-from-literal-decimals

where I hit the ESC key, followed by the X key, then type the name. And in less than a second, I have the result.  The result, you ask? Each line now looks like this:

Not perfect, since I have the " - " on all lines and not just those starting with "LITERAL ", but kinda like the saying goes, close enough that the difference is like a megaton nuke detonating over the Washington Monument instead of the White House... it is definitely close enough. Especially for a special macro I threw together in about the amount of time it took me to type it into my .emacs.el file.

Now, tomorrow, I can look at this output, and probably figure out a one or two character change to the regular expression, which for those of you who are curious, just happens to look like this:

Try doing this with VS Code, JetBrains PyCharm, or eclipse... and if somebody knows of an IDE or editor which can do the same, I would love to hear which one it is, and the details of how to do it. Sure, you probably could do it in Vim with Vimscript, or maybe Office, but I doubt I could understand the macro/command, much less know how to write it.

Like I said... G*d, I love being an emacs/elisp user!!!