Developing An App For Reduced-Gravity Flying

You’ve likely heard of the “vomit comet” — an rather graphic nickname for the aircraft used to provide short bursts of near-weightlessness by flying along a parabolic trajectory. They’re used to train astronauts, perform zero-g experiments, and famously let director Ron Howard create the realistic spaceflight scenes for Apollo 13. But you might be surprised to find that, outside of the padding that lines their interior for when the occupants inevitably bump into the walls or ceiling, they aren’t quite as specialized as you might think.

In fact, you can achieve a similar result in a small private aircraft — assuming you’ve got the proper touch on the controls. Which is why [Chaz] has been working on an Android app that assists pilots in finding that sweet spot.

Target trajectory, credit: MikeRun

With his software running, the pilot first puts the plane into a climb, and then noses over and attempts to keep the indicator on the phone’s display green for as long as possible. It’s not easy, but in the video after the break you can see they’re able to pull it off for long enough to get things floating around the cockpit.

Continue reading “Developing An App For Reduced-Gravity Flying”

Using Local AI On The Command Line To Rename Images (And More)

We all have a folder full of images whose filenames resemble line noise. How about renaming those images with the help of a local LLM (large language model) executable on the command line? All that and more is showcased on [Justine Tunney]’s bash one-liners for LLMs, a showcase aimed at giving folks ideas and guidance on using a local (and private) LLM to do actual, useful work.

This is built out from the recent llamafile project, which turns LLMs into single-file executables. This not only makes them more portable and easier to distribute, but the executables are perfectly capable of being called from the command line and sending to standard output like any other UNIX tool. It’s simpler to version control the embedded LLM weights (and therefore their behavior) when it’s all part of the same file as well.

One such tool (the multi-modal LLaVA) is capable of interpreting image content. As an example, we can point it to a local image of the Jolly Wrencher logo using the following command:

llava-v1.5-7b-q4-main.llamafile --image logo.jpg --temp 0 -e -p '### User: The image has...\n### Assistant:'

Which produces the following response:

The image has a black background with a white skull and crossbones symbol.

With a different prompt (“What do you see?” instead of “The image has…”) the LLM even picks out the wrenches, but one can already see that the right pieces exist to do some useful work.

Check out [Justine]’s rename-pictures.sh script, which cleverly evaluates image filenames. If an image’s given filename already looks like readable English (also a job for a local LLM) the image is left alone. Otherwise, the picture is fed to an LLM whose output guides the generation of a new short and descriptive English filename in lowercase, with underscores for spaces.

What about the fact that LLM output isn’t entirely predictable? That’s easy to deal with. [Justine] suggests always calling these tools with the --temp 0 parameter. Setting the temperature to zero makes the model deterministic, ensuring that a same input always yields the same output.

There’s more neat examples on the Bash One-Liners for LLMs that demonstrate different ways to use a local LLM that lives in a single-file executable, so be sure to give it a look and see if you get any new ideas. After all, we have previously shown how automating tasks is almost always worth the time invested.

Dial Up Over Discord

Some hacks are useful and some are just… well… for the fun of it, and we can appreciate that. Take, for example, [Cool Blog’s] recent experiments with dialup networking. If you think about it, the BBS systems of yesterday have been replaced with more modern tools like Discord. So why not run modems using audio chat over Discord and get the best of both worlds?

This was both easier and harder than we would have expected. The first hurdle was the lack of any actual modems. Luckily, there are software modem emulators like minimodem that makes a PC soundcard work like a modem. It supports some basic protocols, and that’s probably a good thing since the digital audio channel is probably unable to support anything too sophisticated.

Using some crude audio routing 300 baud data did flow. Increasing the baud rate all the way to 2,100 worked reliably. Combining some more sophisticated audio flows and managing sockets with systemd made the process easier. The goal was to, eventually, telnet over the link but that never worked. We would guess that it could work if you spent enough time.

But the proof is in the pudding, and the basic idea works. Why do it? We can’t think of a good reason. But if you want to give it a shot, you can find what you need on GitHub.

Hams still use modems. While we tend to have a soft spot for retrocomputing gear, we don’t miss acoustic couplers at all.

X86 ENTER: What’s That Second Parameter?

[Raymond Chen] wondered why the x86 ENTER instruction had a strange second parameter that seems to always be set to zero. If you’ve ever wondered, [Raymond] explains what he learned in a recent blog post.

If you’ve ever taken apart the output of a C compiler or written assembly programs,  you probably know that ENTER is supposed to set up a new stack frame. Presumably, you are in a subroutine, and some arguments were pushed on the stack for you. The instruction puts the pointer to those arguments in EBP and then adjusts the stack pointer to account for your local variables. That local variable size is the first argument to ENTER.

The reason you rarely see it set to a non-zero value is that the final argument is made for other languages that are not as frequently seen these days. In a simple way of thinking, C functions live at a global scope. Sure, there are namespaces and methods for classes and instances. But you don’t normally have a C compiler that allows a function to define another function, right?

Turns out, gcc does support this as an extension (but not g++). However, looking at the output code shows it doesn’t use this feature, but it could. The idea is that a nested function can “see” any local variables that belong to the enclosing function. This works, for example, if you allow gcc to use its extensions:

#include <stdio.h>

void test()
{
   int a=10;
   /* nested function */
   void testloop(int n)
   {
      int x=a;
      while(n--) printf("%d\n",x);
   }
   testloop(3);
   printf("Again\n");
   testloop(2);
   printf("and now\n");
   a=33;
   testloop(5);
}

void main(int argc, char*argv[])
{
   test();
}

Continue reading “X86 ENTER: What’s That Second Parameter?”

Terminal-Based Image Viewer, and Multi-OS Binary, and Under 100kb

[Justine Tunney]’s printimage.com is a program capable of splatting full-color images to text mode terminal sessions, but that’s not even its neatest trick. It’s also a small binary executable capable of running on six different operating systems: Linux, Windows, MacOS, FreeBSD, OpenBSD, and NetBSD. All without having to be installed or otherwise compiled first. On top of it all, it’s less than 100 kb.

How is this possible? It’s thanks to [Justine]’s αcτµαlly pδrταblε εxεcµταblε format, implemented by a project called Cosmopolitan which aims to turn C into a build-once-run-anywhere language. The printimage.com source code is included within the Cosmopolitan project.

If the name sounds a bit familiar, it’s probably because the Cosmopolitan project is a key piece of a tool we recently covered: llamafile, which allows people to package up an LLM (large language model) as a single-file, multi-OS executable.

As printimage.com shows, terminal windows are capable of more than just text. Still, plain ASCII has its appeal. Check out the ASCII art STL file viewer which might just make your next sick ASCII art banner a bit easier to generate.

One Less Binary Blob

Open-source software has gone a long way into making modern technology the way it is today. The Linux kernel alone is almost single-handedly holding up the entire Internet, and various other open-source projects allow for more access to computing resources not just because the software is often free, but because it’s possible to look under the hood and modify it for specific needs. Without open-source software available we often run into problems both expected, such as software licensing costs, and unexpected, which often come up because a developer can’t or won’t fix issues or add features. To that end, a group at Ghent University in Belgium are attempting to rectify a problem with the ESP32 by eliminating one of its binary blobs and replacing it with an open source driver.

The ESP32 is famously a low-cost microcontroller with on-board wireless capabilities, but its Wi-Fi functionality currently relies on closed-source software from Espressif. The team is currently working on building a fully working open-source networking stack with the hopes of enabling greater flexibility of these devices but also making things like security auditing possible. The other major goal is to improve low-cost mesh networking which is currently not available with the proprietary driver. Reverse engineering is the name of the game here, both from a hardware and a software level, but current versions of the software already able to send and receive packets.

The source code for the project is available on the team’s GitHub page for any open-source aficionados to take a look at. We certainly hope the project gains some steam, as any new open source project helps all of us using the platform. Open source projects frequently get stymied by a single or small handful of binary blobs too, often with little hope for recourse. Examples include Android being an open-source operating system but generally using the closed-source Google Play suite in practice, or Firefox including support for Adobe Flash. Another great example is that even computers running 100% open-source code once they boot their operating systems, there’s still some black boxes running in the background few of us think about.

Thanks to [Crote] for the tip!

BASIC In Your Browser

If you are a certain age or just like retrocomputers, you probably have a soft spot for good old-fashioned BASIC. If you miss those days but don’t want to install a modern interpreter, you don’t have to. Just load a web page containing the “BASIC Anywhere Machine” from [CJ Veniot]. Worried about it being “in the cloud?” It isn’t? It runs in your browser, and if you are a TiddlyWiki fan, it will even live inside your Wiki, which you can host as you please.

The project has lots of features, including some integration back into TiddlyWiki, which we haven’t tried. But you can use graphics commands, work with the mouse, and do other fun things.

Continue reading “BASIC In Your Browser”