I started deploying stuff even before I knew what “deploying” really meant. This is not a flex: it is an admission of guilt. I still recall the times when reading a Nginx configuration file was no different from trying to decipher some ancient forgotten language.
The only thing that did not change in the last decade is how (poorly) I document what I do: well, maybe I should say that it almost did not change. Some years back I started keeping an unlimited Bash history on my machines, so sometimes a Ctrl+r is all I need to remember what I did. Still: no output, no pruning of incorrect commands, no comments. Really, what the hell was I cooking here:
find ~+ -name "*.flac" -exec bash -c 'cd "${0%/*}"; export FLAC=${0##*/}; mkdir "${FLAC%.*}"; cd "${FLAC%.*}"; shnsplit -f ../"${FLAC%.*}.$1" -t %n-%t -o flac ../"${0##*/}"; cuetag ../"${FLAC%.*}.$1" [0-9]*.flac; cd "${0%/*/*}"' {} "cue" \;
I can kinda remember that:
- I was working on archiving some CDs I had around;
- Navidrome was (and still is afaiu, at the time of writing) not supporting single FLAC+CUE;
- I took it as a challenge to make a one-liner instead of a script (this happens a lot with me).
From the timings inside ~/.bash_eternal_history it looks like this took more or less three hours. I took some time to decipher it and it probably does this:
- Find all the .flac (single FLAC+CUE) files and for each one of them do:
cdinto the folder where the .flac is;exportFLAC as the file name without the path;- Create a folder named as the FLAC file without the .flac extension and cd into it;
- Do the splitting and tagging on the files in the parent folder while saving them here;
- Go again up two folders from where the original .flac was and repeat;
- I guess that the
"cue"at the end is there to be used as$1.
Not that I will probably ever need it again, but would have been awesome to write down an explanation when I did it.
Things like this happen very often. A couple of years ago I go back to my home in Italy, and I panick because for some reason I SSH into my home server and it asks me for a password instead of verifying my SSH key. I never logged in with this device, the SSH key should not be recognized! Something wrong is happening! The something wrong inside /etc/ssh/sshd_config:
Match address 192.168.0.0/24
PasswordAuthentication yes
5-minutes heart attack preventable by just writing down what I did when I do it. Also easier to remember it in the future once you do!
Well, I decided that the prevention starts now, with this blog. I do not pretend to have the best Ops habits around1, nor that everything I do is exceptionally correct: my priority is for things to work, be easy to maintain, and be easy to troubleshoot once they will break. Because they will.
Even though I had very few things break down in the last ten years - and I can attribute most of them to my ISP having weird hiccups at 2 AM, or a disk corrupting itself to oblivion - I know stuff will be stuff. And the day I relax and say “wow, everything seems to work so smoothly!” I’ll see red on the dashboard. The dashboard I still didn’t deploy. Oopsie!
I could have made this private but I guess I like shouting in the void. Moreover, there is a chance that someone may find something written here useful, and I would be happy for them.
Cheers!