Readit News logoReadit News
Posted by u/reverseCh a year ago
Ask HN: What's the most creative 'useless' program you've ever written?
I recently came across the concept of "useless" programs - pieces of code that serve no practical purpose but are fun, creative, or challenging to write. These could be anything from elaborate ASCII art generators to programs that solve imaginary problems. I'm curious to hear about the most interesting or creative "useless" programs the HN community has written. What was your motivation? What unexpected challenges did you face? Did you learn anything valuable from the experience? Some examples to get the ball rolling: 1. A program that prints the lyrics of "99 Bottles of Beer" in binary. A text-based game where you play as a semicolon trying to find its way to the end of a line of code. A script that translates English text into Shakespearean insults. Share your creations, no matter how quirky or impractical. Let's celebrate the joy of coding for coding's sake!
simonsarris · a year ago
I like inserting art, like the header to https://simonsarris.com

A village pops up. There is no point to it. You can click to make more houses. You can right-click to drag things around. When I touch it again I think I'll add a sun and moon that track the time of day for wherever the user is located. Actually the footer has art too, each page has a semi-randomly assigned illustration from public-domain (old) art that I've found. Like drawings from James McNeill Whistler, for instance. I use his illustrations in 'useful' websites too.

Actually, I experimented with the sun/moon a few years ago, in this version: https://simonsarris.github.io/simeville/

If you left-click drag the sun downwards, you'll see the moon come up. That one is open source, but the code is quite slapdash compared to the new one. Also you have to click ITS TIME TO BUILD to get the buildings.

In general I think websites could be a lot more pretty (gorgeous even), silly, interesting, and a lot less corporate chic than they currently are.

BearGrass · a year ago
Your website is very cute. I live on a certain floor of a building, and although the content of the site has no meaning to me, I kept looking at it for a long time, as if I were reading a novel.

Thank you for sharing.

elevatedastalt · a year ago
If the moon is rising when the sun sets, it will be a full moon. But your graphic shows a partial phase :)
dotancohen · a year ago
On Earth, with a single Sun.

But apparently this planet has some very strong radiation protection, possibly synthetic, that blocks out the strong ultraviolet light from their second Sun. That ultraviolet is reflected back in the visible spectrum from the surface of their moon though - thus giving the appearance of a crescent during the entire cycle. The "dark side" is still lit, just lit less.

That was fun ))

sshine · a year ago
I like having this kind of animation on my homepage, too.

Currently I just have an animated GIF background, but I've had some animated ASCII art in the past.

I'm currently working on animating a fractal drawn with HTML Canvas.

Your houses and pencil style are very cute, I feel inspired to make something similar.

I'd like if clicking in the same place would grow whatever's there.

gazook89 · a year ago
For graphics, check out KM Alexander
laksmanv · a year ago
I have to agree, I really miss the 90's when websites had more of a fun artistic creative and personality feel than templated. I see the use for both, but I miss it :)
propagate97 · a year ago
I like it, and I agree with you. Websites follow some simple design rules, some from typesetting, some new especially for the Web. Not least because of the behaviour of base components and the availability of styling libraries that keep their own smell around no matter what one does.

I like to draw on my websites too. I write a gpu-rendered background for basically any website I make for fun.

https://gtblank.org

https://ungut.at

atmosx · a year ago
Wow awesome! Reminded me of Cucinelli's AI website: https://www.brunellocucinelli.ai/ which is one of the best one I've seen. It's dedicated to Mr Cucinelli's life and beliefs. The aesthetics are similar.
johtso · a year ago
Cute! I wonder how hard it would be, rather than having the houses "bounce" up, to make some kind of CSS animation that would look a bit like they were being sketched, some kind of gradual reveal..
Uptrenda · a year ago
I like this a lot. Beautiful, creative, really quite charming.
edding4500 · a year ago
I love the page. I find it very inspiring :)
amunozo · a year ago
Your webpage is gorgeous, congrats!
abc-1 · a year ago
Beautiful personal site!
jinay · a year ago
When I was first learning computer vision, I wrote a program that could tell the time from an image of a clock [1]. I had no purpose for it besides the fact that it seemed like a cool problem to try and solve.

Years later, I get an email from a stranger in Korea, asking me how to run my program. Why would he want to use my silly program? Turns out you can adapt the code to read analog pressure gauges which is really useful for chemical plants. Goes to show that there's often a use for most things.

[1] https://github.com/jinayjain/timekeeper

andrewgleave · a year ago
This is very similar to when I used OpenCV to read the angle of a cardboard knob I pinned on the wall in my office to change the volume on Spotify!
yurishimo · a year ago
That is a super cool idea! Kinda sad that it doesn’t make much sense outside of a very particular use case scenario. Much more practical to mount a potentiometer to the wall for any sort of fixed installation.

It might be cool adapt for a mobile office setup where you’re only present in one location for a few days but still want some automated creature comforts.

christkv · a year ago
lol that’s great and not that useless at all. I could see using Lego and opencv to create adhoc control boards for some fun hacking.
j_bum · a year ago
Thanks for sharing this. The blog article on building your pipeline was a fun read! Your solution has a nice blend of heuristics and DL.

If you’re ever interested in revisiting this click project, you could check out DeepLabCut [0]. A blogpost highlighted a toy example of training a DLC model to recognize clock arms [1], which may or may not be more consistent than your Canny approach :)

[0] https://github.com/DeepLabCut/DeepLabCut

[1] https://guillermohidalgogadea.com/openlabnotebook/training-y...

jinay · a year ago
Woah generalized pose estimation seems really useful and it's cool that the example is for reading a clock. Thanks for sharing!
el_benhameen · a year ago
Your anecdote gave me a genuine “that’s cool” smile, the sort that I haven’t had over a piece of tech in a bit. That must have been a fun email. Thanks for sharing!
blacklion · a year ago
long-long time ago (think end of last century) friend of mine take contract to automatize gas-pump stations on long gas pipe. Stations were here, with analog gauges and valves.

Offer from some "big" business with digital / connected gauges and motorized valves were too much for customer. He wanted much, much cheaper.

There were special modems, which use pipe as data line (think something like 150 baud shared between all stations).

So, solution implemented by my friend was like:

1) Electric motor with gearbox to motorize valves, it was cheap, as standard electric motors are cheap and customer has its own mechanical shop, so everything was cobbled in-house from standard of-the-shelf components.

2) Modem for each station (it was inevitable)

3) Laptop with B/W web cam on each station.

4) Software which can read gauges from webcam shots.

5) Software which transmit values from all stations to central station and allows to manipulate valves from central station (no automation here, 24/7 human operators)

Laptops and cameras were not cheap from personal point of view, but like x100 cheaper than special gauges and valves offered by gas-pipe equipment manufacturer.

It was not called "computer vision" at this time.

Gazoche · a year ago
I used to work for a company that makes smart watches with real (software-driven) mechanical hands, and had to write a very similar computer vision program to read the time from those watches and automatically calibrate the position of the minute and hour hands. So yes it has real purpose ;)
hi_hi · a year ago
Out of interest, how does this account for the orientation of the clock? Is it assuming 12 is always at the top, or is there some way it would work if the photo was somewhat rotated?
jinay · a year ago
Yep, it does some naive rescaling of the clock to make it circular (since perspective would make it more like an ellipse in the image), but then assumes 12 is always at the top.
kekeblom · a year ago
At ETH we worked on an analog pressure gauge reading project. In the larger project, we wanted to read analog pressure gauges in oil refineries. https://github.com/ethz-asl/analog_gauge_reader
gwern · a year ago
If your timekeeper doesn't perform adequately, there's an impressively overengineered neural net project to read clocks: https://arxiv.org/abs/2111.09162 "It's About Time: Analog Clock Reading in the Wild".

(Although I don't know how it would compare to the latest generalist vision models... Clocks are pretty well labeled in photographs online, one would expect.)

nasseri · a year ago
That is so frickin cool!
jinay · a year ago
Thanks!
p0d · a year ago
this had also crossed my mind back a while back for reading home gas meters :-)
dotancohen · a year ago
Did you once share this anecdote on /.? I remember this.
jinay · a year ago
Hmm, I've never used /. so it wasn't me who shared it.
bambax · a year ago
Cool anecdote!
jinay · a year ago
Thank you!
tmoertel · a year ago
I once wrote an OS hack to drive a friend crazy.

This was back in the early 1990s when we worked at a company making Macintosh utility software. My friend, another coder, liked to arrange his Finder windows so that they reflected the underlying folder hierarchy and were perfectly aligned. I mean pixel perfect.

So one day I wrote an extension to patch the OS on his machine to randomly nudge a window by just a single pixel. But only rarely, maybe just two or three times a day.

It had the wanted effect. Every once in a while, I'd hear him huff or mumble "what?" to himself. A couple of days later he asked the room, "Have any of you guys been using my machine? I know someone has. They messed up a few of my windows." Everybody professes innocence and manages not to laugh.

A few more days and he's at his wits' end. He finally says he's going to take the morning to wipe his machine and reinstall the OS.

At this point, we can't contain our mirth, and he catches a couple of us trying to hide our laughter. It's over.

I confess. He's pretty pissed and lets me have it. But he's a hacker, and I know deep down he respects it just a little.

After lunch, we're back at our desks. We're working. It's quiet. Then, I hear him chuckling. "Yeah, that was pretty good."

Edited to add: As penance, I ended up modifying my OS hack to help my friend perfectly align his Finder windows. All he had to do was hold down the control key when he opened a folder, and its window would be perfectly snapped to its parent. A bunch of us started using it. I ended up releasing it as freeware under the name WindowStacker: https://info-mac.org/viewtopic.php?t=14300

QuercusMax · a year ago
Such a fine line between helpful and malicious!
Modified3019 · a year ago
A phrase that sticks with me on describing an aspect of friendships is “insincere hostility”.

I think I originally encountered it from one of Andrew Hussie’s works.

pschuegr · a year ago
Oh boy, this reminded me of university days. I wrote a little servlet which would pop out the CD drive on my friends computer in the lab, and I would trigger it at tense moments in Starcraft games. Good times.
tholman · a year ago
I love a good useless program, I may have written more useless ones than useful. Here's a few of my faves from the last 10 years!

- A password strength page that insults you based on strength https://trypap.com/

- Minesweeper with 1 square https://onesquareminesweeper.com/

- Adding elevator music to "go to top" buttons https://tholman.com/elevator.js/

- CSS Animation library of obnoxious over the top animations https://tholman.com/obnoxious/

- A fake mosquito with the web audio api https://tholman.com/mosquito-js/

ZachSaucier · a year ago
I can't believe you didn't even mention your website dedicated to this, Tim! https://theuselessweb.com/

Longer list here: https://tholman.com/

Loughla · a year ago
I will admit that I clicked the one square in the mine sweeper.

Not sure what I expected.

gazook89 · a year ago
Seems to me it would already be solved by Minesweepers rules, the clock should be stopped.
8n4vidtmkvmk · a year ago
It's just as easy to win.
darepublic · a year ago
Is it too much to ask that the back to top elevator animate an actual elevator travelling up the side of the web page. The elevator music is good but I need it to sound like it would in an actual elevator too. Thanks for these links, they gave me a chuckle.
0x38B · a year ago
The Factorio (1) website has something like that - scroll down to the bottom and click on the rocket ship.

1: https://factorio.com/

et-al · a year ago
Thanks for sharing these. It's really inspiring to see some fun antics like this to bring back the joy of frontend work.
karim79 · a year ago
This stuff is amazing. Thank you! I especially love the mosquito app.
protocolture · a year ago
99% sure i bought a website template years ago with elevator.js

Deleted Comment

Timwi · a year ago
I invented a programming language where you use Unicode box-drawing characters to draw a structure of boxes and lines:

                    ╓───╖
                    ║ ! ║
                    ╙─┬─╜   ┌───╖  ╔═══╗
                ┌─────┴─────┤ > ╟──╢ 2 ║
                │           ╘═╤═╝  ╚═══╝
  ╔════╗  ┌───╖ │             │
  ║ −1 ╟──┤ + ╟─┴─┐           │
  ╚════╝  ╘═╤═╝   │           │
          ┌─┴─╖   │    ╔═══╗  │
          │ ! ║   │    ║ 1 ║  │
          ╘═╤═╝   │    ╚═╤═╝  │
            │   ┌─┴─╖  ┌─┴─╖  │
            │   │ × ╟──┤ ? ╟──┘
            │   ╘═╤═╝  ╘═╤═╝
            └─────┘      │
The language is called Funciton (pronounced: /ˈfʌŋkɪtɒn/) and the above example demonstrates the factorial function.

YouTube playlist: https://youtube.com/playlist?list=PLkG32PHxWoJaetjKUMVRONWLg...

Language specification: https://esolangs.org/wiki/Funciton

Interpreter: https://codeberg.org/Timwi/Funciton

Tepix · a year ago
That seems way too useful to qualify here :-)

Deleted Comment

Dead Comment

ajxs · a year ago
A long time ago I wrote a useless, but fun program that attempts to programmatically recreate a source image by randomly placing randomly sized, randomly coloured rectangles onto a canvas. If the result of this random application of colour is closer to the source image, it's kept, otherwise the changes are discarded. Over time, it gets reasonably close to the source image.

https://ajxs.github.io/pbp/

gdhkgdhkvff · a year ago
Sort of similarly (sorry I don’t have a link handy but could find one tomorrow if anyone is interested), there was an interesting program someone posted in an AskHN post a year or two ago where the program took an input image, started with a blank circle that was made up of a configurable number of “pins” evenly spaced apart around the perimeter, and then starting from one “pin” iteratively found the next pin that, when connected with a line from the current pin, most made the generating image look more like the input image compared to the other possible lines, and then onto the next pin and the next until you had an image that roughly looked like the input image. The point of that original program was to figure out the best way to connect pins inserted around a circular frame with a single long thread and then weave the image with it. The original post had pictures in it of the guy’s finished artwork and everything.

I don’t remember what language he wrote it in, but I converted it to a react app that handled everything client side using html canvas and bitmap images. Not to publish or anything, just for fun.

kuu · a year ago
With your description, ChatGPT tells me it may be this one:

https://github.com/callummcdougall/computational-thread-art

Is it? :)

jimhi · a year ago
Please find! I’m looking for this now too
kristianp · a year ago
I like how the code is just plain javascript, and less than 114 lines of code.

https://ajxs.github.io/pbp/main.js

ajxs · a year ago
I was feeling a bit self-conscious about my 2015 Javascript, and gave it a bit of a polish! So it's slightly more than 114 now. I'm glad you appreciated this! The whole idea is built around a very simple mechanism.
dspillett · a year ago
I've seen a similar thing used to generate low-size versions of images using arbitrary SVG primitives (large triangles or circles rather than small blocks), for use as placeholders while high-res images load. I can't find any of them in quick search, but there were a couple of F/OSS tools that implemented the trick.

UPD: found one of them, https://axe312ger.github.io/sqip/ (look at the “SQIP primitive art” column in that page's examples table)

eloisius · a year ago
Fun. At a very high level this is similar to what Gaussian splats do. You nudge Gaussians, that start out as random blobs in 3D space, in a direction that minimizes a cost between their projections into known camera poses and input images.
IAmGraydon · a year ago
Isn’t this basically how stable diffusion works?
NotAnOtter · a year ago
This is like the tech reporter's version of stable diffusion.

Does it have some similarities? sure. Is it easier to understand than actual stable diffusion? yes.

Is this basically how stable diffusion works? Not even close.

IshKebab · a year ago
No.
nmax · a year ago
This is awesome.
ajxs · a year ago
Thank you very much! The browser landscape was very different when the original code was written, around 10 years ago. Maybe I'll revisit it and see if it can be optimised!
Netcob · a year ago
I didn't expect it to be that useless.

I like to experiment with home automation things, and recently I added a feature to my system where I could push notifications with images to my phone (pretty much everything I do is entirely self-hosted btw). Then a Valetudo update came out - Valetudo is a FOSS replacement for the cloud services usually required for supported robot vacuums. You root your robot, block it from phoning home, install Valetudo, and now you have a robot that won't spy on you unless you specifically tell it to.

So the update introduced a feature where photos with obstacles recognized by the robot are available via the UI/API. So I put something together where I'll get the pic sent as a notification immediately.

In effect, it's like I've subscribed to the most boring instagram feed of the world. Just random low-quality pictures of items in my apartment. The low quality and weird perspective actually makes it look intentional or filtered, as if a mouse is being forced to make a collage for photography class but doesn't feel inspired at all.

tetris11 · a year ago
I love this. I'm in a somewhat home automation tinker place myself, and have made an open source doorbell camera (kinda) using an esp32 chip, since I didn't trust anything else to not spy. It sends me messages over element of any movement lasting longer than 5 seconds, which usually involves an old lady who walks slowly with her zimmer frame across the front of the house. Other than actual doorbell use, most of the images are of this old woman who I've now taken up the habit of greeting if I see her somewhere.
eszed · a year ago
Have you got a write-up or GitHub for your camera? I'd kinda like to do the same, and wouldn't mind a starting point.
hypfer · a year ago
I love everything about this. This is art
yurishimo · a year ago
Could you use this to build your own “poop detector” where an object is routed around until you confirm with the robot if it’s “safe” to proceed in that area?

I love my robot vacuum but I dare never run it when I’m not at home for fear or smearing poop all over my floor on accident. Sadly I didn’t shell out enough money for a bot with superior object detection.

wmanley · a year ago
Maybe just stop shitting on the carpet.
pj1115 · a year ago
I found this just yesterday! I'm sure one could build something better with recent models, but I think the approach is solid.

https://www.youtube.com/watch?v=uWZu3rnj-kQ

hi_hi · a year ago
Put a diaper on it!
Netcob · a year ago
That's mainly what the built-in "AI camera" feature is for. Technically I don't need it - I don't have pets, I don't leave stuff lying around on the floor, and I usually make it to the toilet on time.

I am curious though if I can model a dog turd out of something and have the robot recognize it properly....

Now you could probably attach a raspberry pi with a camera and a coral tpu to a cheaper robot, spend a week trying to get the TPU to work with its dependency hell (or use one of those cameras with object detection built in), and then probably not have much more control other than to pause the robot just in time. That might end up costing more than just to upgrade to a robot with poop detection that can automatically circumnavigate them.

thetomcraig · a year ago
In college, I had an internship at JPL writing software to help collate, transform, and combine pictures of Jupiter, for use with NASA’s JUNO mission.

My coworker and I created a GUI application in IDL (similar to FORTRAN), that would allow the user to open up several images of various wavelengths and combine them into a cylindrical map of the planet, showing its entire surface at a given point in time. After working on this for several months and creating a functional, and actually useful program, we realize that there was a blank space in the toolbar and we had no button that needed to be there. So we put in a button with a cat GIF that literally did nothing. We planned on having it do something jokey, but ran out of time.

I will always remember demoing this to my mentor, basically the world expert on all things Jupiter, showing him what the program did, thus justifying why JPL had spent several thousand dollars to have me as a research fellow. The disappointment in his eyes when he saw that dumb, useless, cat button was priceless.

freilanzer · a year ago
> In college, I had an internship at JPL writing software to help collate, transform, and combine pictures of Jupiter, for use with NASA’s JUNO mission.

This already sounds incredibly cool. I wish I had had an opportunity like this sometime. Sadly, nothing.

> The disappointment in his eyes when he saw that dumb, useless, cat button was priceless.

Some people tend to have no humour. I think it's hilarious.

wing-_-nuts · a year ago
>The disappointment in his eyes when he saw that dumb, useless, cat button was priceless.

I once wrote a p2p filesharing app in college for a networking class, and I had put an easter egg in there where if you requested a certain file (lenin.jpg?) it displayed ascii art of a communism meme and started playing a midi of the soviet national anthem.

My little old networking prof sets down to test my program, and of course, that's the file she requested. She slowly turns to me, looks me in the eye and says 'be honest, you spent more time on that than the actual assignment didn't you?' ...'yes'. She shakes her head and mutters 'nerds!' under her breath, lmao