Linux Fu: Failing Pipelines

Bash is great for automating little tasks, but sometimes a little script you think will take a minute to write turns into a half hour or more. This is the story of one of those half-hour scripts.

I have too many 3D printers. In particular, I have three that are almost — but not exactly — the same, so each one has a slightly different build process when I want to update their firmware. In all fairness, one of those printers is heading out the door soon, but I’ll probably still wind up building firmware images for it.

My initial process was painful. I have a special directory with the four files needed to configure Marlin for each machine. I copy all four files and ask PlatformIO to perform the build. Usually, it succeeds and gives me a file that looks like firmware-yyyyddmmhhmm.bin or something like that.

The problem is that the build process doesn’t know which of the three machines is the target: Sulu, Checkov, or Fraiser. (Long story.) So, I manually look at the file name, copy it, and rename it. Of course, this is an error-prone process, and I’m basically lazy, so I decided to write a script to do it. I figured it would take just a minute to bundle up all the steps. I was wrong.

Continue reading “Linux Fu: Failing Pipelines”

A Simple Liquid Level Indicator With A Single IC

Often, the only liquid level indicator you need is your eyes, such as when looking at your cold beverage on a summer’s day. Other times, though, it’s useful to have some kind of indicator light that can tell you the same. [Hulk] shows us how to build one for a water tank using a single IC and some cheap supporting components.

If you’re unfamiliar with the ULN2003, it’s a simple Darlington transistor array with seven transistors inside. It can thus be used to switch seven LEDs without a lot of trouble. In this case, green, yellow, and red LEDs were hooked up to the outputs of the transistors in the ULN2003. Meanwhile, the base of each transistor is connected to an electrode placed at a different height in the water tank. A further positive electrode is placed in the tank connected to 12 volts. As the water raises to the height of each electrode, current flow from the base to the positive electrode switches the corresponding transistor on, and the LED in turn. Thus, you have a useful liquid level indicator with seven distinct output levels.

It’s a neat build that might prove useful if you need to check levels in a big opaque tank at a glance. Just note that it might need some maintenance over time, as the electrodes are unlikely to remain completely corrosion free if left in water. We’ve seen some other great uses of the ULN2003 before, too. Video after the break.

Continue reading “A Simple Liquid Level Indicator With A Single IC”

End Of An Era: Sony Cuts Production Of Writable Optical Media

The 1990s saw a revolution occur, launched by the CD burner. As prices of writeable media and drives dropped, consumers rushed to duplicate games, create their own mix CDs, and backup their data on optical disc. It was a halcyon time.

Fast forward to today, and we’re very much on downward curve when it comes to optical media use. Amidst ever-declining consumer interest, Sony has announced it will cut production of writeable optical media. Let’s examine what’s going on, and explore the near future for writable optical discs.

Continue reading “End Of An Era: Sony Cuts Production Of Writable Optical Media”

Retro Inspired Cyberdeck Scrolls Around Cyberspace

It’s difficult to nail down exactly what counts as a “real” cyberdeck in this brave new era of bespoke computing. But at the minimum, most in the community would agree that a proper deck should have a non-traditional form factor, and be designed to meet the unique needs of the builder. If you’re looking for a fantastic example of both concepts, check out the Cyberdore 2064 from [Tommi L].

At first glance the 3D printed enclosure of the Cyberdore looks a bit like a Speak & Spell, but it’s really more of an amalgamation of everything that made 1980s computers so unique. You’ve got the vents, the chunky switches, the undersized display, and of course, the handle. The case might have been extruded in 2024, but it’s doing a fantastic impression of a piece of tech from 40 years ago.

One of the key external features of the Cyberdore 2064 is the side-mounted rotary encoder that allows for smoothly scrolling through online feeds (such as your favorite hardware hacking site) or long documents. The cheap and easy to work with KY-040 encoder has been converted to a USB input device by way of a Pi Pico, and has been paired with an over-sized 3D printed knob that really makes this build stand out — not only visually, but in terms of usability. These cyberdeck builds often rely on touch screens for input, but we always appreciate a physical interface.

Under the hood you’ve got a Raspberry Pi Zero and an 18650 cell to keep the whole thing running while on the go. Though the Zero is certainly showing its age compared to the more modern variants of the Pi, for a device like this, raw computing power isn’t really the driving concern. A mechanical keyboard usually rounds out these cyberdeck builds, but in this case, [Tommi] went with a fairly common Rii 518BT portable board that’s been skillfully integrated into the front of the Cyberdore.

All of the STL files necessary to print out your own Cyberdore 2064 are available on Printables, and while [Tommi] didn’t exactly provide build instructions, the write-up provides plenty of information to get you started.

So is it just us, or does looking at Cyberdore 2064 make you think it’s time for another Hackaday Cyberdeck Challenge?

Pnut: A Self-Compiling C Transpiler Targeting Human-Readable POSIX Shell

Shell scripting is one of those skills that are absolutely invaluable on especially UNIX and BSD-based systems like the BSDs, the two zillion Linux distributions as well as MacOS. Yet not every shell is the same, and not everybody can be bothered to learn the differences between the sh, bash, ksh, zsh, dash, fish and other shells, which can make a project like Pnut seem rather tempting. Rather than dealing with shell scripting directly, the user writes their code in the Lingua Franca of computing, AKA C, which is then transpiled into a shell script that should run in any POSIX-compliant shell.

The transpiler can be used both online via the main Pnut website, as well as locally using the (BSD 2-clause) open source code on GitHub. Here the main limitations are also listed, which mostly concern the C constructs that do not map nicely to a POSIX shell. These are: no support for floating point numbers and unsigned integers, no goto and switch nor taking the address of a variable with &. These and preprocessor-related limitations and issues are largely to be expected, as especially POSIX shells are hardly direct replacements for full-blown C code.

As a self-professed research project, Pnut seems like an interesting project, although if you are writing shell scripts for anything important, you probably just want to buckle down and learn the ins and outs of POSIX shell scripting and beyond. Although it’s a bit of a learning curve, we’d be remiss if we said that it’s not totally worth it, if only because it makes overall shell usage even beyond scripting so much better.

Hacking An IoT Camera Reveals Hard-Coded Root Password

Hacking — at least the kind where you’re breaking into stuff — is very much a learn-by-doing skill. There’s simply no substitute for getting your hands dirty and just trying something. But that doesn’t mean you can’t learn something by watching, with this root password exploit on a cheap IP video camera being a good look at the basics.

By way of background on this project, [Matt Brown] had previously torn into a VStarcam CB73 security camera, a more or less generic IP camera that he picked up on the cheap, and identified a flash memory chip from which he extracted the firmware. His initial goal was to see if the camera was contacting sketchy servers, and while searching the strings for the expected unsavory items, he found hard-coded IP addresses plus confirmation that the camera was running some Linux variant.

With evidence of sloppy coding practices, [Matt] set off on a search for a hard-coded root password. The second video covers this effort, which started with finding UART pins and getting a console session. Luckily, the bootloader wasn’t locked, which allowed [Matt] to force the camera to boot into a shell session and find the root password hash. With no luck brute-forcing the hash, he turned to Ghidra to understand the structure of a suspicious program in the firmware called encoder. After a little bit of poking and some endian twiddling, he was able to identify the hard-coded root password for every camera made by this outfit, and likely others as well.

Granted, the camera manufacturer made this a lot easier than it should have been, but with a lot of IoT stuff similarly afflicted by security as an afterthought, the skills on display here are probably broadly applicable. Kudos to [Matt] for the effort and the clear, concise presentation that makes us want to dig into the junk bin and get hacking.

Continue reading “Hacking An IoT Camera Reveals Hard-Coded Root Password”

Manually Computing Logarithms To Grok Calculators

Logarithms are everywhere in mathematics and derived fields, but we rarely think about how trigonometric functions, exponentials, square roots and others are calculated after we punch the numbers into a calculator of some description and hit ‘calculate’. How do we even know that the answer which it returns is remotely correct? This was the basic question that [Zachary Chartrand] set out to answer for [3Blue1Brown]’s Summer of Math Exposition 3 (SoME-3). Inspired by learning to script Python, he dug into how such calculations are implemented by the scripting language, which naturally led to the standard C library. Here he found an interesting implementation for the natural algorithm and the way geometric series convergence is sped up.

The short answer is that fundamental properties of these series are used to decrease the number of terms and thus calculations required to get a result. One example provided in the article reduces the naïve approach from 36 terms down to 12 with some optimization, while the versions used in the standard C library are even more optimized. This not only reduces the time needed, but also the memory required, both of which makes many types of calculations more feasible on less powerful systems.

Even if most of us are probably more than happy to just keep mashing that ‘calculate’ button and (rightfully) assume that the answer is correct, such a glimpse at the internals of the calculations involved definitely provides a measure of confidence and understanding, if not the utmost appreciation for those who did the hard work to make all of this possible.