Extract Captions From a Youtube Video

Ag Ibragimov had a problem that many of us have experienced. He learned a term from a video but later couldn’t recall the term. We went back to the video to search for it but couldn’t find it. What to do?

Ibragimov realized that he was working too hard and that what he really needed to do was capture the close captioning from the video. This was meant to be a one-off to solve a specific problem so he didn’t do anything fancy. He used youtube-dl to grab the video and wrote a bit of Elisp to extract the actual text.

After a while he realized that it was generally useful and bundled everything up into an Emacs package. Since then he’s added timestamps to the output. He’s not yet pushed it to Melpa but perhaps that will come later when he feels the package has stabilized.

This package, like many, resulted from a small itch that Ibragimov scratched by leveraging an existing command line app and writing some Elisp to process the data that it retrieves. It was later that he realized that he could use it again for other videos and that it might be useful to others too. It’s something to remember when you consider whether it’s worth writing some code for a task that you could do manually. Maybe you can’t amortize your time with a single use but it’s also possible that you and others will find it generally useful.

Posted in General | Tagged | Leave a comment

Mandated Editor

I recently came across a truly awful post to the Emacs subreddit. It wasn’t the post itself; it’s what it revealed. The post asked how to counter FUD from users of the bling-centric editors that Emacs was old technology that couldn’t hope to compete with “modern” editors such as VS Code and Jetbrains. There’s nothing wrong with that, of course. As keepers of the faith, it’s our duty to counter and shutdown that nonsense whenever it raises its head.

Rather, it was the backstory that was disturbing. The story is about his old company and a friend who is still there. That company has recently decreed that all developers have to use VS Code: it’s the new company standard.

There’s nothing wrong with VS Code, of course, although users may want to think twice before committing. The problem is telling developers they have to use VS Code. Can you imagine trying to tell a surgeon they had to use a certain brand of scalpel? You’d be told to go pound sound before you could draw your next breath.

I’ve told the story before about the clueless technical manager who proposed such a mandate at a company I once worked at. I and the other senior developer were able to explain the facts of life and aborted the disaster before it occurred. As you all know, we here at the Irreal bunker are all in on Emacs but we believe that choosing an editor is like choosing a mate: others may disagree with your choice but it’s none of their business. More succinctly: choose whatever editor works best for you. Everyone else should butt out.

Mandates like this are always imposed by people who don’t actually do development. They imagine they’re encouraging a shared development culture but what they’re actually encouraging is a mass exodus. I don’t know about you but I’d be out the door in an instant if some suit presumed to tell me what editor to use.

Posted in General | Tagged | Leave a comment

Dictionaries and Emacs

Somewhere in 2014–2015, I came across James Somers’ beautiful article on Webster’s 1913 dictionary and why it’s the right choice. It was a revelation to me, opening my eyes to a wonderful resource that ever since has helped me find just the right word when I’m writing. I loved the article and even put it in my “blog ideas” queue although I felt that it wasn’t something most Irreal readers would care about.

In that, as in so many other things, I was completely wrong. In 2015, I finally found a hook for the post—DuckDuckGo bang shortcuts—and published Draft #4 about it. That article and the others in the series have, judging by engagement, turned out the be arguably the most popular posts in the Irreal corpus.

It probably seems strange have a series of articles on this subject but it was necessitated by the disappearance of the dictionary from the University of Chicago website and a desire to make it available from within Emacs. Somers’ article itself has proved to be tremendously popular—Somers says it has been read over 130,000 times—and people are constantly discovering and commenting on it. There always seems to be something new to report about it.

The latest thing was something I’ve just discovered: As of Emacs 28.1 you can access Websters 1913 from within Emacs without loading any packages or data. That’s really great because it means, essentially, you get the dictionary for free. The above post gives you the TL;DR on how to do that.

There turns out to be more to the story and, of course, Mickey over at Mastering Emacs has all the details. The new Emacs capabilities depend on a client/server protocol for dictionary lookups that Emacs implements in dictionary.el. There are more capabilities than the dictionary-search function that I wrote about. There are also some navigation shortcuts to make moving around easier. If you prefer local copies of your dictionaries, you can arrange to run a server on your own machine. Take a look at Mickey’s post for all the details. The short story is there’s a lot more to dictionary.el than I thought.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Is The FSF Fighting The Previous War?

This is a bit genuine red meat and perhaps a little sensitive for some people but it does raise a point that deserves discussion. A shorthand for that point is the title of today’s post. A more descriptive way of describing it is, “Is the FSF’s demand for purity actually harming the users they’re striving to protect?”

Some people obviously think so: that’s why we have the OSS movement. I don’t know anyone who doubts the goodwill or sincerity of RMS and the FSF. I certainly don’t. But it’s still worth asking if the policies they’re pursuing are helping or harming the goal to which they’re devoted.

Ash, over at gay robot noises, has a post that explores how she thinks RMS and his insistance on purity are hurting the Free Software movement. She, as do I, has tremendous respect for Stallman but worries, as the title suggests, that he’s fighting a war that’s no longer going on. I disagree with her conclusion that the FSF has lost the battle. I believe that while they haven’t won it, they certainly haven’t lost it either. Take a look at her post and see what you think.

Ariadne Conill makes a similar case for hardware. She says that strict adherence to the FSF’s Respects Your Freedom program means that you’ll be using only obsolete and probably broken hardware. No one but a Free Software Aesthete is going to do that so the FSF is crippling their crusade for free hardware.

I have my own data point in this discussion. Back in May, there was a long thread on Emacs-Devel about removing ns-do-applescript from the Next Step branch. The problem, according to the instigator, was that applescript runs only on macOS which is not a free operating system—although it does represent over 25% of Emacs users—and therefore ns-do-applescript should not be in Emacs. Notice that code was already there so the poster was proposing more work just because of a purity issue. When I objected on the grounds the code wasn’t hurting anyone, was useful to Mac users, and that it didn’t make any sense to make Mac users lives more difficult, I was told that the FSF was not interested in making Mac users lives easier. On the contrary they wanted to make it more difficult so those users would abandon macOS and move to Linux. I’ll let you draw your own conclusions. If you’re particularly masochistic, here’s the start of the thread on Emacs-Devel.

I understand the FSF’s insistence on “no inch given” but I do think that it may be time to explore how well that’s working out.

Posted in General | Tagged , | Leave a comment

Volume 4B

This is a short post announcing a, sadly, infrequent event: the release of a new volume of The Art of Computer Programming. Donald Knuth has announced the availability of the long awaited Volume 4B of The Art of Computer Programming. There’s one more part of Volume 4, which considers combinatorial algorithms, and then the series moves on to considering various topics in compilers. For those who came in late, AOCP was originally meant to be a book about compiler writing. It morphed into something much, much more, including Knuth’s life work.

I was literally a young man when I came across the first volume. After I bought it, I consumed it in a frenzy. It was a revelation to me. It’s impossible to recount how much I learned from it and its subject matter, don’t forget, was fundamental algorithms. It’s the definitive account of our field’s subject matter.

I no longer, I must admit, consume each new volume as I did with the first. Rather, I use it as a resource when I need to know about some aspect of our discipline. It’s much like an encyclopedia; you’re probably not going to read the whole thing but it’s perfect for researching some specific piece of knowledge.

Posted in General | Leave a comment

Emacs Debugging

Guangwang Huang, over at whatacold’s space, has a useful post on debugging Emacs. It’s aimed at beginners but will be useful for more experienced Emacsers too. The basic idea is what you should do when you start Emacs and get an error. This most often happens after you upgrade a package and can be hard to deal with.

The first thing to do, of course, is to start a clean invocation of Emacs. The easy way to do that is with emacs -Q. That gives you a “clean” copy of Emacs without any of your configuration or packages. Of course, the problem probably lies in a package so you want a clean Emacs but with that suspect package loaded too. The first step is to determine the offending package. Starting Emacs with emacs --debug-init will help you find the proper package and then you need to start a clean Emacs with just that package loaded. Huang shows how to do that. At this point you can start drilling down to find the actual problem.

The main way to do that is to tell Emacs to drop you into the debugger and give you a backtrace when an error occurs. There are several events you can use to trigger this including, even, the output of a message that matches a regular expression. Take a look at Huang’s post for the details.

There’s nothing particularly advanced about Huang’s post but it provides just the information you need to solve many of the problems you encounter with Emacs. It’s reasonably short so there’s no reason you shouldn’t a couple of minutes reading it.

Posted in General | Tagged | Leave a comment

A N00b’s View of Emacs

Mahmoud Mazouz is an Emacs n00b. He’s been using Emacs for about two months but has experience with (neo)Vim and VS Code. He recently posted his view of Emacs and what he sees as its strengths.

Like many (or, perhaps, most) of us, he finds the chief benefit to be Emacs’ extensibility. Unlike many folks, Mazouz is happy enough with Emacs functionality; it’s the look and feel that he was unhappy with.

That’s a common complaint—especially among n00bs—but instead of taking to Twitter to complain about it, Mazouz decided to fix the UI/UX to suit his needs. He found it reasonably easy. Rather than use someone else’s theme, he built is own. Similarly, he tried several keybinding schemes before settling on Meow.

He also didn’t like the mode line but found that it was too complex for him to fix. Fortunately, he liked the Doom modeline, which is available as a standalone package on MELPA, and is happy with that.

One of the themes of the post is that it’s possible to do a lot of Emacs customization even if you aren’t experienced in Elisp. Most of the functionality that you want that doesn’t come with stock Emacs is available as packages. Mazouz mentions Org-mode (although that’s arguably a stock feature now) and Magit. Pretty much any functionality you might need is available as a package.

There’s nothing surprising in Mazouz’s post for experienced Emacs users but I like the way he fixed the UI/UX to suit himself. Worth a read if you also like such stories.

Posted in General | Tagged | Leave a comment

Why You Shouldn’t Be Using Chrome

Even if you’re a bit cynical about Google’s protestations of respecting your privacy, you’ll probably be shocked at the extent to which the Google Chrome browser is indistinguishable from malware. If I told you that some app captured all your keystrokes—including passwords and other sensitive information—regardless of whether you actually submitted them or not, you’d say, “Yup, that’s keylogger malware.” and delete it from your system or phone.

Yet that’s exactly what’s happening when you use the Chrome browser. Scott McCloud has a longish comic that explains how Chrome invades your privacy and spies on you. Spend a few minutes to read the comic and find out what Chrome is doing. If afterwards you still don’t delete Chrome, I don’t know what to say or how to help you.

If you’ve been paying attention to Google, none of this will come as a surprise. Everything Google does it does in service of collecting your information and selling it to others. At first, these sales were to advertisers to support Google’s advertising platform. However, according the McCloud’s comic, lately these sales have been to other, even less savory enterprises such as political operations. Given Google’s belief in their own virtue and consequent right to censor what the rest of us can see, it doesn’t take a lot of imagination to envision this information making its way to officials who want to keep tabs on those who deviate from approved beliefs.

If you keep using Chrome and other “free” Google products, you’re enabling the possibility of this dystopian outcome. Please stop. You owe it to yourself and to the rest of us.

Posted in General | Tagged | Leave a comment

Letters With Org-mod

If you’re like me and want to do all your writing from within Org-mode, one problem you need to solve is how to write letters—especially professional letters. I use a LaTeX template and write the letter in LaTeX but mostly it’s just text so it’s pretty easy. Still, it would be nice to move all that to Org so that I could just use, say, a Yasnippet to include the LaTeX boiler plate and then write in the comfortable Org environment.

Ravi Sagar has a short video on how he’s solved this problem. One of the problems he needed to solve was how to produce a letterhead. That turns out to be pretty easy once you have the letterhead graphic. He has all his LaTeX boilerplate in a separate file and just includes it in the individual letters. It works well and is pretty easy.

If you’d like to move even your formal letters to Org-mode, take a look at Sagar’s video to see how to set it up. It’s worth doing this if only to free yourself from the tyranny of Word and its ugly siblings. As this week’s Red Meat Friday hinted, you’d do well to avoid hitching yourself to the Microsoft wagon.

Posted in General | Tagged , | Leave a comment

Yasnippet for Prose Writing

When you think about it, the title of this post doesn’t appear to make sense. Yasnippet is a template system for adding customized boiler plate to an Emacs buffer. It’s raison d’être is to enable shortcuts for various programming constructs such as the C for loop.

Still, it’s a flexible system so it finds all sorts of uses. If you’re writing in LaTeX, it can help with things like the environment boilerplate. Similarly, it’s great for things like blog headers.

Erik L. Arneson has a post that describes how he uses Yasnippet for his writing. After explaining how to install Yasnippet, Arneson describes his uses. That turns out to be mostly things like blog headers and Org headers for certain other structured files. You can read his post for the details.

My personal use is almost entirely things like that. I never think to use it when I’m programming even though I do have the appropriate snippets loaded so the snippets I use are mostly for prose and various record keeping applications where the snippet provides a sort of form that I can easily fill out by tabbing through the fields.

The takeaway is that technology like Yasnippet doesn’t have a lot of application for writing prose except for headers and other boilerplate and perhaps for markup if you’re using something like LaTeX. Still, even those seemingly minimal applications can save a lot of time.

Posted in General | Tagged | Leave a comment