Close
0%
0%

Silly software wishlist

Motivation to do some software projects by writing them down.

Similar projects worth following
Most of these will never be done. Some have been done. The screenshot is RPN http://heroinewarrior.com/utils/rpn2.c a command line calculator which has proved essential, over the decades.

It might feel like every software project has to be bigger than the last software project, or they're not worth doing.  In reality, before Cinelerra, there were a lot of smaller software projects that just edited audio.  You get to a big software project by doing smaller ones that eventually have something in common & appear to be better served if they were all combined.  

We might be in a downward trend in the size of software projects people consider desirable, with mobile computing & retro computing, but the size required to get discovered is definitely growing.  20 years ago, a silly command line program on a personal web page that extracted emails from pine would have gotten thousands of downloads & been enough to start a foundation.  People used to read through freshmeat.net just to discover new software projects.  

Nowadays, you have to look like a corporation, employ every marketing gimmick in the latest developer conference to get discovered in an app store & forget about any personal web page getting discovered. No-one reads through an app store digest just to discover new software projects.




ATC to tablet: Something that automatically captures instructions from air traffic control on a tablet.  Lions will never have enough money to fly airplanes, but based on goo tube videos, it's manely an arcane task of constantly listening to the radio for your call sign & memorizing verbal instructions they give.  The more cryptic ones are the METAR readouts.  It gets real crazy during landings, when ATC blasts out thousands of things & the pilots are shown writing them down, all while the airplane heads towards the ground at 300mph.  

Ideally, ATC would fly planes directly instead of bothering with radio dialog, but lions are keenly aware the reason general aviation is 100 years behind modern quad copters in its level of automation is because of the number of ancient hand flown airplanes around, where the only means of remote control is relaying voice commands through a human.

Based on digital assistant valuations, it should be trivial for a computer to listen for your call sign, do something to get your attention, translate the spoken commands into drawings on a map.  Despite having no flying budget, such a thing could start life as a toy program that listened to internet streams of ATC.

GRAPHER: something that polls text files & constantly updates a simple line graph with the data in the file would be useful. Graphing serial port output in line graphs has been the #1 task for lions for 15 years, but copying from a text editor to star/open/libra office is extremely tedious. It needs a way for the user to specify a range of lines in the file to constantly graph, with text values, wildcards, & by pointing & clicking on the graph. The range needs to be relative to the start or the end of the file.

An X11 program in C would take only a few hours to write, but lions would rather spend forever contemplating using web browser javascript so someone else could use it.

Big Falcon Simulator, a very high fidelity simulation of a very large rocket, with the highest quality models & sounds possible. It would accurately simulate flights or have a racing mode with knockdowns.  Probably similar gameplay to Asphalt Extreme, but using flight controls.  Previous simulators have horrible graphics. They especially suffer in their renderings of fire.  This is the most ridiculous thing lions can imagine.

text/x-csrc - 1.01 kB - 06/03/2020 at 19:25

Download

x-csrc - 465.00 bytes - 06/03/2020 at 19:25

Download

x-csrc - 1.42 kB - 05/30/2020 at 22:49

Download

x-csrc - 2.02 kB - 05/30/2020 at 03:57

Download

x-csrc - 23.67 kB - 05/22/2020 at 23:09

Download

View all 14 files

  • How fast is a pipe?

    lion mclionhead3 days ago 0 comments

    At least on the  lion kingdom's obsolete 4Ghz 8 core Ryzen, it's

    % ./random |catbps
    
    main 33: 1154458213 bits/sec
    main 33: 1155342065 bits/sec
    main 33: 1158795636 bits/sec
    main 33: 1161013450 bits/sec
    main 33: 1153026045 bits/sec
    main 33: 960231704 bits/sec
    main 33: 1077391216 bits/sec
    
    

    From a phone through ADB, it's

    % adb shell /data/random | catbps 
    main 33: 9080670 bits/sec
    main 33: 5169716 bits/sec
    main 33: 4291419 bits/sec
    main 33: 4482882 bits/sec
    main 33: 8428983 bits/sec
    main 33: 8613113 bits/sec
    main 33: 9701913 bits/sec
    
    
    

    The random program just prints random ASCII characters as fast as possible.  Obviously, adb doesn't do any compression.  The catbps program just measures how fast data is coming from stdin but doesn't write it to stdout.   These are basic needs lions have had for a while.  Next comes hacking ADB to improve this bandwidth.  You can't hack the ADB server on a normal phone, but this is a special phone.

    https://cdn.hackaday.io/files/1380505906331200/catbps.c

    https://cdn.hackaday.io/files/1380505906331200/random.c



  • Delete all IPC objects

    lion mclionhead7 days ago 0 comments

    Management of the audio interface is notoriously bad in Goog Chrome, so we've all adopted the same ritual in the 15 years since the Goog's IPO.

    killall -9 google-chrome-stable chrome chrome-sandbox

    Then, you have to run ipcs & ipcrm to delete all the IPC objects it leaves behind, one by one.  Goog employees don't know how to properly delete shared memory when their programs crash.  For those of us not completely focused on passing interview questions with leetcoding, the secret is to call 

    shmctl(shmid, IPC_RMID, 0);

    right after calling 

    shmat(shmid, NULL, 0);

    But anyways, it was finally time to automate this process.

    https://cdn.hackaday.io/files/1380505906331200/ipcclean.c

    This program just deletes every IPC object.  It has to be run as root.

    .  

  • Download a segmented video file

    lion mclionhead05/30/2020 at 04:23 0 comments

    It's a problem we've all come to know in the last 10 years.  We want to download a video from a site other than the goo tubes, so we start up the network panel in Chrome & load the page.  Then, we look for the largest files being downloaded & files ending in .ts, .mp4, or .webm.  The problem is, it downloads a bunch of small files containing a number like 00002. 

    It's a pain in the ass segmented video.  The trick is finding the 1st & last segment numbers.  Seek to the end of the video to get the last segment number.  Seek to the start of the video to get the 1st segment number.  After being stymied by these files for years, the lion kingdom finally decided to automate the process with a dead simple program.

    https://cdn.hackaday.io/files/1380505906331200/segments.c

    It just searches the URL for the starting number & replaces that block of text with every number until the ending number. If the result is a stream format like .ts, the files can all be concatenated.  If it's a .mp4, the files have to be loaded into an editor.  Currently, it downloads base 10 numbers.  It could be hacked to download hex numbers.

    While it works for some PBS videos & some local TV stations, it doesn't work for discovery channel.  They use some kind of encryption.

  • Transfer files using UDP

    lion mclionhead05/22/2020 at 23:10 0 comments

    https://cdn.hackaday.io/files/1380505906331200/udptest2.c

    This program began life many years ago when the lion kingdom was trying to speed up ethernet by using UDP instead of TCP.  Lions quickly realized this was useless, so it became manely a way of testing UDP connections through large file transfers.  It also works with IPV6, but lions only tested it with numeric IPV6 addresses.

    The general idea is it sends a certain number of packets at a time & waits for an ACK.  There's no windowing or asychronous communication.  It's useful for half duplex like radios.  It uses the same port for receiving on the source & destination.  This was necessary to get around a certain firewall.  The packet size is hard coded.

    The journey begins by starting the receiver on the destination.

    udptest -6 -r 1234

    This waits for connections on IPV6, all interfaces, port 1234.  Then the transmitter starts on the source.

    udptest -6 2017:0000:0000:0000:7690:5000:0000:0001 1234 file.txt

    This sends a file over IPV6.  By default, it sends 1 packet & waits for an ACK.  Leave out the -6 to use IPV4.

    udptest -r 1234

    udptest 10.0.0.14 1234 file.txt


    To increase the number of packets per ACK, provide the -n option to the receiver.

    udptest -r -n 8 1234

    udptest 10.0.0.14 1234 file.txt

  • Use an EOS RP as a webcam on Linux

    lion mclionhead05/14/2020 at 00:54 0 comments

    This only works with the very latest cameras, manely the EOS RP.  The journey begins by compiling the v4l2 loopback device.

    https://github.com/umlaeute/v4l2loopback

    insmod v4l2loopback.ko

    This creates a new /dev/video device which can be simultaneously written & read.  The same device is used for writing & reading.

    Then, with the camera turned on, run

    gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt rgb24 -threads 0 -f v4l2 /dev/video1

    Take note of the frame size.  The same frame size must be used for capturing.

    Then, in the case of Cinelerra, recording must be configured to use uncompressed RGB, Video4Linux2, /dev/video1, 960x640, 15fps, frames to buffer in device: 2.  If the framerate is too high, it'll studder.   If it's too low, it'll studder less but be bearable.  The kernel driver has a bug in its double buffering, as most double buffering newbies tend to have.

    Who knows what settings will get invoked with browser based video conferencing.  An ideal video conferencing system would have gphoto2 send frames to a program that performed some realtime effects, defishing, sharpening, color correction.  

    ffmpeg can perform defishing with some convoluted command line parameters.


    -vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.1:k2=-0.1"

    It uses nearest neighbor scaling & looks absolutely horrid.  1 of the lion kingdom's 2 computers only captures video with the camera in still photo mode.  Another captures video with the camera in video mode.  It's either a gphoto2 version problem or a USB problem.  In still photo mode, the autofocus is disabled.

    After a while, the lion kingdom decided the EOS RP wasn't worth the trouble & went back to an old fashioned webcam for video conferencing.

  • Parse an IPV6 address

    lion mclionhead05/10/2020 at 07:43 0 comments

    IPV6 has been everywhere & nowhere for 20 years now, but for the lion kingdom's day jobs, it's already everywhere.  The problem is the shortpaw notation for the 16 byte addresses is a disaster.  After using it for a long time, lions have only started to intuitively recognize the :: to mean stuff with 0's until the left & right side of the :: are justified.  /128 represents the number of most significant bits comprising the subnet mask.

    Despite some intuition, lions never type even the shortpaw notation but copy & paste all the addresses, so they might as well all be 8 hex numbers.  If IPV6 ever becomes manestream, most animals are going to write the addresses as 8 16 bit hex numbers.  The decision was made to provide a utility for converting the shortpaw notation to a full address.  

    This is most useful for writing IPV6 software.  Linux has the getaddrinfo function which accepts shortpaw notated IPV6 addresses, but lions most often have to program embedded systems which require a full 16 byte address.

    https://cdn.hackaday.io/files/1380505906331200/parseipv6.c

    Let's parse some addresses.

    % ./parseipv6 2017::7690:5000:0:2/64

    2017:0000:0000:0000:7690:5000:0000:0002 prefix=64

    % ./parseipv6 2017::

    2017:0000:0000:0000:0000:0000:0000:0000 prefix=128

    % ./parseipv6 ::ffff:0:0:0/96
    0000:0000:0000:0000:ffff:0000:0000:0000 prefix=96

    ./parseipv6 2600:1:9a28:46f3:0:35:f8b4:f601/64
    2600:0001:9a28:46f3:0000:0035:f8b4:f601 prefix=64

    Despite so many decades of being just around the corner & supposedly allowing every device to have a fixed address, IPV6 addresses are still being assigned dynamically like the good old days.  

  • Copy a file after it's been deleted

    lion mclionhead05/07/2020 at 20:45 0 comments

    A common technique in content management is for a web browser to download to a temporary file, then rename the temporary file only after the download finishes & it has permission to copy it.  If the download fails or of the content is copy protected, the browser deletes the temporary when it finishes. 

    You can copy the file before it's deleted, but there's no way with the traditional cat & cp programs to get the complete file.  The cat & cp programs exit when they hit the end of the file.  Fortunately for Linux, once you have a file handle open, the file handle can still read to the end of the file after the file has been deleted.  The rm & unlink commands are exceptions to the rule of not being able to remove something that's still in use.

    After years of using a custom program to open a file & wait for new output indefinitely, the lion kingdom finally found a variant of the tail program which does it.

    tail -n +0 -f

    It just outputs all the data starting from line 0 & waits for new output.  This technique can't undelete files, of course.

  • The monotonic clock in Linux

    lion mclionhead04/23/2020 at 20:54 0 comments

    Lions finally discovered the monotonic clock, after 25 years of using calendar time functions to calculate delays & timeouts.  The calendar time jumps around when the system time changes.  The monotonic time always increases at a constant rate.  To be fair, the monotonic time functions didn't exist on Linux until 20 years ago.

    Most programs lions have written to use calendar time don't want the calendar time but the monotonic time.  Lions started using a system clock of some kind, probably around 1995.  Before then, what little programming they did was on 8 bit computers with no realtime clock.  Delays involved just incrementing counters or waiting for the raster interrupt.  That's still the way it's done on microcontrollers.

    Where the calendar time came from gettimeofday, the monotonic time comes from clock_gettime

    clock_gettime(CLOCK_MONOTONIC, struct timespec *tp);

    It returns a nanosecond field while gettimeofday has a microsecond field. 

    Helas, it's not as monotonic as it seems.  A user can call clock_settime to set the monotonic clock, just like the realtime clock.  In Linux, clock_settime seems to not work for the monotonic clock.

    Reviewing /usr/include/x86_64-linux-gnu/bits/time.h, there are actually many other clocks besides the monotonic & the calendar.  There's a clock which responds to frequency scaling, a clock that counts suspension times, a clock that counts just cpu usage, a clock that counts cpu usage per thread.  clock_gettime has become a replacement for much of the /proc filesystem.

    The monotonic clock is supposedly part of the POSIX standard, but POSIX these days just means Linux.  If it didn't exist in Linux, it didn't exist anywhere.  It doesn't require librt on Linux.

  • ALSA style routing for video

    lion mclionhead04/17/2020 at 18:42 1 comment

    This will never happen, but it was an interesting idea.  Linux famously had a way to route audio using the .asoundrc file & the ALSA driver.  You could route audio to a loopback device & record it.  You could mix channels different ways, route audio to a network, change sample formats & maybe sample rates.  The conversions were done in the kernel.  

    1 problem was the routing was highly dependent on samplerate & buffer size.  They didn't always have to match, but most combinations didn't work.  The loopback device absolutely never worked for lions.  The buffers always glitched.

    Eventually, ALSA's kernel based routing framework was abandoned as the user space jack framework appeared.  The fact that jack got right what ALSA got wrong appears to be a human issue more than a physics issue.  Thus, the kernel now has tons of dead code which is replicated in user space.

    No routing framework was ever implemented for video.  Video stopped at video4linux 2.  It supported recording & playback on dedicated video hardware.  You'd actually have a video decoding board output to a separate monitor or to another capture board in the same computer which could overlay it on the PC.

    It originally was heading towards a framework for routing, the same as the audio drivers.  A routing framework for video would have required the output of any hardware decoder to end up in a frame buffer.  It would have had ways to loop back video sent to a playback device & mix it different ways.  Perhaps it would have amounted to picture in picture, layer modes, chroma keying, garbage mattes, & standard effects all enabled with a .videorc file & performed in the kernel.  Maybe it could have gone as far as time shifting in kernel space.  It might have been useful for video conferencing.

    1 problem is while video playback originally required dedicated hardware to get good results, it took many paths while audio playback continued to require hardware.  Today, most video playback is purely in software & the highest quality video requires GPU hardware.  The video4linux 2 driver could have been expanded to accept H.265 frames & abstract all the steps involving the GPU to give the user decompressed RGB frames.   The routing framework could have just worked with the RGB frames.  Instead, we got some routines in the X server for handling low level macroblocks & motion vectors.  Of course, getting RGB frames from the output of the hardware could have been hard.


    Multimedia on the desktop stopped progressing around 2010.  Since then, all progress has been on phones.  Android on the lion kingdom's phone no longer uses ALSA for audio or video4linux for 2 video.  Those device nodes are gone, replaced by vendor specific drivers.

    Today, both the kernel & jack frameworks have been replaced yet again by user space API's in Java, Kotlin, or this week's publicity generating language.  The modern audio API's expose none of the routing frameworks that existed before, just the basic volume levels, input source & output destination of the Windows 3.1 control panel.  No such framework still exists for video in the modern user space.

  • Sleep mode on Linux

    lion mclionhead03/31/2020 at 20:47 0 comments

    After 23 years of either leaving Linux boxes on 24/7, running them in virtual machines, or turning them off at the end of every day, the lion kingdom finally got a lucky combination that supported suspend mode.  It was the Ubuntu 16 + Ryzen 7 2700x + Prime X470 Pro motherboard.  What a joy it is to not have to reopen all the programs of the previous day.

    The command to suspend it is pm-suspend.  The mane problem is uninterruptible sleep processes.  It has to SIGSTOP all processes for some reason.  If it runs into an uninterruptible sleep process, it gives up.  Uninterruptible sleep happens to lions because a kernel module died.

    The pm-hibernate command just shuts it down.  pm-hibernate is useful if the shutdown command gets to "power down" but doesn't turn off the power.  pm-hibernate is the 1st command that turns off the power in over 20 years.

    It was then that the limitations began.  pm-suspend disconnects all network connections so vnc & ssh die.  It disconnects ADB, but doesn't disconnect USB storage devices.  That is a real pane for those of us doing complicated builds remotely.  Our only reprieve is being able to scroll back.  Finally, pm-suspend only works maybe 9 out of 10 times.  The other time, it never wakes up.  Linux is still not as reliable as macos in this department.  Fortunately, it syncs the filesystems.

View all 64 project logs

Enjoy this project?

Share

Discussions

Ken Yap wrote 05/07/2020 at 23:55 point

I'm using Free42, a program which is a reimplementation of the HP42S scientific calculator. It exists in both desktop and smartphone versions. Quite indispensable and small, just under 3MB on Linux.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates