Blowing Up Shell Scripts

One of the most universal experiences of any Linux or Unix user is working through a guide or handbook and coming across an almost unbelievably complex line of code meant to be executed with a shell. At the time of encountering a snippet like this it’s difficult to imagine any human ever having written it in the first place, but with some dedication it is possible to tease out what these small bits of code do when they’re typed into the terminal and run (unless it’s something like :(){ :|:& };: but that’s another story entirely). [noperator] recently built a tool which helps users in this predicament understand these shell scripts by expanding them into a more human-intelligible form.

The tool is named sol and does much more than expanding shell one-liners into a readable format. It also provides an interactive shell environment where the user can explore the exploded code in detail, modify it in any way they see fit, and collapse it back down to a single line so it can easily be sent to other users. It can be used with most of the major text editors as well as piped directly to standard input, and has a number of other options as well such as custom configurations and the ability to see non-standard bits of code that might not be compatible from one shell environment to another, as well as helping to translate those bits of code.

[noperator] has made the code available in the linked GitHub page for anyone curious about its use, and has a to-do list for future versions of the tool as well including adding support beyond bash. We’d definitely recommend a tool like this especially if you’re still relatively new to bash scripting (or shell scripting in general) and, as always, we’d just to remind everyone not to blindly copy and paste commands into their terminal windows. If you’re the type of person to go out on a limb and run crazy commands to see what they actually do, though, make sure you’re at least logged into the right computer first.

Cash register keyboard

Custom Keyboard From A Cash Register

Having a high-quality mechanical keyboard is often a rite of passage in the computing world, with gamers and coders alike having strong opinions on the best devices. Even then, the standard keyboard layout can be substantially limiting, and often something a little extra and customizable is needed beyond even the highest-quality QWERTY keyboards. Reddit user [RonaldMcWhisky] was looking for a keyboard to use for macros, and discovered that it is possible to put cash register keyboards into service for any unique task.

Cash register keyboards have a number of advantages over a standard QWERTY design. They have big keys, the keys can be labeled, and the keys can be ordered in a way the user wants. The hardware is also cheap since cash registers are everywhere. Adapting one to work with a standard computer took a little bit of doing. Since this is /r/linuxhardware, you’re not going to find any Windows support here, but assuming you have the minimum system requirements of a Linux install to recognize the keyboard itself, a Python script can handle the events as the keys are pressed and interpret them in whatever way you want.

The actual hardware in this specific build was a Wincor Nixdorf TA85P — let us know in the comments if you’ve got one of those in your junk box. But the idea of using a cash register for a custom keyboard is interesting, and certainly a lot of work is already done for you if you don’t want to build your own custom keyboard from the ground up.

A Different Kind Of IKEA Hack: Javascript Price Comparison By Location

When looking for the best deal, it pays to shop around. When it comes to chain stores, of course, one expects the price to be the same across their retail network. However, where international companies are concerned, occasionally a better deal is just a border crossing away. To investigate the best possible price on IKEA’s flatpacked goods, [Sn0w5t0rm] whipped up a scirpt to make comparisons easy.

The hack consists of a small piece of Javascript that runs in a browser extension like Greasemonkey (Firefox) or Tampermonkey (Chrome). When visiting an IKEA product page, it shows the price of the same item in the alternative country of your choice. Often, significant savings can be had – the SKOGSTA table is €176 cheaper in the Netherlands compared to Belgium.

While the script does require some customization to suit your location, it could nonetheless save you a bundle on some home furnishings if your live near enough to a border. We’d love to see the concept taken further to tease out best prices in a given region for goods from all stores. Similar techniques can net you cheap airfares, too!

Raspberry Pi Streams Music Using Only The Default Linux Tools

Getting a  home music streaming system off the ground is typically a straightforward task. Using Apple devices with Airplay makes this task trivial, but if you’re a computing purist like [Connor] who runs a Linux machine and wants to keep it light on extra packages, the task gets complicated quickly. His goal is to bring audio streaming to all Linux platforms without the need to install a lot of extra software. This approach is friendly to light-footprint devices like the Raspberry Pi that he used in his proof of concept.

[Connor] created a set of scripts which allow streaming from any UNIX (or UNIX-like) machines, using only dependencies that a typical OS install would already have. His Raspberry Pi is the base station and streams to his laptop, but he notes that this will work between virtually any UNIX or Linux machine. The only limitation is what FFmpeg can or can’t play.

We definitely can appreciate a principled approach to software and its use, although it does seem that most people don’t have this issue at the forefront of their minds. This results in a lot of software that is bulky, making it difficult to maintain, use, or even know what it does, and also makes it harder for those of us that don’t want to use that type of software to find working solutions to other problems. It’s noble that [Connor] was able to create something without sacrificing any principles.

Teensy Script Plays Nintendo Switch, Strikes Out

The most recent of the Zelda franchise, Breath of the Wild, is known for its many, many puzzles.  One of the more frustrating ones involved bowling with a giant snowball at the top of a hillside.  [Bertrand] did not like this, so he cheated the system hacked the Nintendo Switch so that he “genuinely earned” a strike every time he played.  He achieved this by writing a script for a Teensy module that got him those sweet rupees.

The Teensy houses an Atmel 90USB1286 microcontroller.  When paired with LUFA software, it can emulate numerous controllers including keyboards, joysticks, etc.  It also handily has a Mini-B USB connector located on its rear, allowing it to communicate to the Switch with ease.  After confirming the hardware was compatible, [Bertrand] looked towards the software side noticing the similarity between what already existed and what he was attempting to accomplish.  He happened upon this in a Splatoon 2 fork that allows players to draw posts. 

In essence, it takes image files as input and emulates the controls and buttons to draw a 1-bit version of the image automatically.  This takes care of syncing the hardware as well as how to simulate the button presses.  But instead of reading an image file, it needed to take a custom script as the input.  This required starting from scratch.  The first logical step — of course — was to create a language similar to Logo, a name that surely brings back memories of the time of big hair and shoulder pads.  He only needed a handful of simple commands to control Link:

typedef enum {
	UP,
	DOWN,
	LEFT,
	RIGHT,
	X,
	Y,
	A,
	B,
	L,
	R,
	THROW,
	NOTHING,
	TRIGGERS
} Buttons_t;

Continue reading “Teensy Script Plays Nintendo Switch, Strikes Out”

Sticking With The Script For Cheap Plane Tickets

When [Zeke Gabrielse] needed to book a flight, the Internet hive-mind recommended that he look into traveling with Southwest airlines due to a drop in fares late Thursday nights. Not one to stay up all night refreshing the web page indefinitely, he opted to write a script to take care of the tedium for him.

Settling on Node.js as his web scraper of choice, numerous avenues of getting the flight pricing failed before he finally had to cobble together a script that would fill out and submit the search form for him. With the numbers coming in, [Grabrielse] set up a Twilio account to text him  once fares dropped below a certain price point — because, again, why not automate?

Continue reading “Sticking With The Script For Cheap Plane Tickets”

Eagle To KiCad Made Easy

One barrier for those wanting to switch over from Eagle to KiCad has been the lack of a way to convert existing projects from one to the other. An Eagle to KiCad ULP exists, but it only converts the schematic, albeit with errors and hence not too helpful. And for quite some time, KiCad has been able to open Eagle .brd layout files. But without a netlist to read and check for errors, that’s not too useful either.

[Lachlan] has written a comprehensive set of Eagle to KiCad ULP scripts to convert schematics, symbols and footprints. Board conversion is still done using KiCad’s built in converter, since it works quite well, and we were able to successfully convert two projects from Eagle. The entire process took only about 10 to 15 minutes of clean up after running the scripts.

The five scripts and one include file run sequentially once the first one is run. [Lachlan]’s scripts will convert Eagle multi sheet .sch to KiCad multi sheets, place global and local net labels for multi sheets, convert multi part symbols, build KiCad footprint modules and symbol libraries from Eagle libraries, create a project directory to store all the converted files, and perform basic error checking. The Eagle 6.xx PCB files can be directly imported to KiCad. The scripts also convert Via’s to Pads, which helps with KiCad’s flood fill, when Via’s have no connections — this part requires some manual intervention and post processing.