Building A Password Generator in 3 Minutes

Today—the whole week really—has been consumed by yak shaving so this is a short offering. Salah Qadri has a nice 3 minute video (3 minutes, 48 secs actually) in which he builds a reasonably good password generator.

The generator builds a password from upper/lower case letters, numbers, and symbols. The type of character and which one it is used are chosen randomly at each step using the Python random.choice method. One can argue that Qadri should have used the secrets.choice method instead but for occasional one-off passwords random.choice is probably adequate.

My only other nit is that I would have used a more functional approach rather than relying on globals but that’s more a personal preference. If you want to generate random passwords, Qadri’s video has some nice ideas. I like the way he handled choosing a type of character randomly. The code is easy to follow even if you aren’t a Python coder.

Posted in General | Tagged , | Leave a comment

Why You Should Learn Emacs This Year

David Wilson over at the System Crafters YouTube channel is starting off the year with a video that gives you 5 Reasons to Learn Emacs in 2021. He begins by noting that Emacs is not a text editor or at least not just a text editor. That’s not news to Emacs oldtimers, of course. As most of you know by now, I think of Emacs as a sort of lightweight version of a Lisp Machine and the working/development environment that they provided.

Wilson has a Linux laptop so he can run EXWM, which serves as an Emacs based window manager and increases the feeling of running in a Lisp Machine-like environment. All of that is important because it means you can customize your environment to be exactly what you want it to be. The source code is there, the documentation is there and they’re both easily available right from Emacs. There’s no need to be online or to go to an external site.

Wilson also calls out the advantages of Emacs’ keyboard-based UI. You can leave your mouse at home and still have full and easy control of your environment. That is, I suppose, even more true if you’re running EXWM. Of course, if you’re fond of rodents, Emacs supports your mouse just fine.

Finally, there’s Magit and Org-mode. They’re most people’s idea of Emacs’ killer apps and Wilson spends a bit of time on Org and Magit demonstrating a few of their features.

The video is 26 minutes, 38 seconds long so plan accordingly. It’s a nice video and worth spending the half hour on. If you know someone who’s wondering if they should invest in Emacs, this is a good place to point them.

Posted in General | Tagged | Leave a comment

Adtech Fraud at Uber

As most of you know to your sorrow, I really, really hate adtech and frequently rail against it. The harm they do to ordinary users like you and me is manifest. They invade our privacy, follow us around the Internet, accumulate dossiers on us and sell them to anyone willing to pay.

But, it turns out, they’re shafting the advertisers too. Not just little white lie exaggerations but outright criminal fraud. Nandini Jammi has an startling thread that tells the story of how Uber lost over $100M from their advertising budget due to adtech fraud. The \$100M represents \(2/3\) of their advertising budget so it’s a significant amount.

The TL;DR is that one of the Twitter tongs was after Uber to stop advertising with a site they were politically opposed to and when Uber complied by canceling \$15M of advertising, they noticed no difference in their results. Unlike many advertisers, Uber actually has some technical prowess, so they started looking at logs to see what was happening. What they discovered was flat out click fraud. As a result, they canceled all their adtech advertising—over \$100M worth—and found that it still didn’t make any difference in their results.

As the thread says, most executives in charge of booking these advertisements have no idea how to monitor the results or tell if they’re being defrauded. If you’re not employed by adtech, your interests are aligned with those who wish to end it once and for all. There are plenty of problems with having the government trying to fix this but the whole thing would collapse in an instant if the advertisers just told them to go away. In the meantime, you and I can help by blocking as many tracking scripts as we can.

Posted in General | Tagged | Leave a comment

REPLs

Mikel Evins has a lovely post that considers interactive programming and REPLs. As many of you know, I love interactive programming and am a huge fan of it. I like how you can try out bits of code and feel your way to larger functions and finally a program. If you’re not familiar with the concept, take a look at this fascinating video from Kris Jenkins as he writes a Spotify client in Elisp right before your eyes.

Evins begins by examining the idea of a REPL and why they aren’t all the same.There is, he says, a big difference between a Lisp or Smalltalk REPL and one provided by, say, Python. You should consult his post for exactly what that difference is but the TL;DR is that the Lisp REPL allows you to talk to your program as it’s running, even if it enters an error state.

He goes on to lament that many—or perhaps most—programmers today have never experienced this sort of programming and may not even know it exists. That’s too bad, he says, because many of them would find that it makes them happier and more efficient. I certainly agree. I always enjoy programming more when I can do it in an interactive way. Of course, that means writing in a Lisp or Smalltalk so it’s not always possible but it’s great when I can.

Posted in Programming | Tagged , | Leave a comment

Tangling Dotfiles From an Org File

Despite the XDG base directory specification, configuration files are still stored all over our file systems. If you have a single machine, maintaining those files is not too much trouble—they’re almost all “set it and forget it”—but when you have multiple machines, especially if you frequently have to setup new machines, it can be a pain. A neat idea for dealing with this is to keep your dotfiles in an Org file and tangle them to their proper place. I wrote about that here and here.

The basic idea is that you put the contents of each config file into an Org source block and then tangle either a single block or all of them to write each config file to its proper place. That allows you to have a single source of truth for your dotfiles and makes setting up new machines—or even just updating a single config file—a snap.

NapoleonWils0n has an excellent video on implementing the idea. He used to keep all his dotfiles in a Git repository but that’s fairly difficult to set up and maintain. His Org based method handles both cases: it writes the dotfiles to their proper places but also builds a file for a Git repository. NapoleonWils0n doesn’t make clear the utility of maintaining a separate Git repository except to say it provides a further backup. Of course, you can put the Org file under version control and be done with it. Still, his process makes it clear how flexible the method is.

The video is 19 minutes, 23 seconds so plan accordingly. There’s a copy of the Org file he uses in his Github repository so don’t worry about trying to take in everything from the video.

Posted in General | Tagged , | Leave a comment

Abo-abo on Org-Roam

Regular readers know that I’m very taken with the Zettelkasten idea and have implemented my own (sort of) Zettelkasten with Org-mode. My homegrown solution is not very featureful or convenient so I installed org-roam (a FOSS alternative to the popular Roam application) to provide myself with a “real Zettelkasten.” Sadly, I’ve been too busy (lazy, really) to configure it or figure out how to use it. That’s made me feel vaguely guilty.

Fortunately, abo-abo has come to the rescue with his own post on org-roam. I say, “come to the rescue” because he, too, spent a lot of time getting around to actually using it. He’s been using it for less than a month but already loves it and considers it an upgrade to his previous way of taking notes. Take a look at his post to see a comparison between his old and new methods.

Being abo-abo, he’s tweaked things a bit with some wrapper code but he gives a pointer to org-roam configuration so you can use it as a starting point. That’s exactly what I intend to do. On the one hand, I was happy to find out that I’m not the only one who’s been sitting on org-roam for months. On the other hand, abo-abo has inspired me to get moving on what I’m sure will be an improvement to my notetaking. Feel free to excoriate me in the comments if I don’t report some progress in the near future.

At the end of abo-abo’s post, he shows a nice trick for automating a search for notes needing further action using the listify-key-sequence command and unread-command-events variable. I didn’t know about that but will add it to my toolkit.

Posted in General | Tagged , , | Leave a comment

Happy New Year

There’s not much happening today so I’m going to settle for wishing all Irreal readers a very Happy New Year from the Minions and me.

Posted in General | Leave a comment

A Global Hyper Key

There’s an interesting article over at Prodtyping that illustrates how to implement a global Hyper key on the Mac. By “global” I mean it works everywhere, not just Emacs. The idea is to use Hyper as a global shortcut key. The article shows the setup for making the Caps Lock serve as Hyper and uses it to launch Atom, Chrome, or iTerm.

The method uses Karabiner/Hammerspoon to do the key mapping and to fire off the appropriate application based on the key that Hyper is modifying. That last step requires a bit of Lua but Prodtyping shows a template that you can use to start your own application choice.

Evan Travers has a similar post that discusses using Hammerspoon to create and map a Hyper key. If you’re running a Mac and are interested in setting up a universal shortcut key, both posts are worth reading.

I use function keys to switch between my frequently used apps and within Emacs I have the fn key mapped to (Emacs’) Hyper. That works well for me but if you’re looking for a more general solution and you’re on a Mac, the solution in the two posts may be a good one.

Posted in General | Tagged , | Leave a comment

Emacs FAQ

Over at the Emacs subreddit, okimka suggests that an Emacs FAQ for the subreddit would be a good idea and even suggests a few questions and their answers. The comments generally complained about the questions and some of the answers but miss, I think, the main point.

Those on reddit and elsewhere spend a lot of time answering the same questions over and over. A lot of it is responding to the usual misinformed opinions of those who don’t even use Emacs. My favorite is “Emacs is unusable out of the box,” but there are also the complaints about it being bloated and slow. Rather than respond to those complaints over and over it makes sense to have some place we can point people to.

In addition to answering the usual complaints such an FAQ could address some of the other usual questions that we get repeatedly. I believe such an FAQ would be useful; what do you think?

Posted in General | Tagged | Leave a comment

More on Emacs and the Unix Way

Protesilaos Stavrou (Prot) just put up an interesting post that serves as a nice coda to yesterday’s Irreal post, Emacs As a 2D CLI. His take is not so much that Emacs fits nicely into the Unix paradigm but that for some things at least, it’s better. He builds his post around an email he got asking him why one should switch to Emacs.

His response is that if your current solution is working for you, there’s no reason to switch. Like me, Prot came to Emacs from Vim but for different reasons. We agree that Emacs and Vim offer two different types of workflow and reasonable people can prefer either over the other. He views Emacs as providing a unifying integration over the tools that he uses. Rather than writing glue code for every pipeline, he lets Emacs take care of that.

A couple of years ago, I wrote about a video in which Luke Smith asked people to send him videos (only) to convince him to switch to Emacs. I was not kind in my commentary because I found it annoying and presumptuous to ask the rest of the world to spend time providing very a specific type of content so he wouldn’t have to do his own research. His video was all the more annoying given that what he wanted was already available if he’d bothered to look. By happenstance, Prot’s interlocutor offers up another video by Smith in which he talks about the offerings he received and how he still wasn’t going to switch or even give Emacs and honest try. That video is as annoying as the first. His comments on Org-mode were particularly tiresome because they boiled down to, ‘Everyone says Org is cool; I don’t know anything about it; It’s not for me.’

Prot calls him out on the video saying he’s perfectly free to use whatever works best for him but that if he’s going to comment on Emacs he should at least know what he’s talking about. In other words, that he should give it an honest try for 6 months and then tell us what he thinks.

Prot’s post make a few other good points and also provides an alternative view of the Emacs/Unix question. It’s well worth a few minutes of your time.

Posted in General | Tagged | Leave a comment