Before You Sudo Rm -rf /, Take Some Precautions

Maintaining or administering a computer system remotely is a common enough task these days, but it’s also something that can go sideways on you quickly if you aren’t careful. How many of us are guilty of executing a command, having it fail, and only then realizing that we weren’t connected to the correct computer at all? [Callan] occasionally has this issue as well, but in at least one instance, he deleted all of the contents of the wrong server by mistake. To avoid that mistake again, he uses color codes in the command line in a fairly unique way.

The solution at first seems straightforward enough. Since the terminal he’s using allows for different colors to be displayed for the user and hostname on the bash prompt, different text and background colors are used for each server. The only problem with this is that his friends also have access to these servers, and one of them is red/green colorblind, which led to another near-catastrophic mix-up. To ensure no edge cases are missed, [Callan] built a script which runs on every new server he spins up which selects two random colors, checks that they contrast well with each other, don’t create problems for the colorblind, and then applies them to the bash prompt.

For a problem most of us have had at some point or another, it’s a fairly elegant solution that helps ensure we’re sending the right commands to the right computer. This adds a layer of automation to the process and, while some color combinations do look similar, there are enough to help out most of us in some way, especially since he has released the source code on his GitHub page. For other helpful server administration tips, we’d recommend the Linux-Fu article about deploying your own dynamic DNS.

Making A UNIX Clock While Making A Few Mistakes Along The Way

unixclock

Sometimes the projects we think are easy to design are the ones on which we end up making the most mistakes. The UNIX clock that you see in the picture above is one of these projects. For our readers that don’t know it, UNIX time is the number of seconds since 00:00 on January 1st 1970. The clock that [James] designed is based on an Arduino Pro Mini board, an RTC chip to store the time, a custom made display board and two buttons to set the date/time.

One of the mistakes that [James] made was designing the boards on which will be soldered the seven-segment displays before actually choosing the ones he’ll use, as he was thinking they’d be all the same. The displays he ended up with had a different pitch and needed a different anode voltage, so he had to cut several traces on the PCBs and add another power supply. It also took [James] quite a while to remove the bits that his hackerspace’s laser didn’t cut through. We strongly advise a good look at his very detailed write-up if you are starting in the electronics world.

If you find this Unix time display too easy to read here’s one that’s a bit more of a challenge.