TIL you can use tr to replace all sequences of multiple whitespaces to a single one with "tr -s ' '" ("s" for "squeeze"). Very useful for example when you want to use cut but columns are separated by multiple whitespaces. And yes, "-s" for tr is part of POSIX.
Notices by Nicolas Martyanoff (galdor@emacs.ch)
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:39:01 UTC Nicolas Martyanoff -
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:39:00 UTC Nicolas Martyanoff One of the things you learn early in your career is that SLA advertised by SaaS platforms aren't worth anything. Unless there are severe, enforceable penalties for SLA breaches (emphasis on "enforceable"), you're shit out of luck.
Can't prove a SLA breach happened? Service status page is all green? You get nothing. Oh maybe you do, it's a small percentage of your monthly bill. So again, nothing.
Remember that when offloading tech systems to an external provider.
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:38:57 UTC Nicolas Martyanoff I used to think that software should fully implement standards, trying to get as compliant as possible. Not anymore. Software is meant to be used. Nowadays I just implement the bare minimum and add the rest either when I need it or someone pays me to. Less work, less stress.
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:38:54 UTC Nicolas Martyanoff This is a screenshot of a Go project I'm working on. But sure, #Lisp expressions are bad because they have too many parenthesis… And of course you cannot manipulate Go expressions the same way as Paredit.
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:38:52 UTC Nicolas Martyanoff @loke I'm well aware of what a pointer is.
By masking the pointer type in some cases but not others, you are making your code inconsistent.
You also hide useful information: if a function accepts a parameter of type ssh_key, it is reasonable to wonder if it is a structure passed by copy, a pointer to something you must allocate yourself, or something more complicated altogether.
One good thing with C is that what's happening is usually obvious. Hiding types because you cannot be bothered to write "struct ssh_key *" is a terrible idea.
You may think it's ok because you know that "ssh_key" is a pointer type. But when you have worked with very large C codebases, you learn than you cannot expect to remember what is behind each typedef and must keep things explicit.
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:38:49 UTC Nicolas Martyanoff @loke It makes it hard to reason on what's happening.
For example in libssh, some functions take a "const ssh_key *". So now you retain the explicit pointer type in some cases but not others.
Especially annoying for people binding the library.
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:38:45 UTC Nicolas Martyanoff If you're writing C code and you are hiding pointer types with typedef, there is a special hell waiting for you.
I'm looking at you libssh with "typedef struct ssh_key_struct* ssh_key". It's already bad enough to hide "struct".
-
Nicolas Martyanoff (galdor@emacs.ch)'s status on Tuesday, 08-Aug-2023 11:15:22 UTC Nicolas Martyanoff If you're still learning, stay clear of graphical UIs and get comfortable with the command line. Use psql instead of DBeaver, kubectl instead of Portainer, git instead of GitHub Desktop… You'll learn how it actually works and will be able to script with them.