Code Wrong: Expand Your Mind

The really nice thing about doing something the “wrong” way is that there’s just so much variety! If you’re doing something the right way, the fastest way, or the optimal way, well, there’s just one way. But if you’re going to do it wrong, you’ve got a lot more design room.

Case in point: esoteric programming languages. The variety is stunning. There are languages intended to be unreadable, or to sound like Shakespearean sonnets, or cooking recipes, or hair-rock ballads. Some of the earliest esoteric languages were just jokes: compilations of all of the hassles of “real” programming languages of the time, but yet made to function. Some represent instructions as a grid of colored pixels. Some represent the code in a fashion that’s tantamount to encryption, and the only way to program them is by brute forcing the code space. Others, including the notorious Brainf*ck are actually not half as bad as their rap — it’s a very direct implementation of a Turing machine.

So you have a set of languages that are designed to be maximally unlike each other, or traditional programming languages, and yet still be able to do the work of instructing a computer to do what you want. And if you squint your eyes just right, and look at as many of them all together as you can, what emerges out of this blobby intersection of oddball languages is the essence of computing. Each language tries to be as wrong as possible, so what they have in common can only be the unavoidable core of coding.

While it might be interesting to compare an contrast Java and C++, or Python, nearly every serious programming language has so much in common that it’s just not as instructive. They are all doing it mostly right, and that means that they’re mostly about the human factors. Yawn. To really figure out what’s fundamental to computing, you have to get it wrong.

Hackaday Podcast 153: A 555 Teardown To Die For, Tetrabyte Is Not A Typo, DIY Injection Molding, And Using All The Parts Of The Trash Printer

Join Hackaday Editor-in-Chief Elliot Williams and Managing Editor Tom Nardi on another whirlwind tour of the week’s top stories, hacks, and projects. We start off with some breaking Linux security news, and then marvel over impeccably designed pieces of hardware ranging from a thrifty Z table for the K40 laser cutter to a powerful homebrew injection molding rig. The finer technical points of a USB device that only stores 4 bytes at a time will be discussed, and after taking an interactive tour through the internals of the 555 timer, we come away even more impressed by the iconic 50 year old chip. We’ll wrap things up by speculating wildly about all the bad things that can happen to floating solar panels, and then recite some poetry that you can compile into a functional computer program should you feel so inclined.

Take a look at the links below if you want to follow along, and as always, tell us what you think about this episode in the comments!

Direct Download (58 MB)

Continue reading “Hackaday Podcast 153: A 555 Teardown To Die For, Tetrabyte Is Not A Typo, DIY Injection Molding, And Using All The Parts Of The Trash Printer”

This Week In Security: Geopolitical Hacktivism, Antivirus Mining, And Linux Malware

The CIA Hacktivists have launched a sort of ransomware campaign against the Belarusian rail system, but instead of cryptocurrency, they want the release of political prisoners and removal of Russian soldiers. This could be called an example of cyber-terrorism, though there is a reasonable theory that this is a state-sponsored hack, masquerading as hacktivism. What does seem certain is that something has interrupted rail transit, and a group on Twitter has produced convincing proof of a breach.

Your Antivirus Now Includes a CryptoMiner

Don’t look now, but your latest update of Norton 360 or Avira may have installed a cryptocurrency mining module. The silver lining is that some sanity has been retained, and you have to opt-in to the crypto scheme before your machine starts spending its spare cycles on mining. For users who do, they’re put into a mining pool, making for small payouts for most hardware. Norton, naturally, takes a 15% fee off the top for their trouble.

The State of Linux Malware

There used to be an adage that Linux machines don’t get malware. That’s never really been quite true, but the continued conquest of the server landscape has had the side effect of making Linux malware an even greater danger. Crowdstrike has seen a 35% increase in Linux malware in 2021, with three distinct categories leading the charge: XorDDoS, Mozi, and Mirai. Continue reading “This Week In Security: Geopolitical Hacktivism, Antivirus Mining, And Linux Malware”

Remoticon 2021 // Voja Antonic Makes You A Digital Designer

[Voja Antonic] has been building digital computers since before many of us were born. He designed with the Z80 when it was new, and has decades of freelance embedded experience, so when he takes the time to present a talk for us, it’s worth paying attention.

For his Remoticon 2022 presentation, he will attempt to teach us how to become a hardware expert in under forty minutes. Well, mostly the digital stuff, but that’s enough for one session if you ask us. [Voja] takes us from the very basics of logic gates, through combinatorial circuits, sequential circuits, finally culminating in the description of a general-purpose microprocessor.

A 4-bit ripple-carry adder with additional CPU flag outputs

As he demonstrates, complex digital electronics systems really are just built up in a series of steps of increasing complexity. starting with individual active elements (transistors operating as switches) forming logic elements capable of performing simple operations.

From there, higher level functions such as adders can be formed, and from those an ALU and so on. Conceptually, memory elements can be formed from logic gates, but it’s not the most efficient way to do it, and those tend to be made with a smaller and faster circuit. But anyway, that model is fine for descriptive purposes.

Once you have combinatorial logic circuits and memory elements, you have all you need to make the necessary decoders, sequencers and memory circuits to build processors and other kinds of higher complexity circuits.

Obviously forty minutes isn’t anywhere nearly enough time time to learn all of the intricacies of building a real microprocessor like the pesky details of interfacing with it and programming it, but for getting up the learning curve from just a knowledge of binary numbers to an understanding of how a CPU is built, it’s a pretty good starting point.

Now, If you can only tear your eyes away from his slick game-of-life wall mounted LED display, you might pick up a thing or two.

Continue reading “Remoticon 2021 // Voja Antonic Makes You A Digital Designer”

Linux Fu: Bash Strings

If you are a traditional programmer, using bash for scripting may seem limiting sometimes, but for certain tasks, bash can be very productive. It turns out, some of the limits of bash are really limits of older shells and people code to that to be compatible. Still other perceived issues are because some of the advanced functions in bash are arcane or confusing.

Strings are a good example. You don’t think of bash as a string manipulation language, but it has many powerful ways to handle strings. In fact, it may have too many ways, since the functionality winds up in more than one place. Of course, you can also call out to programs, and sometimes it is just easier to make a call to an awk or Python script to do the heavy lifting.

But let’s stick with bash-isms for handling strings. Obviously, you can put a string in an environment variable and pull it back out. I am going to assume you know how string interpolation and quoting works. In other words, this should make sense:

echo "Your path is $PATH and the current directory is ${PWD}"

The Long and the Short

Suppose you want to know the length of a string. That’s a pretty basic string operation. In bash, you can write ${#var} to find the length of $var:


#/bin/bash
echo -n "Project Name? "
read PNAME
if (( ${#PNAME} > 16 ))
then
   echo Error: Project name longer than 16 characters
else
   echo ${PNAME} it is!
fi

Continue reading “Linux Fu: Bash Strings”

An snowy city street.

The Road Is Peppered With Rock Salt Alternatives

Every winter, millions of tons of rock salt is sprinkled across roads in the US, mostly in the Midwest and Northeast regions. It’s a cheap and effective way to prevent accidents. Rock salt is chemically the same as the stuff that sits next to the pepper, except it isn’t as finely ground, and it doesn’t have sodium or potassium iodine added to it to prevent goiters. Both table salt and rock salt melt ice by lowering the freezing point of water. So does sugar.

Much of what we salt the Earth with every winter comes from underground networks of salt crystal that formed when various ancient seas dried up. As natural as it may be, rock salt is bad for the environment. For one thing, chloride is forever, and can’t easily be decoupled from the soil and water it taints when it washes away. Rock salt also corrodes concrete, makes its way into the groundwater, and is bad for pets. Worst of all, its efficacy drops along with the temperature. At 15° F (-9° C), rock salt loses more than 86% of its melting power.

Disposable Detroit

All this salt is not great for cars, either — it’s bad for the paint and eats up the frame. In the saltiest parts of the US, aka The Salt Belt, cars only last a handful of years before they become Flintstones mobiles. Well, not really, but salt is terrible for the brake lines and most of the undercarriage. Consumer woes aside, there’s a real environmental impact to manufacturing all these disposable cars to meet the demand.

But the problem is that we need to use salt, or at something like it. Even though millions of people are staying home a whole lot more, the trucking industry still relies on salted highways and local roads. So if you like stocked grocery stores and stuff arriving from the Bezos Barn in a timely fashion, you can see the problem. So what are the alternatives? Are there any?

Continue reading “The Road Is Peppered With Rock Salt Alternatives”

Can Robots Give Good Hugs?

We could all use a hug once in a while. Most people would probably say the shared warmth is nice, and the squishiness of another living, breathing meatbag is pretty comforting. Hugs even have health benefits.

But maybe you’re new in town and don’t know anyone yet, or you’ve outlived all your friends and family. Or maybe you just don’t look like the kind of person who goes for hugs, and therefore you don’t get enough embraces. Nearly everyone needs and want hugs, whether they’re great, good, or just average.

So what makes a good hug, anyway? It’s a bit like a handshake. It should be warm and dry, with a firmness appropriate to the situation. Ideally, you’re both done at the same time and things don’t get awkward. Could a robot possibly check all of these boxes? That’s the idea behind HuggieBot, the haphazardly humanoid invention of Katherine J. Kuchenbecker and team at the Max Planck Institute for Intelligent Systems in Stuttgart, Germany (translated). User feedback helped the team get their arms around the problem.

Continue reading “Can Robots Give Good Hugs?”