www.bundesbrandschatzamt.de
Babblings about Systems Administration.

500 commits

Having 500 git commits on an editors configuration files is quite a number. I think it’s a good reason for another recap.

A machinist builds his own tools. The same rule should apply to somebody working in Development or Systems Administration.

It makes your live easier and in the end it will speed you up.

You want to have

Over the years I learned how important documentation is. I don’t mean Howtos, program documentation, wikis and stuff like that. I am talking about your daily work. Projects you are working on.

Recently I had issues with an HP Vertica cluster in production. Customer facing applications were accessing the system. Performance went down. In the end it was related to problems on AWS. But it kept me busy for the better half of a week. I am talking about late hours. If you would have asked me the next day what I have done the day before my answer would have been: I have no clue! But the next sentence would have been: But I got my notes! Every shell command executed, every sql command executes. Including the output and some thoughts I had in my mind were in a text file. Impossible? Too much overhead? Pick the right tools: orgmode and especially org-babel

And the best part of it: I wrote a small code snippet. By pressing just C-c J Emacs executes bba-org-export-jira-clipboard. And it does exactly that: It takes my notes in orgmode and converts them to Atlassian Jira syntax, saves it in the clipboard, exports the orgmode to a file in tmp named after the ticket and opens OSX finder. I just have to add comment in the ticket, press insert, attach my file and done. As long as I don’t hit the maximum number of characters per comment in Jira. But that’s a different story.

Last year I got a special task. A legacy application with a web interface. It contained a huge number of reports. Each report had database connection strings in it. No central way to modify them. But we found a way to export and import them. We had around 80 zip files with directories and xml files in it. Sounds like the work for some days, right? Wrong! Emacs is able to open zip files on the fly and present you the directories in it. Without leaving the editor I could modify the files. Have I mentioned the structure was similar? I kept track of the steps, recorded a keyboard macro and within 1 hour the job was done and the application was working again.

We all know the situation: Short before end of day you got the insight of a problem. You finally understood what to do. You have multiple files open. You can stay till you solved it. Or you can use org-store-link and take some notes with links to the positions in your files. No need to stay long. Next day you check your notes and know what to do.

For documentations I had to take screen-shots of ncurses based applications. Turns out that tmux and some glue code can insert it into orgmode. Another small function provides you an easy option to add arrows for highlighting. Remember: we don’t have ansi colors in orgmode.

I keep track of my working hours. Not only welcomes me Emacs with the orgmode file. It jumps to the right heading or even creates the heading for the current month of the year. After my oncall shift I might have to create a report about working times for incidents. Guess what: Just a yasnippet away!

Being a generalist means a lot of what you learned and figured out is not getting used on a daily basis. The result: It’s hard to remember! Don’t bother yourself: Take notes. Just because you do something for your current employer doesn’t mean you cannot take a second pair of notes without company related information. My orgmode file has currently 8162 lines, 42237 words and 333931 characters. I would be in deep trouble if I would loose that information. The solution: a git repository checked out on multiple systems.

Overall it’s the small stuff that makes your life easy and sums up.

In Vertica training sessions I took minutes in orgmode. Having sql code blocks which were slightly modified to highlight differences. Lazy as I am I wrote a small function to search for the last code block, copy it and insert it at the current position. Huge timesafer and office gossip for days. In the beginning it was a saved keyboard macro. Later I turned it into elisp.

How often have you to duplicate the previous line and make small changes? My answer is now M-d.

Recently I learned - yes even after 20 years of Emacs you learn! - about copyright-update and the environment variable ORGANIZATION. Added to the before-save-hook and you don’t have to think about it.

One of my biggest timesafers: Keyboard macros. Nothing for every day but every other month you got a file which has to be converted into something different. Or you got a list and have to create something out of it. Split your screen into 2 windows. start the macro on the first item, copy to clipboard, jump to the other window, do your thing and jump back to the next item in the other window. End macro, execute and enjoy your coffee. Over the years i transformed that way Nagios configfiles, json to yaml, Excel to json. And you can even safe the macros for later use if you have a use case for it. You can integrate one of the oldest directory editors called Dired in your macros, too.

But the tiny helpers don’t have to be limited to the emacs sandbox. I can

Ok. I have to admit: Keyboard Maestro plays a big role.

What’s next?

There is still a lot to explore. I have an extension for Vertica for org-babel in my configuration overdue to push to upstream. Leiningen and ejc-sql look interesting. Learning more Emacs Lisp will be a good investment for the next 20 years. Emacs is already 41 years old. The community is more active then ever. I don’t see any reason for using anything different in the next 20 years.