Emacs for Devops

Alexey Koval has a nice post on Emacs as a devops editor. It’s from a little over a year old but it’s still worth taking a look at. I’m not involved with devops but I still learned a few useful things from the post and accompanying videos.

For example, Koval shows how to debug shell scripts from Emacs using bashdb. That can be really handy when your script is more than a few lines long. Of course, you can also run the script from inside Emacs and test things as you go along. In that respect, it’s another example of interactive programming, a method that I find especially useful.

He also has a nice section on using tramp to work with remote files. I tend to do stupid things like opening an SSH session to list the files to find the name of the file I want but as Koval shows, you can just open the remote directory you’re interested in to get a dired listing from which you can pick whatever file you need. Once you’ve got a remote session going, you can even start a remote shell that reuses the same SSH connection that tramp is using.

There are 7 short videos in the post that illustrate the points Koval’s making. My only complaint about them is that he doesn’t have a key display utility so it’s sometimes hard to follow what he’s doing. Nonetheless, the videos are really useful and I learned some new tricks from them.

The post is definitely worth looking at even if you’re not involved with devops.

Posted in General | Tagged | Leave a comment

Adtech: Everything That's Wrong with the Internet?

Kontra takes note of this New York Times article:

The article is by Farhad Manjoo, who in his usual hyperventilating way (remember tech addiction is destroying us and it’s up to Apple to fix the problem?) lists many of the terrible, horrible, no good, very bad things that happen on the Internet. His conclusion is that it’s mostly the fault of on-line advertising.

If you find that a bit hyperbolic, it’s because it is. Yes, on-line advertising, as currently practiced through adtech, is abusive and threatens our privacy and yes some of the sketchier sites exist solely as a way of gathering advertising clicks but the advertisers also provide most of the excellent—and free—content that we enjoy on the Internet.

Regular readers know I have an enduring hatred of adtech and its many abuses. I was, therefore, sympathetic to the notion that everything wrong on the Internet is its fault. But reality intruded and I had to admit that most of the worst things that happen on the Internet have little to do with adtech. That’s not to say that the Internet wouldn’t be a far better place without adtech, it’s just that adtech isn’t the source of everything that’s wrong with it.

So, sadly, the title of today’s post stands as yet another confirmation of Betteridge’s law.

Posted in General | Tagged , | Leave a comment

The UPSide Project

Last week I wrote about Eric Raymond’s UPS rant. If you missed that, the TL;DR is that UPSes are horrible, don’t do what they’re supposed to do or meet their specs, and mostly excel only in inducing rage in their users. Raymond observed that it’s a product ripe for disruption and that perhaps we should form a team to provide some. Raymond, of course, is more than capable of handling the software end of things but needed someone to handle the hardware aspects. He ended his post by asking anyone interested in working on such a project to get in touch with him.

In an update to his original post, Raymond writes that the response to his post was astonishing and resonated with a surprising number of people. As a result, the effort, named the Project UPSide, is indeed underway and looking for people to help out. The project appears to have found a hardware engineer but is still looking for someone familiar with programming USB endpoints and someone who understands battery-state modeling. If you can fill either of those positions or if you have ideas or suggestions, get in touch by opening an issue in the project’s GitLab tracker.

The goals of the project, as I understand them, is find an alternative to the lead acid batteries used by the UPS vendors that will provide a longer dwell time and a decent lifetime, and to provide an intelligent interface to the computer that would allow a reasonably technically competent person to write a monitoring program that meets their needs. This seems like a very worthwhile effort to me—as I said in the last post, I live in Tampa and really need UPS protection—so I’d be very interested in such a product.

Posted in General | Tagged | Leave a comment

Structures in Emacs Lisp

Chris Wellons over at Null Program has another great post. It considers how to define and use structures in Emacs Lisp. What I like most about the post is that it starts with the obvious solution of using a list to hold the structure and accessing the elements of the structure with the nth function or something similar but notices the problems that such a strategy can bring.

One such problem is that it’s hard to remember which slots in the list corresponds to which items in the structure. This is especially hard on readers but can also trip up the original author. Another issue with using the nth strategy is that it effectively freezes the slot positions and makes it hard to modify the program.

To solve these problems, Wellons introduces some accessor functions to access the structure items by name. Then he does the same thing for setting the functions by making them settable with setf. At that point, he’s got a pretty nice solution but has written a lot of boiler plate. He observes that a natural solution is to write a macro to write all the boiler plate and says that Emacs, of course, has already done this with the cl-defstruct macro.

Most Elisp programmers have probably used cl-defstruct but never thought much about why it exists or how it works. That’s what’s great about Wellon’s post: it shows how cl-defstruct grows naturally out of finding a solution for a common need and the problems that the obvious solution to that need entails.

The rest of Wellon’s post considers changes coming in Emacs 26. If you do any Elisp programming at all, you should definitely read this post. It’s full of good information—way more than I’ve discussed here—and news of what we can expect, as far as structures are concerned, in Emacs 26.

Posted in General | Tagged | 1 Comment

What Has Emacs Replaced Your Workflow

I always think of my Emacs configuration as a Japanese garden: it’s always underway but never reaches perfection. The other day, I saw this tweet:

and followed the link hoping to discover something else I could replace with Emacs.

It’s amazing how many applications people have replaced with Emacs but sadly the list of things people had replaced fell into two categories:

  1. Things I had already replaced;
  2. Things I hadn’t replaced because I don’t use them.

Still, I haven’t given up hope and will continue searching for things I can bring under the Emacs umbrella. After all, the point of a Japanese garden is that it is never finished.

Posted in General | Tagged | 6 Comments

Zamansky 41: Pandoc

Mike Zamansky has the latest video in his Using Emacs Series up. This time it’s about leveraging Pandoc to deal with document interchange. I’ve written about Pandoc before but usually in the context of converting an Org document to some other format, such as Word docx. In this video, Zamansky goes in the other direction and converts an HTML document to Org mode.

Here’s the problem Zamansky is trying to solve: He has a lab assignment as an HTML file that he would like to modify to better fit a class he’s teaching. He could, of course, just edit the original file but the HTML is really ugly—it looks like it was generated by some other program—and Zamansky didn’t want to waste his time and suffer the pain of working with it. Instead, he used Pandoc to convert the HTML to Org, which is easy to understand and edit.

He could, of course, export (or convert with Pandoc) the edited Org file back to HTML or whatever other format he needed but all his assignments are handled through GitHub so he just uploaded the Org file and let GitHub worry about the formatting. All in all, a nice solution to the common but annoying problem of needing to edit a file in an inconvenient format.

In the comments, Zamansky says that before working on this problem, he didn’t realize Pandoc could convert to Org. I didn’t either but I always assume—not always but usually correctly—that Pandoc can convert between any two formats that I’m apt to come across.

The video is short, just 4 minutes, 36 seconds, so it should be easy to find time for it.

Posted in General | Tagged , | Leave a comment

Org-Noter

I’ve been happily using Interleave to takes notes while reading PDFs ever since I read about it in Piotr Limanowski’s excellent post on Reading for Programmers. It’s a great way to take notes that are synchronized with the PDF.

Gonçalo Santos has produced a similar system, org-noter, that provides much of the same functionality as well as some others. I temporarily loaded it so I could try it out. One thing from the documentation that I liked about it was that it can remember your place in the PDF so that it’s easy to take up where you left off. With Interleave, I do that by making a temporary note that I delete when I continue reading. Sadly, I couldn’t get that feature of note-taker to work. I’m probably doing something wrong but it’s not obvious what.

Other than a couple of minor items in the way it handles the notes buffer, it operates pretty much like Interleave. There are not enough differences to get me to switch but if you haven’t loaded either yet, it’s worthwhile trying them both out.

If you’ve used org-noter and have thoughts on it, please leave a comment and enlighten us all.

Posted in General | Tagged | 2 Comments

Paper Jams

Paper jams. We all know about them, we’ve all experienced them, and we’ve all cursed at them. What most of us probably haven’t done is think very much about them. If you’re like me you just consider them something that happens when a sheet of paper gets a bit skewed or perhaps the humidity is too high. It had never occurred to me that there are people whose sole job is to worry about and find solutions for them. And it’s not just one, slightly deranged looking fellow stuck in a closet somewhere deep in the bowels of Xerox; it’s whole teams of engineers with their own laboratories.

The New Yorker has a really interesting article on paper jams, some of their causes, and the teams of people who work to eliminate them. All Xerox printing presses, from the million dollar giant presses used to print books to the humble office copier are basically the same. The giant presses actually have an advantage—as far as paper jams are concerned—because their size means the paper path can be more linear than that of an office copier where the path contain some sharp turns.

The main problem, of course, is the paper. Low quality paper is much more likely to cause jams. That’s why it’s worth paying a bit more for good copier paper: less jams. But the problem is more than just poor quality paper. The New Yorker article begins with a recounting of an incident in Asia where a Xerox press was being used to print a book. The paper was very lightweight like that in a Bible and the lack of stiffness and humidity in the printing plant caused the edge to droop a little at a critical point starting off a cascade of jammed sheets.

Back at the Xerox Engineering Campus in Rochester, NY, engineers had produced a computer simulation of the jam so that they could study it and engineer a solution. Many different solutions were suggested and discussed before a simple and elegant one was found.

I’m pretty sure that almost all Irreal readers will enjoy this article. It doesn’t have much to do with computers or software but is fascinating nonetheless. Give it a read when you have a few minutes.

Thanks to John Gruber for link.

Posted in General | Tagged | Leave a comment

Emacs Tweaks from Other Editors

Ruben Berenguel has a useful post on Emacs tweaks from other editors. Berenguel works at a company where virtually everyone uses a different editor and even though he’s an Emacs user, he gets to see useful features from the competition.

Berenguel decided to to try to recreate some of those features in Emacs. He begins with Magnar Sveen’s excellent multiple cursors, which many, or perhaps most, of us already use. He then moves on to a few other packages that recreate features from those other editors that make the editing experience easier.

You may or may not want to use any of Berenguel’s tweaks but it’s certainly worthwhile taking a look to see if they’re something that could improve your workflow.

Posted in General | Tagged | 2 Comments

The UPS Follies

Eric Raymond has a splendid rant about the lossage that goes by the name of UPS systems. They are, he says—at all price ranges—garbage. They don’t, as a rule, meet their specs, have reasonable display of errors, or allow for intelligent monitoring of their operation.

Here in Tampa, Florida, a UPS is a necessity. During the summer we get daily thunderstorms that sometimes make the power blink off for a second or two. Just long enough to cause a reboot. Modern Unices are much better at recovering from this sort of thing than they used to be but you sill don’t want unexpected reboots, especially when you can get another before the first reboot finishes.

Like Raymond, I have suffered through the annoyances and inconveniences that using a UPS brings. I used to buy the best ones I could find but, as Raymond notes, that makes no difference. You might as well burn your money. So now I just grab one from Sam’s or Best Buy and throw it away when it dies. I wouldn’t mind spending a little more to get a decent product but that doesn’t appear possible.

Raymond says that making a good UPS isn’t hard and needn’t be expensive. He suggests a little disruption from the bottom. He’s volunteering to write the firmware but doesn’t have the hardware chops to put the rest together. If you know something about that and are interested in improving everyone’s life, let Raymond know. One of the commenters suggested doing a Kickstarter or similar fund raiser to get things going.

Even if you can’t help out, read Raymond’s post. It will make you feel better in a misery loves company sort of way.

Posted in General | Tagged | Leave a comment