Lurker News
Cursed hacks, forcing proprietary software to do what you want through clever means, or just generally doing awful, beautiful things with technology?

Comments (499) 174 threads

Earlier comments
fzeindl6 replies#
I wanted a smart thermostat but my 30 year old natural gas heater didn‘t support them. I only had a wheel which I could turn to set the temperature.

So I took double sided tape, stuck a plastic gear on the wheel and put a servo on with another gear on the side, connected to a raspberry pi, that would turn the wheel when my phone would enter a geofence around the flat.
Picture: https://ibb.co/nDvwndp
I even had a bash script to calibrate the servo which would turn the wheel and ask which temperature it set, so it could figure out the step size.

NetOpWibby#
Brilliant
lloeki#
I've been smartifying dumb devices at home as well and came up with similar rubegoldbergesque solutions, although ultimately I didn't need to actually implement any of these as I found other ways to achieve my goals.

One of them involved pointing an old webcam to a segment display, convert shitty image to monochrome in a way that makes vague shapes for the digits and other state icons but clamps everything else to oblivion, and just use some fixed pixel position to "read" and get device state from that.
Made some fun prototyping though.
Also reminded me of: https://thedailywtf.com/articles/ITAPPMONROBOT

callalex#
I just took a 24v AC wall wart power supply and shoved it in the same terminals as the hot and neutral control on the smart thermostat. The A in AC makes this arrangement work just fine to allow the battery of the thermostat to charge without zapping anything.
ajsnigrutin#
There are whole product ranges for stuff like this now (stuff, where you cannot change the interface that is built for fingers and not automation).

eg:
https://www.youtube.com/watch?v=6RJ-zWJcEKc (not affiliated, cheaper models available on aliexpress, both bluetooth and zigbee) - you stick it on somewhere and it pushes a button for you. With added accessories, it can even push (technically pull) the (eg.) light switch the other way, so you only ned one switch per light switch. You can also use it to restart a server/pc, press a tv button remote or even a garage/ramp opener, etc., with zero electronic knowledge and modification (if you're renting out and don't want to replace stuff).

eps#
This doesn't really qualify as "stupid" though.

That's just the good old "interfacing with legacy systems" routine. :)

lqet#
This reminds me of an old Bosch clock I own. This was one of the early electric consumer clocks. It looks very futuristic. But inside, it is simply a mechanical clock with an electric motor attached to the wind-up mechanism. Every few minutes, the motor spins up for a second and winds the clock up again.

https://www.youtube.com/watch?app=desktop&v=0DU0KX9gIk8
The clock is extremely reliable, though. The last batteries lasted for 10 (!) years.

r0ze-at-hn3 replies#
When I was younger I learned that Sed was turing complete. So I did was any young woman would do. I build an entire search engine in Sed. But it wasn't like a useless little search tool that provided bad search capability for a website, no, nearly every page (minus a few like the about page) of a site was nothing more than a presentation on top of the search query results. Several thousand hardcoded "known" pages and infinite possible pages depending on user searches. Because it was the foundation of the site, search worked unlike most websites searches of the era (~2005). This site happily ran for about a decade with surges of traffic now and then before a server migration and too little time prevented its continued existence.

Adult me is both horrified and impressed at this creation.

wodenokoto#
Did you have a file named “main.sed” or was everything a giant bash script that started with “sed $(cat << EOF …”?
phanimahesh#
Wow. Out of everything, this is the most impressive.
reddit_clone#
I had a friend who wrote a minimal dbms in awk just because someone told him it couldn’t be done!
fxtentacle8 replies#
We have a production service running for years that just mmaps an entire SSD and casts the pointer to the desired C++ data structure.

That SSD doesn't even have a file system on it, instead it directly stores one monstrous struct array filled with data. There's also no recovery, if the SSD breaks you need to recover all data from a backup.
But it works and it's mind-boggingly fast and cheap.

brysonreece4 replies#
Wow. How do design decisions get made that result in these types of situations in the first place?
username135#
If I had to guess:

Doing it this way = $
Doing it that way = $$$

MBCook1 reply#
Honestly it’s not too far off from what many databases do if they can. They manage one giant file as if it’s their own personal drive of memory and ignore the concept of a filesystem completely.

Obviously that breaks down when you need to span multiple disks, but conceptually it really is quite simple. A lot of the other stuff file systems do are to help keep things consistent. But if there’s only one “file“ and you don’t ever need metadata then you don’t really need that.
Very smart solution really.

jasonwatkinspdx#
Yeah, a lot of database storage engines use O_DIRECT because the OS's general purpose cache heuristics are inferior vs them doing their own buffer pool management. That said if you try this naively you're likely to end up doing something a lot worse than the Linux kernel.
_zoltan_#
it's a very reasonable thing to do if you need performance.
taneq1 reply#
Someone says "hey if we had 900GB of RAM we could make a lot of money" and then someone else says "that's ridiculous and impossib- hang on a minute" and scurries off to hack together some tech heresy over their lunch break.
speedgoose#
By the way, you can find single servers with 32TB of ram nowadays.
whartung5 replies#
I've always wanted a Smalltalk VM that did this.

Eternally persistent VM, without having to "save". It just "lives". Go ahead, map a 10GB or 100GB file to the VM and go at it. Imagine your entire email history (everyone seems to have large email histories) in the "email array", all as ST objects. Just as an example.
Is that "good"? I dunno. But, simply, there is no impedance mismatch. There's no persistence layer, your entire heap is simply mmap'd into a blob of storage with some lightweight flushing mechanic.
Obviously it's not that simple, there's all sorts of caveats.
It just feels like it should be that simple, and we've had the tech to do this since forever. It doesn't even have to be blistering fast, simply "usable".

MBCook1 reply#
Isn’t that sort of the original idea for how Forth would work? Everything is just one big memory space and you do whatever you need?

I’m going from very hazy memory here.

_0ffh#
I think it is, although you have to manually save the current image if you want to keep the changes you made. Which I find entirely reasonable.

I also think that what gp is looking for is Scratch. IIRC it's a complete graphical Smalltalk environment where everything is saved in one big image file. You change some function, it stays changed.

jdougan#
Arguably you could use GemStone/S like that, though it's probably not the kind of capabilities you want.
tonyarkles1 reply#
That is so wonderfully fascinating to me. You could just download a file into a variable and when that variable goes out of scope/has no more references it’d just be automatically “deleted”. Since there’s no longer a concrete “thing” called a file, you can organize them however you want and with whatever “metadata” you want by having a dict with the metadata you want and some convention like :file as the key that points to the body. Arbitrary indexes too; any number of data structures could all share a reference to the same variable.

Simple databases are just made up of collections of objects. Foreign key constraints? Just make the instance variable type a non-nullable type. Indexes? Lists of tuples that point to the objects. More complex databases and queries can provide a set of functions as an API. You can write queries in SQL or you can just provide a map/filter/reduce function with the predicate written in normal code. Graph databases too: you can just run Dijkstra’s algorithm or TSP or whatever directly on a rich persistent data structure.
Thanks for the neat idea to riff on. I like it! Thinking about it in practice makes me a little anxious, but the theory is beautiful.

mcherm3 replies#
So, I've occasionally played around with a language that pretty nearly does this.

Mumps is a language developed in 1967, and it is still in use in a few places including the company where I work.
The language is old enough that the first version of it has "if" but no "else". When they added "else" later on it was via a hack worthy of this post: the "if" statement simply set a global variable and the new "else" statement checked that. As a result, "if-else" worked fine but only so long as you don't use another "if" nested within the first "if" clause (since that would clobber the global variable). That was "good enough" and now 50 years later you still can't nest "if" statements without breaking "else".
But this very old language had one brilliant idea: persistence that works very much the way you describe. Any variable whose name begins with "^" is persisted -- it is like a global variable which is global, not just to this routine but to all of the times we execute the program.
It is typical to create single variables that contain a large structure (eg: a huge list with an entry for each customer, indexed by their ID, where the entry contains all sorts of data about the customer); we call these "tables" because they work very much like DB tables but are vastly simpler to access. There's no "loading" or impedance mismatch... just refer to a variable.
Interestingly, the actual implementation in modern day uses a database underneath, and we DO play with things like the commit policy on the database for performance optimization. So in practice the implementation isn't as simple as what you imply.

Continue this thread — 3 replies

lproven#
This is what Intel Optane should have given us.

Non-volatile memory right in the CPU memory map. No "drives", no "controllers", no file allocation tables or lookup lists or inodes. Save to memory <16GB, say, it's volatile: that's for fast-changing variables. Save to memory >16GB and it's there even through reboots.

lepisma#
Very interesting. Can you give a sense of the speed up factor?
nurettin#
I do similar things with mmap and dumping raw structs to get insane speeds one wouldn't expect to get from traditional databases.

Perhaps you could even pause the operations, snapshot with dd and resume everything back in order to get a backup.

jasonwatkinspdx#
LMDB has a mode designed to do something similar, if anyone wants something like this with just a bit more structure to it like transactional updates via CoW and garbage collection of old versions. It's single writer via a lock but readers are lock/coordination free. A long running read transaction can delay garbage collection however.
anthk#
Linux had methods to avoid fysnc on filesystems and if you used an SSD and a SAI you would usually have no problems. Pixar used that to write GB's of renders and media for instance.
Shorel#
I love this one.

If anyone from AWS reads your comment, they could have an idea for a new "product" xD

lights0123#
I'm not familiar with C++ rules (the linked answer seems very suspect to me, their argument being "if you change the struct, the struct changes!"), but they could absolutely just be declaring them as extern "C" to use C's layout rules.
btzs4 replies#
As a 12 year old: I tried to overclock my first "good" own computer (AMD Duron 1200 MHz). System wouldn't start at 1600 MHz and I didn't know BIOS reset exists. I ended up putting the computer in the freezer and let it cool down for an hour. I placed the CRT display on top and the power/VGA keyboard cable going into the freezer. I managed to set it back to the original frequency before it died.
tomduncalf#
Hahah this is amazing!
zeroCalories2 replies#
When I was a teenager my friend would throw his laptop into the freezer for a few minutes every hour when we were playing games. He probably threw it in there hundreds of times, and it worked fine for years.
BillyTheMage#
I don't know why but this reminds me of how we picture-framed my friend's old Wifi chip after replacing it, because that chip failing all the time was basically the core feature of our group's gaming sessions.
bombcar#
A friend had an overheating laptop that even an external cooler couldn’t keep up with so he got to sit right next to the open door in winter.

We called it the Frozen Throne.

bryanlarsen1 reply#
I kept a supply of coins in the freezer. I would regularly toss a few into the heatsink on my TRS-80 that was unstable after a RAM upgrade.

Continue this thread — 1 reply

Continue this thread — 1 more reply

Load more comments