Welcome to my personal site, where I irregularly post technical notes, usually Emacs or Haskell-related. I am developer at Wix during the daytime, and developer at home before and after the daytime. When I am not writing code, I am either drinking wine or drinking tea (with these little cups). Cheese is my bread and tracking everything in Emacs is my cheese. So welcome!
Yet another tale about bash script refactoring. This time the configuration script of mirror-elpa had undergone some changes and I like the result so much that I decided to share it.
Imagine that you want your users to give you some input, for example, repository owner and name. And you want the value so desperately, that if the user doesn’t provide one, you ask the user again. On the other hand, you also want to support default values. So for example, if the user doesn’t provide any value, but there is a default value, you could use that.
And you can’t use anything except for bash.
As you might know, Eru is the supreme deity of Arda. The first things that Eru created where the Ainur. He then bade the Ainur to sing to him. Each Ainu had a particular theme given by Eru. Sure enough, Eru makes the ‘World and All That Is’.
So when I get a new clean system there is nothing yet. And so I call upon the wisdom and power of
Eru.sh - the one who creates Ainur and the ‘World and All That Is’.
I just have to wait patiently, while everything is being downloaded and installed, while all configuration cogs are being placed on the right spot.
When it comes to converting video to GIF, one usually gets a huge file and a questionable quality. Most of the guides suggest to use FFmpeg to do the conversion, but usually, they don’t bother with the quality of the result. As it turns out, folks from FFmpeg made some huge steps in improving the GIF output.
Sometimes you just have to generate some random bytes with high entropy. And OpenSSL can help you with this task.
Writing shell scripts might be pretty tedious because of all those failing commands leading to a corrupted state. And it gets even worse when you overpopulate your script with
if statements which distract you from solving your initial problem. And fortunately, there are several neat tricks for handling errors in shell scripts that everyone should be familiar with.