51 ms·
Ask HN: What's your "it's not stupid if it works" story?
Cursed hacks, forcing proprietary software to do what you want through clever means, or just generally doing awful, beautiful things with technology?
- deleted 3y ago[deleted]
- zblesk 3y agoI implemented an enterprise data migration in javascript, running in end-user's browsers. (So no server-side node.js or such.) It was a project scheduled for 2-3 months, for a large corporation. The customer wanted a button that a user would click in the old system, requesting a record to be copied over to the new system (Dynamics CRM). Since the systems would be used in parallel for a time, it could be done repeatedly, with later clicks of the button sending updates to the new system. I designed it to run on an integration server in a dedicated WS, nothing extraordinary. But 3 days before the scheduled end of the project, it became clear that the customer simply will not have the server to run the WS on. They were incapable of provisioning it and configuring the network. So I came up with a silly solution: hey, the user will already be logged in to both systems, so let's do it in their browser. The user clicked the button in the old system, which invoked a javascript that prepared the data to migrate into a payload (data -> JSON -> Base64 -> URL escape) and GET-ed it in a URL parameter onto a 'New Record' creation form into the new system. That entire record type was just my shim; when its form loaded, it woke another javascript up, which triggered a Save, which triggered a server-side plugin that decoded and parsed the data, which then processed them, triggering like 30 other plugins that were already there - some of them sending data on into a different system. I coded this over the weekend and handed it in, with the caveat that since it has to be a GET request, it simply will not work if the data payload exceeds the maximum URL length allowed by the server, ha ha. You will not be surprised to learn the payload contained large HTMLs from rich text editors, so it did happen a few times. But it ran successfully for over a year until the old system eventually was fully deprecated. (Shout out to my boss, who was grateful for the solution and automatically offered to pay for the overtime.)
- MBCook 3y agoThat’s horrible. I love it! I’m not quite sure I understand why it was GET though. No way of running something like fetch or (more likely) XMLHTTPRequest?
- YouWhy 3y agoI think the OP (hat off!) needed a way to transfer data to the front-end of another application. Since there's no back end involved, the only available channel is the request URL
- MBCook 3y agoOh that would make sense. Thanks for the guess.
- mkl 3y ago> Since there's no back end involved, the only available channel is the request URL Not quite. I have a system that uses a custom userscript to create an extra button on certain webpages that, when clicked, scrapes some data from the current page and copies a lightly encoded version to the user's clipboard. They then switch to another webpage and paste it in a box. I've also gotten data from place to place using scraping from temporary iframes (same site).
- zblesk 3y agoThat guess was actually quite close. The target system does support the GET way out of the box as a way to pre-fill data into a form; but only over GET.
- alasdairking 3y agoZX Spectrum BASIC. Numbers could only be 8 digits, needed more for a Spacemaster RPG ship designer program I wrote for my friends. Came up with storing values as strings and splitting/manipulating them as numbers when required. About fifteen years old. Probably the smartest thing I have ever written, grin.
- treesknees 3y agoHey, sounds like most of my Advent of Code solutions :)
- jcalvinowens 3y agoI "fixed" an appliance that was nuisance tripping an AFCI breaker by wrapping the power cord one turn through a ferrite choke.
- Noumenon72 3y agoI like how ChatGPT lets you speak efficient jargon while I can read in layman terms. It says an Arc Fault Circuit Interrupter is supposed to detect arcing electrical faults, but some appliances have arcs in their normal operation, causing nuisance trips. A ferrite choke is a ring of magnetic ceramic that is designed to suppress high-frequency electromagnetic interference in electronic circuits. Clever and practical, says ChatGPT.
- flybrand 3y agoRunning an industrial machine installation and my Eastern European colleagues looped a 200 meter tape measure around the line 4 times to get a more accurate measure.
- nomilk 3y agoMine's getting command output out of docker. For long builds (I had one that took 4 hours), it was gutting to have it fail a long way in and not be able to see the output of the RUN commands for thorough debugging. So I devised a stupidly simple way: add && echo "asdfasdfsadf" after each RUN command. I mashed the keyboard each time to come up with some nonsense token. That way, docker would see RUN lines as different each time it built, which would prevent it using the cached layer, and thus would provide the commands' output. I wrote the same thing (more completely) here: https://stackoverflow.com/a/73893889/5783745 https://stackoverflow.com/a/73893889/5783745 (a comment on that answer provides an even better solution - use the timestamp to generate the nonsense token for you) As stupid as this solution is, I've yet to find a better way.
- sopooneo 3y agoI'm a Docker amateur, so this will be a dumb question, but if you were using that technique after every run line in a DockerFile, wouldn't they be the same every time they're run? Like, it's random, but it's the same random values stored in the file, so wouldn't the lines get cached? Or did you adjust the DockerFile each time? Or am I completely missunderstanding?
- nomilk 3y ago> Or am I completely missunderstanding? No, I just didn't explain it very well. You have to mash the keyboard each time (i.e. each build) to come up with some new token. The reason this (dumb) idea was so useful was it was a choice between that (dumb idea) and either run with --no-cache (i.e. wait 2-3 hours) or build normally and not have a clear idea why it failed (since no console output for cached layers), so taking a moment to mash the keyboard in a few places (as absolutely stupid as that is) was way better than the alternative of not having complete console output (docker provides no way to --no-cache on a per layer basis, hence my stupid way of achieving it).
- hyperhopper 3y agoWhy cant you echo a newly generated guid?
- fxtentacle 3y agoWe 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.
- brysonreece 3y agoWow. How do design decisions get made that result in these types of situations in the first place?
- username135 3y agoIf I had to guess: Doing it this way = $ Doing it that way = $$$
- MBCook 3y agoHonestly 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 3y agoYeah, 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_ 3y agoit's a very reasonable thing to do if you need performance.
- throwaway667788 3y agoMy organization has a firewall policy straight outta the 90s. They'll only allow for for static IP to static IP traffic rules over single ports. This is in conflict with modern cloud CICD where you don't know ahead of time what IP you're gonna get in a private subnet when doing a new build. Our work around was to configure HA proxy to be a reverse load balancer and do creative packet forwarding. Need to access an Oracle database on prem? Bind port 8877 to point that that databases IP on port 1521 and submit a firewall rule request.
- GlenTheMachine 3y agoTL/DR: I rearranged the address lines on an embedded controller with a razor knife to "fix" a bug on a bus translation chip. I was writing the motor controller code for a new submersible robot my PhD lab was building. We had bought one of the very first compact PCI boards on the market, and it was so new we couldn't find any cPCI motor controller cards, so we bought a different format card and a motherboard that converted between compact PCI bus signals and the signals on the controller boards. The controller boards themselves were based around the LM629, an old but widely used motor controller chip. To interface with the LM629 you have to write to 8-bit registers that are mapped to memory addresses and then read back the result. The 8-bit part is important, because some of the registers are read or write only, and reading or writing to a register that cannot be read from or written to throws the chip into an error state. LM629s are dead simple, but my code didn't work. It. Did. Not. Work. The chip kept erroring out. I had no idea why. It's almost trivially easy to issue 8-bit reads and writes to specific memory addresses in C. I had been coding in C since I was fifteen years old. I banged my head against it for two weeks. Eventually we packed up the entire thing in a shipping crate and flew to Minneapolis, the site of the company that made the cards. They looked at my code. They thought it was fine. After three days the CEO had pity on us poor grad students and detailed his highly paid digital logic analyst to us for an hour. He carted in a crate of electronics that were probably worth about a million dollars. Hooked everything up. Ran my code. "You're issuing a sixteen-bit read, which is reading both the correct read-only register and the next adjacent register, which is write-only", he said. Is showed him in my code where the read in question was very clearly a CHAR. 8 bits. "I dunno," he said - "I can only say what the digital logic analyzer shows, which is that you're issuing a sixteen bit read." Eventually, we found it. The Intel bridge chip that did the bus conversion had a known bug, which was clearly documented in an 8-point footnote on page 79 of the manual: 8 bit reads were translated to 16 bit reads on the cPCI bus, and then the 8 most significant units were thrown away. In other words, a hardware bug. One that would only manifest in these very specific circumstances. We fixed it by taking a razor knife to the bus address lines and shifting them to the right by one, and then taking the least significant line and mapping it all the way over to the left, so that even and odd addresses resolved to completely different memory banks. Thus, reads to odd addresses resolved to addresses way outside those the chip was mapped to, and it never saw them. Adjusted the code to the (new) correct address range. Worked like a charm. But I feel bad for the next grad student who had to work on that robot. "You are not expected to understand this."
- pavelstoev 3y agoIn the undergrad Control Systems course, I brute-forced Kalman Filter matrix to balance the inverted pendulum on a track experiment. Worked fine.
- kiernanmcgowan 3y agoHave a bunch of static data that should live in a database? Just check that sucker into git and load it into memory on boot. Bing bam boom.
- MBCook 3y agoI used to work at a small company. We had a few remote embedded devices that did work and sent data back to the mothership over the internet. Their firmware could be remotely updated, but we were always very careful. Well one day a mistake was finally made. Some of the devices went into a sort of loop. They’d start running the important process, something would go wrong, and they’d just retry every few minutes. We caught the issue almost instantly since we were watching the deploy, and were able to stop updates before any other devices picked it up. But those that already got it were down. We could ask the devices to send us the output of a command remotely, but it was too limited to be able to send back an error log. We didn’t have time to send back like 255 characters at a time or whatever, we needed to get it fixed ASAP. And that’s when the genius stupid hack was suggested. While we couldn’t send up a full log file, we could certainly send up something the length of a URL. So what if we sent down a little command to stick the log on PasteBin and send up the URL to us? Worked like a charm. We could identify what was going wrong and fix it in just a few minutes. After some quick (but VERY thorough) testing everything was fixed.
- kr0bat 3y agoHow you could have enough control over the machine to reroute the error log to (what I assume was) a Pastebin api, while also lacking access to any of the files on the machine? In my mind you'd be required to ssh into the machine to upload, and if you're ssh'd in, why not just cat the log?
- MBCook 3y agoGood question! We couldn’t SSH in, which is too bad this would all be trivial. We had no direct access to the boxes, they were often behind firewalls. In fact that was the suggested placement for security reasons. They weren’t full servers, just little embedded things. We had a little HTTP API that it was always talking to. It would call the API to send data back to us or just check in regularly, and we would return to it a little bit of status stuff like the current time to keep clocks in sync, and a list of which “commands” they need to run. Mostly the commands were things like “your calibration data is out of data, pull an update“ or “a firmware update is available“. But one of them let us run arbitrary shell commands. The system was very limited. I wasn’t a developer directly on the project but I think it was just our custom software plus busy box and a handful of other things our normal shell scripts used. I assume it had been added after some previous incident. I believe the basic idea was that during troubleshooting you could tell a box to return the output of “cat /etc/resolv.conf” or something else that we hadn’t preplanned for without having to send someone into the field. But since it was only for small things like that it couldn’t return a full file. Luckily one of the commands was either curl or wget. So we could send down “curl -whatever /log/path https://pastebin/upload” https://pastebin/upload” or whatever it was. I don’t remember if we signed up for a pastebin account so we knew where it would show up or if we had it return URL to us in the output of the curl command. This suggestion was literally a joke. We were all beating our heads against the wall trying to help and someone just said “why don’t we just stick it on pastebin“ out of frustration, and the developer on the project realized we had what we needed to do that and it would work.
- gcanyon 3y agoBack in the '90s I consulted at HBO, and they were migrating from MS Mail on Mac servers to MS Exchange on PCs. Problem was that MS Mail on the Mac had no address book export function, and execs often have thousands or even tens of thousands of contacts. The default solution was for personal assistants to copy out the contacts one by one. So I experimented with screen hotkey tools. I knew about QuicKeys, but its logic and flow control at the time was somewhat limited. Enter <some program I can't remember the name of> which had a full programming language. I wrote and debugged a tool that: 1. Listened to its own email box: cole.exporter@hbo.com 2. You emailed it your password (security? what security?) 3. Seeing such an email, it logged out of its own email and logged in to yours. 4. Then it opened your address book and copied out entries one by one. 5. It couldn't tell by any other method that it had reached the end of your address book, so if it saw the same contact several times in a row it would stop. 6. Then it formatted your address book into a CSV for importing to Exchange, and emailed it back to you. 7. It logged out of your account, and back into its own, and resumed waiting for an incoming email. This had to work for several thousand employees over a few weeks. I had 4 headless pizza box Macs in my office running this code. Several things could go wrong, since all the code was just assuming that the UI would be the same every time. So while in the "waiting" state I had the Macs "beep" once per minute, and each had a custom beep sound, which was just me saying "one" "two" "three" and "four". So my office had my voice going off an average of once every fifteen seconds for several weeks.
- binwiederhier 3y agoThe voice thing is hilarious. Thanks for sharing.
- myself248 3y agoI did a similar thing in the Win9x days. I had some sound alert going off once in a while and I couldn't figure out what was causing it, worse, I didn't even recognize the sound. (It wasn't the standard "ding" or "chord".) And when I went into the Windows sound scheme configurator, it had wacky names for some events like "asterisk" and "critical stop", with no explanation of what might trigger them. So as a first step of narrowing it down, I made self-explanatory sounds for everything: I just recorded my voice saying "open program", "program error", "restore down", "exclamation", and so on, through the whole list, and assigned each sound to its respective event. There were a lot of them! (Mind you, it was all the rage at the time to have whole collections of funny sounds assigned to all this stuff, movie lines and SFX and what-not, so there were these subtle games of one-upmanship to have a cooler sound scheme than anyone else.) Not me. I had created the world's most humorless sound scheme. The only possible improvement would've been Ben Stein voicing the whole thing. But in doing so, after a while, it took on this air of absolute hilarity. Like here's this machine that's capable of anything, it could make a star-trek-transporter sound, but there's just some guy's voice saying "empty recycle bin" with a flat, bored affect.
- 0xDEADFED5 3y agoOpenResty http auth for a stats page is a hardcoded password check written in Lua in nginx.conf
- davidbiehl 3y agoI used to work for a small medical device distributor. We used an e-commerce platform that, at the time, didn’t have an API. We wanted to synchronize our products with their platform as products were added, discontinued, copy/image changes, etc. I ended up using capybara (a Ruby gem for writing browser automation instructions for system tests in web apps) to automate all of the “clicks” to make the updates in the system. It actually worked pretty well. It wasn’t fast, but it was better than having a human keep the data in sync. After a few years, the platform released a REST API, and we transitioned to that. But browser automations worked great in the meantime! edit: spelling
- hobs 3y agoI did a lot of bad database things - one time a client wanted me to upgrade their vendor software system but they had a managed service provider that they were in an active legal dispute with. So after the MSP basically stopped responding to them they asked us if we could upgrade "without" SA - our company's position was it was their data so anything they wanted us to do with it was fine. So I had a conundrum - how do I get SA without SA? Well - I knew we had one loophole - we used xp_cmdshell for some critical features of the app, and an unprivileged user can run it. If you're not familiar with xp_cmdshell it basically is a stored procedure that passes your commands out to a windows shell, but its pretty functionally limited on purpose. I wanted to copy the data, move it around, make a backup, send that to a place, and so I wrote that code in powershell, then base64 encoded it (because it needed to survive shell encoding problems), then chunked it across the wire(because length problems), reassembled it, and then executed it with xp_cmdshell. Worked like a charm.
- leeeeeepw 3y agoRunning everything on my own home computers via cloudflared eBank AI art generator and social media netwrck.com are running locally on my GPUs. would have cost fortunes on the cloud
- pizzafeelsright 3y agoDetails?
- timeagain 3y agoI had a database that was in a boot-crash loop because it had a corrupted innodb_history_list for a given table. Everything would be ok if we could just delete the table, but that would involve opening a session and that wouldn’t be possible because of the immediate crashing. On a whim I thought, “well what if I just have a really short amount of time to connect before it reboots?” So I opened up 5 terminal windows and executed “while true; do mysql -e ‘drop table xyz;’ done” in all of them After about 10 minutes one of the hundreds of thousands of attempts to connect to this constantly rebooting database succeeded and I was able to go home at a reasonable time.
- 2024throwaway 3y agoThis is why remote work is so important. You could have been home the entire time.
- SCUSKU 3y agoTo play devil's advocate, had OP not wanted to go home so badly Parkinson's Law would've kicked in and OP may have tried to do things the "right way" which may have taken much longer.
- plugin-baby 3y agoAlso if the DB was on-prem, then the latency when connecting from home might have been too high for the hack to work.
- hutzlibu 3y agoAny ideas on what the "right way" would be in this case? To me the solution seems the most straightforward.
- fragmede 3y agoDrop the table from some sort of safe mode, or figure out the bad entry in the table and hex edit the file to exclude it, or find/write some sort of recovery/fsck problem for the particular database flavor in question. Those are three alternatives that come to mind for me, which is to say, I wouldn't have thought to spam the db like that. Neat trick!
- swissfunicular 3y agoMy corporate VPN wouldn't connect to same public IP after 24 hours (I work from home). So I wrote a very crude bash script on Raspberry Pi Zero 2W (which also runs local DNS server), which would telnet into the router 5 minutes before my login time, and reboot the router
- rnoorda 3y agoI had a router that would need to be restarted every once in a while, so I just plugged it into a Christmas light timer to go off for 15 minutes early every morning. Worked well until we left that apartment.
- sedatk 3y agoI created the most popular Turkish social platform, Eksi Sozluk, using a single plaintext file as its content database back in 1999. It had taken me only three hours to get it up and running without any web frameworks or anything. It was just an EXE written in Delphi. The platform's still up albeit running on .NET/MySQL now and getting banned by Erdogan government for baseless or false reasons (like "national security"). Despite being banned, it was the seventh most popular web site in Turkey two weeks ago, and the second most popular Turkish web site in the same list: https://x.com/ocalozyavuz/status/1735084095821000710?s=20 https://x.com/ocalozyavuz/status/1735084095821000710?s=20 You can find its ancient source code from 1999 here: https://github.com/ssg/sozluk-cgi https://github.com/ssg/sozluk-cgi The platform is currently at https://eksisozluk1999.com https://eksisozluk1999.com because its canonincal domain (https://eksisozluk.com https://eksisozluk.com) got banned. Any visitors from outside Turkey should get redirected anyway. Since it's still a legal business entity in Turkey, it keeps paying taxes to Turkish government, and even honors content removal requests despite being banned. Its appeals for the bans are in the hands of The Consitutional Court to be reviewed for almost a year now. A newspiece from when it was banned the first time this year: https://www.theguardian.com/world/2023/mar/01/eksi-sozluk-why-turkey-blocked-its-most-popular-social-site https://www.theguardian.com/world/2023/mar/01/eksi-sozluk-wh... Its Wikipedia page: https://en.wikipedia.org/wiki/Ek%C5%9Fi_S%C3%B6zl%C3%BCk https://en.wikipedia.org/wiki/Ek%C5%9Fi_S%C3%B6zl%C3%BCk
- mattl 3y agoHow did you make a Windows executable work on the web?
- franzb 3y agoI imagine it ran server-side (on Windows).
- bruce511 3y agoIndeed. I think it's worth going a little deeper for those who perhaps aren't familiar with some of the underlying principles of the Web. For starters, all the program does is receive requests (as text) over a TCP/IP connection. It replies over the same connection. So writing a Web server in any language, on any OS is a trivial exercise. (Once you have the ability to read or write TCP/IP. The program has to accept the input, calculate the output, and send the output. If the input is just file names, then the program just reads the file and sends it. (Think static site). The program may parse the file, and process it some more. It "interprets" code inside the file, executes it, and thus transforms the output. Think PHP. In these cases a generic server fits the bill. Think Apache, IIS, nginx and so on. The next level up are programs that are compiled. They generate the output on the fly, often with no, or little, disk interaction. This sort of program often uses a database, but might not. (An online Soduku game for example might do everything in memory.) Again, any if the above can be built on any OS and written in any language with TCP support.
- oldadmen 3y agoWorked at a public university. Windows server guru ran a script which had a bug that triggered the wipe of thousands of Windows desktops and some servers on campus. Being an electronics nerd first, I went around grabbing the hdds (ultimately collected 600+). Took them, a bunch of ATX supplies, and USB adapters to a computer lab. Used some sufficiently thick wire to jump the pins on the PSUs so they’d power up when plugged in. Plugged in hard drives to lab PCs with USB, into these external power supplies, booted the lab PCs to live USB Linux, ran data recovery over a week, swapping disks as I went. Copied users data to their network drives which was campus policy all along but a lot of people don’t care. So if your power switch ever breaks on your desktop, use wire to jump pins on the PSU
- calamari4065 3y agoI was working on a video game, and we had a few hundred player hosted servers. The default way that steam handles server listings is not super great, and there was quite a lot of metadata for each server I wanted to filter by. I didn't know how to set up a centralized service to handle server discovery ourselves, so I had each server serialize, compress, and base64 its metadata and store it in some "rules" field in the Steam API. Problem was that the rules field was a list of indeterminate length of strings of indeterminate length. Absolutely no documentation, so I had to brute force it to find the limits. It was just barely enough. So the client would fetch the full list of servers, filter on the few parameters steam natively supported, then they'd fetch the metadata for every remaining server. Honestly I feel really bad about this one. It was a bad solution but it worked for years.
- fzeindl 3y agoI 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 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 3y agoBrilliant
- lloeki 3y agoI'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 https://thedailywtf.com/articles/ITAPPMONROBOT
- callalex 3y agoI 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 3y agoThere 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 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).
- ChicagoDave 3y agoI was pitching a “Slack” app five years before Slack was released. Everyone I pitched to thought it was stupid because people already used IRC.
- eps 3y agoSlack was an internal side project for something else they were working on, so they too weren't thinking much of it at first.
- sam_bristow 3y agoAt my previous job I had a number of production test rigs in China for testing PCB assemblies as they came off the manufacturing line. These rigs would sit on the shelf for months at a time and be pulled out to fo a run of a couple thousand boards then put away again. We wanted to collect some stats about the boards being tested but The internet in the factory was really flakey and we didn't want to pay for a 4G internet plan for a rig that was turned off most of the time. I eventually went for a cron job that would just try uploading all the local logs to s3 through rsnapshot every 15min. It worked great and was less than 20 lines of shell script.
- nisalperi 3y agoI built a writing/formatting product now used by 60k+ indie authors. One of the requirements was to format PDFs for print publishing with different themes and configurable layouts. Instead of building a custom PDF rendering engine, I decided to use Puppeteer to generate the PDFs. But there were a bunch of issues we had to deal with: - To render the gutter (margin in the middle) you had to know which side of the book each page would fall on. - To generate the headers and footers, you had to know the exact page number for each of the pages. - You had to know how many pages the table of contents would take up, but you couldn't know the page numbers for each chapter until the book was fully generated. What I ended up doing was to generate multiple PDFs for each chapter, header, footer, and table of contents separately, then stitching them together very carefully to build the final export. Super hacky, but it ain't stupid if it works!
- magnio 3y agoGiven what I know about the PDF spec and the various papercut I had with various PDF tools, your solution seems as sane as it can be tbh.
- azalemeth 3y agoOut of curiosity, did you consider transpiling to LaTeX? Memoir.cls is fantastic at those sorts of calculations and actually the formatting output from pandoc is usually quite good too.
- Mister_Snuggles 3y agoAt my last job, I built a tool to produce standard documents from our green-screen system that held the client data. The users of the green-screen system would tell it to print a document by picking which template to use from a menu. The system would generate an XML file in a directory that was shared out via Samba. A VB6 program watched that directory for these XML files to appear, when one appeared it would figure out what the relevant template was, use COM automation to tell MS Word to load the template, fill in the template fields, save it to that client's folder on the file server, then print (on the user's selected printer in the green-screen system) two copies (one for the paper file, one to mail) and an envelope. There were a bunch of weird word processing practices that made it slightly worse than it already sounds. Each letter that was sent out was actually made of a letterhead (one for each location we operated) and a body with the standard text for various letters we sent. The body would sometimes contain links to other documents (e.g., forms we were requesting someone to fill out), the program would follow these links and print those documents too, but only one copy as we didn't need a bunch of blank forms on the paper file. There was also an Access database used by this VB6 program to maintain various bits of configuration data - mappings of document codes to filenames, mappings of green-screen printer names to Windows printer names, etc. Access gets a bad rap, but it made maintaining that configuration data a breeze. It was horrific, but it saved everyone an incredible amount of time.
- jwsteigerwalt 3y agoSales commission sheets that are just text files. Started doing it in 2007 in VBA when it was not a horrible solution. Between mergers, acquisitions, and divestitures of that sales org, I have rebuilt that system so many times. Today, a full serverless solution, but the output is still 90% the same and could be from the 80’s.
- Tknl 3y agoBack when I was a junior engineer I made a small system for dealing with industrial printers that took either direct printer language commands or pdfs and exported the printer driver output to a file via the Redmon printer driver output file exporter and then ftped it to the printer over the network. This avoided manual driver installation of hundreds of printers and may still be sold in a new project. It's hacky af but still works and beats alternatives.
- EvanAnderson 3y agoI love Redmon! I had a Customer who used Zebra industrial label printers for labeling product. The print jobs came from one of their Customers' ERP servers, sent over a VPN directly to the production line. The Customer might send hundreds of labels in a single job. If the roll of label stock ran out during the job their server would re-send the job from the beginning after the printer was reloaded. This meant somebody had to find and dispose of the duplicate labels (or risk re-using a serialized label). The Customer said that they couldn't modify the ERP software that was composing the jobs. A friend and I wrote a parser for the Zebra "ZPL" printer language to ingest the large jobs, split them into single label jobs, then shoot those single labels into the printer. We used Redmon to intercept the jobs coming from the Customer's ERP server into an LPR queue on a Windows server machine. Redmon would hand the job off to the label splitter.
- garyfirestorm 3y agoIn my previous roles our lab used archaic lotus notes software which had information about which physical tests are being performed by whom. You needed to boot your laptop get on VPN and open this clunky mess of a software program to check if your test was scheduled or not. I figured out a way to have a desktop computer on the intranet, a python script to scrape lotus notes database and some way to push all this data to Teams list every 5-10 mins. Eventually the teams api team shut my access but fwiw I managed to get the list to sync with a teams channel for few months straight. Hacky, stupid and dumb. that’s how everyone could check the status without needing to open an app.
- taneq 3y agoIn my youth I did VJing at a local night spot, and one time (the first time?) my PC didn't boot up (not uncommon after being tossed in a car and driven 40km). Naturally I didn't have a monitor with me to debug it (since my 19" CRT weighed about as much as I did), only a composite video output card which didn't work until after the system had booted. So after pondering my predicament for a minute or so, I unplugged the computer and gave it a sharp smack on the side of the case. This re-seated whatever had been un-seated, it booted fine and from there the gig went off without a hitch.
- bitwize 3y agoI once worked on a project for one of the largest vendors of chemical lab equipment. The application was in... frickin' Microsoft Access, not my choice. This would've been the 90s. The idea is that the sales person would enter in what the lab needed to do and the database would show them the equipment they needed. Anyway, we eventually developed a feature that allowed the application to copy out the lab process and equipment list to a separate database, zip it up, and FTP it to a server. It would also export a CSV file with the name of the lab, salesperson, date of sale, and other searchable information and FTP that up too. I wrote a "web service" (this was late 90s, before that term was cool) that would collect up these CSV files, aggregate them in one big CSV file, and then from within that application that CSV file could be searched and the appropriate ZIP file downloaded and merged with the local database. It was written in Perl and ran as a CGI script on some internal Windows NT machine's IIS instance. It was janky as all get-out, but it worked and we did it a couple of years before the big web services mania hit.
- beders 3y agoToo late for the bonanza here, but back in the day I owned an 8-bit Amstrad CPC 464 machine which came with a built in cassette deck. Eventually a 3"(!) disk drive was launched which needed some extra space in the upper memory banks to host its driver. This made it almost impossible to copy certain games (ok, it was Spindizzy) from tape to disk, since there was no longer enough memory to load the game without overwriting the disk driver. Almost impossible, until I split up the loading process and used the only other remaining RAM possible: the graphics buffer. So while loading the game your whole screen got distorted pretty bad, but it worked: I copied the graphics buffer right over the precious disk driver and the game worked just fine.
- gigatexal 3y agoThis was such a fun thread to read. I love seeing people just come up with solutions however inelegant. I do this myself: get something working and then circle back to make it more maintainable etc. While as a new DBA for Microsoft SQL server on a team of very seasoned DBAs with decades of experience each I wrote a small Python script to fix a replication bug that MS refused to fix. The bug iirc was something related to initial snapshot settings such that by default a setting was set to off so replication would fail. They would normally go and edit this file manually when this happened. When it really blew up it could be editing this file in tens of locations! It was just something they had consigned themselves to doing since it happened just infrequently enough for them not to invest time to fixing but when it did happen it could take an hour or so to do and yeah my noob self thought that’s far too tedious I am not doing that. The bug really should have been fixed by MS and the flag should have been set to on and my script would just find the relavent unc share and text file and basically do a find and replace of that line and toggled the flag. And then replication would work again. I could point the script to a server and it would figure out the path and do the work. All I then had to do was enumerate the servers that were affected and it was fixed in no time. This fix was so popular when I showed it internally that they asked me to turn it into a GUI application. It was awesome. I learned a bit of C# and from what I heard a few years back my little tool was still in USE! Huzzah
- nonethewiser 3y agoIn some ways this is also a “nothing is more permanent than a temporary solution.”
- deleted 3y ago[deleted]
- mmcgaha 3y agoThis is a little different than what you are asking but when I was a kid my C64 would crash if it was on too long and I would lose all of my work. If I ran my mother's vacuum cleaner plugged into the same outlet as the C64 then it would not crash. No I cannot explain it but it worked so that vacuum cleaner would get turned on before I started to save my work to tape.
- sowbug 3y agoThe vacuum probably lowered the voltage, preventing a component from overheating.
- EvanAnderson 3y agoScraping output meant for a printer from old software/systems for "ETL" purposes has been very useful. A few of the uses I can think of during my career: - Apple II-based database used by a choir teacher to track the school music library - MS-DOS accounting software payroll reports to generate W-2 forms - Patient records from a pediatric office - Receipt printer on a gas station pump controller - Customer transactions and balances from a home heating propane supplier - Customer transactions from unattended fueling site controllers You might think this only applies to old software, but often "printing" to a Generic/text-only printer in Windows gives good results.
- rcthompson 3y agoI'm in the middle of such a story right now. I'm doing research on a data set of COVID-19 hospital patients with multiple blood samples over time from each patient. The obvious thing we want to do with this data is to line up all the samples on a single timeline so we can see how the data changes over the course of COVID-19 from infection to resolution. Unfortunately, as with most infectious diseases, no one knows exactly when they were actually infected, which means we can't just sort them by time since infection and be done with it. So, we set out to find some way of inferring the timeline from the data itself (RNA-seq and other molecular assays from the blood, in this case). The first thing we tried was to apply some standard methods for "pseudo-time" analysis, but these methods are designed for a different kind of data (single-cell RNA-seq) and turned out not to work on our data: for any given patient, these methods were only slightly better than a coin flip at telling whether Sample 2 should come after Sample 1. Eventually, we gave up on that and tried to come up with our own method. I can't give the details yet since we're currently in the process of writing the paper, but suffice it to say that the method we landed on was the result of repeatedly applying the principle of "try the stupidest thing that works" at every step: assuming linearity, assuming independence, etc. with no real justification. As an example, we wanted an unbiased estimate of a parameter, and we found one way that consistently overestimated it in simulations and another that consistently underestimated it. So what did we use as our final estimate? Well, the mean of the overestimate and the underestimate, obviously! All the while I was implementing this method, I was convinced it couldn't possibly work. My boss encouraged me to keep going, and I did. And it's a good thing he did, because this "stupidest possible" method has stood up to every test we've thrown at it. When I first saw the numbers, I was sure I had made an error somewhere, and I went bug hunting. But it works in extensive simulations. It works in in vitro data. It works in our COVID-19 data set. It works in other COVID-19 data sets. It works in data sets for other diseases. All the statisticians we've talked to agree that the results look solid. After slicing and dicing the simulation data, we even have some intuition for why it works (and when it doesn't). And like I said, now we're preparing to publish it in the next few months. As far as we're aware (and we've done a lot of searching), there's no published method for doing what ours does: taking a bunch of small sample timelines from individual patients and assembling them into one big timeline, so you can analyze your whole data set on one big timeline of disease progression.
- jonhohle 3y agoIn the early 2000s I worked at an on-campus lab that did 3D printing back when that required machines that were 10s to 100s of thousands of dollars. One of the machines built blocks of paper that were each laser cut and laminated to one another. The company that made it went out of business and there wasn’t any software support. Many of the supported printers had tools to email when various events happened and we used that to page employees to come in and remove finished prints or whatever needed to be done. This machine didn’t have that capability nor any obvious extension points. I ended up writing a VB app that would pill the serial port, which the machine used to talk to the control system, and if the serial port was busy and then became free, send an email. Email was sent by writing a very simple SNMP client. That program ended up working for another, lower cost 3D printer that we acquired later as well. I ended up extending for a 3ᴿᴰ printer to tail its log and look for a message it emitted when prints finished. We share it with a few places and got one of the printer companies to add email support later.
- menage 3y agoAt Google almost 20 years ago, a bunch of our machines (possibly with slightly bespoke CPUs?) were behaving oddly. These machines were mostly in use for serving Google's web index, so almost the entire RAM was devoted to index data; the indexserver processes were designed to be robust against hardware failure, and if they noticed any kind of corruption they'd dump and reload their data. We noticed that they were dumping/reloading massively more often than they'd expect. Eventually the cause was narrowed down to that, randomly when the machine was stressed, the second half (actually, the final 2052 bytes) of some physical page in memory would get zeroed out. This wasn't great for the indexservers but they survived due to the defensive way that they accessed their data. But when we tried to use these new machines for Gmail, it was disastrous - random zeroing of general process code/data or even kernel data meant things were crashing hard. We noticed from the kernel panic dumps (Google had a feature that sent kernel panics over the network to a central collector, which got a lot of use around this time) that a small number of pages were showing up in crash dump registers far more often than would statistically be expected. This suggested that the zeroing wasn't completely random. So we added a list of "bad pages" that would be forcefully removed from the kernel's allocator at boot time, so those pages would never be allocated for the kernel or any process. Any time we saw more than a few instances of some page address in a kernel panic dump, we added it to the list for the next kernel build. Like magic, this dropped the rate of crashes down into the noise level. The root cause of the problem was never really determined (probably some kind of chipset bug) and those machines are long obsolete now. But it was somehow discovered that if you reset the machine via poking some register in the northbridge rather than via the normal reset mechanism, the problem went away entirely. So for years the Google bootup scripts included a check for this kind of CPU/chipset, followed by a check of how the last reset had been performed (via a marker file) and if it wasn't the special hard reset, adding the marker file and poking the northbridge to reset again. These machines took far far longer than any other machines in the fleet to reboot due to these extra checks and the double reboot, but it worked.
- gavinray 3y agoI have a burning desire to know what was going on here -- fascinating.
- 3y ago
- qarue 3y agoI often used to regret buying an item at Costco at high price and few days later seeing discount on the same item. Later found out that Costco has price adjustment policy if price of an item is reduced within 30 days of purchase. Created simple app to tell me if the price is reduced. Its not awesome, but it works. I have got a few 100 dollars so far :) https://reclaimo.vercel.app/ https://reclaimo.vercel.app/
- essayist 3y agoIt's 1996 or so. The web is new. The Bureau of Transportation Statistics (BTS) at the US Department of Transportation collects ontime arrival data for all the major airlines, by flight. It publishes some summary reports, but what people really want to see is how all the flights from, say, JFK to LAX performed in a given month. The monthly database textfile is not that large, but it is unwieldy. I'm a web consultant, but database backends are not yet a thing, at least not for us. Static webpages, all the way down. So I use a script to parse the database into a series of text files and directories. E.g. JFK/index.html is a list of all the airports receiving flights from JFK, e.g. LAX, SFO, etc. And JFK/LAX.html is that month's results for all JFK to LAX flights. Etc. As I recall, once I'd worked it out, it took 15 minutes to generate all those files on my Mac laptop, and then a little ftp action got the job done. Worked great, but someone did complain that we were polluting search results with so many pages for LAX, SFO, etc. etc. (SEO, sadly, was not really on our radar.) That was replaced within a year by a php setup with a proper Oracle backend, and I had to explain to a DB admin what a weighted average was, but that's another story.
- r0ze-at-hn 3y agoWhen 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 3y agoDid you have a file named “main.sed” or was everything a giant bash script that started with “sed $(cat << EOF …”?
- phanimahesh 3y agoWow. Out of everything, this is the most impressive.
- reddit_clone 3y agoI had a friend who wrote a minimal dbms in awk just because someone told him it couldn’t be done!
- iopq 3y agoThe fan I bought was exactly the thickness that I had between the bracket and the top panel of a mITX build. But since it's the EXACT thickness, there's no way to put it there. I ended up sanding the fan's plastic shroud for two hours to get it to fit. It's still in my desktop right now and I won't ever be able to get it out because it's just snug enough to go in.
- Sai_ 3y agoI have a website, blog, a cdn, and a domain level email inbox running off AWS SES. You email specific email addresses which get processed as web pages, blog posts, or attachments extracted to the cdn. All other emails sent to your domain sit inside the inbox. You can also send out emails from any address. The blog and webpages are all SEO optimised so you can share the link on say Twitter and it will unfurl the link and read the meta tags. You can also forward specific emails to a special address to be shared or bookmarked in your browser. The entire thing runs off Lambdas, S3, Cognito, and AWS SES, nary a database. I use pug template files to format content extracted from emails. To make this work, I had to do a deep dive into how Gmail’s email composer translates actions into HTML tags, then align the templates to these behaviours. For a while, I had a handful of paying customers which paid my AWS bills. Right now, I’m down to one customer and the rest of my uses are for personal projects. I learnt a lot in the process - from templating to SEO to S3 usage to Lambdas and got a very usable domain level email inbox and blog out of it. The CDN and static pages are a little less useful but building them too was quite fun. Btw, highly recommend nodemailer as a module for email parsing.
- anon_cow1111 3y agoAll of these other anecdotes are (understandably) sysadmin or developer-related, though I have a couple very stupid ones that are completely physical and mechanical. My first residential plumbing fix was a simple unclogging of a shower drain, which was accomplished by putting a couple inches of water in the tub and blasting repeatedly into the drain with a pneumatic cannon. The splatters hit the ceiling, but it was thoroughly unclogged after a few repetitions. The second major one, was the sewer line at mom's place, which ended up being very bad clog that nasty industrial drain cleaner would not even touch. I capped every drain and vent in the entire house, and dumped two 30 gallon compressor tanks of air into the two toilet hookups. There was great and concerning watery rumbling from all through the house, but after a 30 seconds or so, the clog was blown into the septic and has not given her a single problem since then.
- sowbug 3y agoFor those without a pneumatic cannon, look for a "drain bladder" that attaches to a garden hose. Costs about $10. Mine has never failed me.
- anon_cow1111 3y ago*Note for those with a drain bladder, it will be much safer and more practical than blasting something with a cannon, but not as much fun as blasting something with a cannon.
- Levitz 3y agoI know little about plumbing, don't you risk breaking something by exerting pressure on the installation?
- pierat 3y agoI've broken 2" PVC pipes by using a plunger, baking soda, and vinegar. You can easily get way above rated pressures doing that... doubly so if the PVC is older. After doing that, NOT fixing the problem, and still having a massive plug, I did the next best thing. I cut the run of offending pipe out (clog included), used PVC primer/glue with a fixed joiner, and then bought a thick rubber joiner with 2 screw retaining rings, and joined the other side that way. In hindsight, I absolutely should have rented a power auger and chipped at the clog and freed it. But I didn't.
- ebcode 3y agoIn 2012, Intel had a site called esaa-members.com. It was supposed to be some type of authorized hardware catalog, with recipes for building computers out of known-to-be compatible parts. Anyways, there was a daily import of the hardware data, which was kicked off by a small Ruby script that downloaded some CSV file over SFTP. It was tiny, and all it did was put the CSV in a folder, to be processed by another script down the line. Occasionally though, there would be a network error, and it wouldn't write the file. When this happened, the next script that looked for the file wouldn't find it, and would send out an email alert. That's when I discovered that you could write a GOTO statement in Ruby! I made a very minor addition to the beginning and end of the script, a label at the top, and a goto at the bottom for if the CSV file didn't exist. I had added my email to the list of alerts, and after that GOTO was added, I never saw another alert.
- ramses0 3y ago...an awful one for posterity: an abomination of vim + awk as a proto-protocol plus UI editor. Basically awk would match `/^FOO / { system("foo.exe $0") }` ...you could get pretty darned far with that mechanism, for near minimal amounts of code. Any time you pressed "enter" on a line of text in vim, it'd get thrown through that awk script. If a line matched a command matched in the awk file (think GET, POST, SEARCH, ADD, etc), it'd execute that awk block, which was often just calling over to another executable which did the searching, adding, etc. The interesting thing about it was using it as a UI... you could basically "expand in place" any particular line... have commands return subsequent commands to pick from, etc. Plus the ability to "undo" via vim commands and the fluency of effectively an ad-hoc REPL was a really liberating experience.
- anthk 3y agoYou reinvented Acme in vi.
- sowbug 3y agoNot my idea or implementation. Our startup built a plugin for Microsoft Outlook. It was successful, and customers wanted the same thing but for Outlook Express. Unfortunately, OE had no plugin architecture. But Windows has Windows hooks and DLL injection. So we were able to build a macro-like system that clicked here and dragged there and did what we needed it to. The only problem was that you could see all the actions happening on the screen. It worked perfectly, but the flickering looked awful. At lunch, someone joked that we just had to convince OE users not to look at the screen while our product did its thing. We all laughed, then paused. We looked around at each other and said "no, that can't work." That afternoon someone coded up a routine to screenshot the entire desktop, display the screenshot full-screen, do our GUI manipulations, wait for the event loop to drain so that we knew OE had updated, and then kill the full-screen overlay. Since the overlay was a screenshot of the screen, it shouldn't have been noticable. It totally worked. The flickering was gone. We shipped the OE version with the overlay hiding the GUI updates. Users loved the product.
- faloppad 3y agoLove it, lol
- zerr 3y agoYou could just overlay the Outlook window.
- xxs 3y agoThe thing (screenshot and all) was routine done in the 90s with all those fancy non-rectangular applications/demos/launchers [usually available on CDs that came w/ magazines]. They had transparent/alpha zones that copied the screen under them.
- mixmastamyk 3y agoMemory jogged of an “email system” I built on the school training LAN in the early 90s on DOS PCs via Netware and login scripts. Later I replaced F:\login.exe with my own version written in Turbo Pascal to get the edge over a nemesis or two. :-D
- singingfish 3y agoThis regex that took about 10 minutes to generate was amazingly effective and helped me earn my highest ever daily rate https://gist.github.com/dr-kd/d43c884fbac0089d8523 https://gist.github.com/dr-kd/d43c884fbac0089d8523
- caesil 3y ago>that took about 10 minutes to generate How?
- Matheus28 3y agoI'm assuming: 1. Generate a list of suburbs names separated by | 2. Simplify the regex: 2.1. Convert to a NFA 2.2. Turn it into a DFA 2.3. Merge redundant states 2.4. Turn it back into a regex
- KomoD 3y agonfa? dfa?
- zdimension 3y agoNondeterministic finite automaton and deterministic finite automaton. The theory behind state machines.
- KomoD 3y agoThank you
- singingfish 3y agohttps://gist.github.com/dr-kd/36df691fa395567cb73d1368e4345c6a https://gist.github.com/dr-kd/36df691fa395567cb73d1368e4345c...
- veeti 3y agoDo they ever coin new suburb names? What happens then?
- unwise-exe 3y agoCoworker: hey, what's up with this code? We're having issues getting it to do X. Me: oh yeah, I just hacked it together and never finished cleaning it up to make sense and be adaptable. Here's enough context to hack it again quickly, or if you have time here's my old notes on how to do it right. . I.e., stupid things that seem to work for now, tend to turn into technical debt later.
- kukkeliskuu 3y agoI had very tight schedule to finish some courses and only one weekend to so a statistics excercise. I only noticed after business hours that it is necessary to use DOS software build by the professor, and it is impossible to buy it during the weekends. It was available in the computer rooms, but I had no access. I got a copy of the SW in the net, but needed a license key. It was based on a challenge. Luckily I had a friend who had the SW, and could give me a sample license key. I figured the challange would be based on time, and I was right, it was using epoch as a seed. So I made a script that booted a DOS box, and brute forced one license key a time. It took me a few hours but I succeeded in cracking the SW so I could start the excercise.
- ivolimmen 3y agoPentium machines where just available on the market. I just stared working for a company and some customers started calling that their new machines could not run FoxPro with the applications we build for them. When running FoxPro it would crash with the message: "Division by zero". Nobody knew how to fix the issue (also no word from Microsoft or Intel). I told the customers to use SLOWDOWN.COM a tool I used to run the Digger game on 286 machines and that also worked for more modern machines. Customers where happy and my employer was baffled.
- shw1n 3y agoMy wife was pregnant and tired of doing cold video outreach for our recruiting business, so I wrote a python script that took her best video and just spliced in audio of her saying different people’s names and LinkedIn profiles. To hide the lips not matching the audio, she did a little wave that covered her mouth at just the right time. Example: https://www.loom.com/share/3162a767905c422b8fd423f7448e16f8 https://www.loom.com/share/3162a767905c422b8fd423f7448e16f8 It ended up working so well it generated us over $500k in new business And I ended up turning it into a SaaS (https://dopplio.com https://dopplio.com)
- WizardClickBoy 3y agoI guess you're getting downvoted because this is basically video spam, but it's still clever!
- shw1n 3y agoThanks! Yeah it was really just a funny experiment in the beginning, I didn’t think it’d work haha
- al_borland 3y agoI was given a spreadsheet with a bunch of data and told I needed to use that data to make a couple thousand Outlook email templates. We started out having interns do it, but it was taking too long and they were making a lot of mistakes. I ended up writing an AutoHotKey script to copy stuff out of Excel, switch to Outlook, then build the template and save it in the specified format. It required finding a lot of obscure keyboard shortcuts to make it all work, but it got the job done. It was still a bit manual to run, as it was too fragile to let it all go in one go, and I had to watch it. But it turned days or weeks of tedious work into something that only took a few hours once the script was done.
- Groxx 3y agoNot particularly cursed, but my single-file Ruby-script APNS-notification-pusher with Redis ran for a couple years on the first try, and handled around ten million chat-app users on a single core with no trouble. I profiled to make sure it wasn't leaking when I wrote it and... yep, that's all it really takes. Bare-bones code is pretty effective at reminding me that computers are actually pretty fast nowadays.
- rincebrain 3y agoA couple years ago, I had an idea for convincing a filesystem to go faster using 2 compression steps instead of one. I couldn't see why it wouldn't work, and I also couldn't convince myself it should. It seems to have worked out. [1] [1] - https://github.com/openzfs/zfs/commit/f375b23c026aec00cc9527470084191b5071d9b2 https://github.com/openzfs/zfs/commit/f375b23c026aec00cc9527...
- gia_ferrari 3y agoWe developed some early Windows 8 touchscreen programs. The desktop touch screens issued to us were early prototype garbage and locked up every couple minutes. So I wired up a MOSFET to interrupt the USB power lines at the touch of a pushbutton on my desk. It had to do so for a very specific length of time to ensure a proper monitor reboot. I used that for a year. Think I left it with a co-worker when I left. You could plug anything you wanted into its usb port if you needed a quick reset button.
- Seb-C 3y agoAbout 10 years ago I was working for a French bank, for a small regional team to develop internal tools. The only way we could access the core database was through a mainframe terminal emulator only available on client PCs across the internal network. It was basically an old school terminal based UI where you had to enter specific codes and sequences of keys to navigate. It was not supposed to be automatable, and we did not have permission to deploy any executable to computers on the network. However, we found a way to plug into it by calling an obscure DLL via Internet Explorer's ActiveX. From there, we had access to only two functions: one to send a sequence of key strokes to the emulator, and another which was basically getString(x, y, length). We built whole applications using this database, only via those two functions, which led to giant procedures for each query we had to do. It was terrible, unstable and slow, and broke at every update, but it did the work.
- href 3y agoAs a young linux admin I had a webserver crash and fail to boot afterward. I used a live CD to boot it, but could not fix the boot partition. Since I was able to read the root partition I chrooted into it and started nginx from there. It ran like that for a week while I was preparing a replacement.
- 9dev 3y agoI once built a backup script in Batch (Windows Shell scripting language). That was a while before Powershell got popular, and needed to work on everything from Windows 2000 to Windows 7 or server. Additionally, as I was working for a small (read: 5 guys) IT shop with small customers, it needed to be free, while still supporting lots of advanced functionality (automatic diff backups, restore operations, rotation, network drive mapping, configuration parsing, etc.) that ruled out most proper solutions. While it wrapped a low-level shadow snapshot tool, it still got a few hundred lines long, did crazy logic and output stuff, and even required me to create a unit testing framework for Batch files from scratch. If that all doesn’t sound really noteworthy, it’s because you don’t know that curse of a shell :)
- kukkeliskuu 3y agoIn my first job, a spinning hard disk had been disturbing people for months by making screeching noises. I had been playing a lot with hardware so I knew that pushing the metal part on top of the disk could make that sound disappear. And it did! Told them to keep backups fresh and get a new hard disk.
- grumblepeet 3y agoMany many years ago I worked for a University that had a huge stock of old 386 and 486 pizza box style PC’s and we were implementing Citrix Metaframe on Windows 2000. It was decided to repurpose the older PC’s as thin client boxes, but in initial tests the users hated seeing the older Windows 3.11 OS booting up. We were in a hurry to get rolled out so I ended up making a small GUI on VB6 with two buttons - Load Thin client system and shut down. This replaced the Windows shell and loaded almost immediately. Took me something like 10 minutes to make. Years later I went back (like 10 years later?) and they showed me a sleek new tiny thin client box, and when it loaded there was my VB6 screen with the familiar two buttons. Apparently the users loved it and so they had ported it across to the newer devices ever since.
- ericHosick 3y agoA long time ago I was building a data entry system is Visual Basic for forms that, once entered, need to both store the input in a database and print out the form. There were hundreds and hundreds of different forms. So, instead of making an interface for data entry and then a system to print the forms, the data entry UI for each form looked exactly the same as the forms themselves. Scrolling was needed because at the time there were only low resolution CRT screens. However, for printing, I would draw the filled out form at a very high resolution in video memory "off screen" and print that. So, the work to create one form resulted in supporting both data entry and printing. It turned out that since the people doing the data entry also knew the forms really well, they were able to enter the data 2.5 times faster than initial estimates.
- tbensky 3y agoBack in the early days of Linux (~1993) or so, I was trying to convince my workgroup in grad. school that Linux was a nice alternative for running our numerical simulations (in C). But I knew I had to get the graphics working, since no one wanted to use a text-only interface. It was a Dell PC using some graphics card; the word 'tulip' is in the fog of my memory. The graphics driver was not loading, giving some error about a reference not being found in the .o file. I didn't know what to do, so I loaded up the .o file in vi, searched for the offending reference, edited it out and saved the .o file. From then on the graphics works great!
- fourfour3 3y agotulip is a set of DEC ethernet controllers that are from about the right time as your anecdote :)
- dmazzoni 3y agoIn the early days of Google Chrome, I was tasked with making it work with Windows screen readers. Now, accessibility APIs on Windows were documented, but web browsers used a bunch of additional APIs that were poorly documented. Chrome's design was radically different than Firefox's and IE's, so it was a challenge to implement the APIs correctly. At first I was just trying to get it to work with completely static web pages. Screen readers were reading form controls, but no matter what I did they weren't activating any of their web-specific features in Chrome. I spent weeks carefully comparing every single API between Firefox and Chrome, making the tiniest changes until they produced identical results - but still no luck. Finally, out of ideas, I thought to build Chrome but rename the executable to firefox.exe before running it. Surely, I thought, they hadn't hard-coded the executable names of browsers. But of course they had. Suddenly all of these features started working. Now that I knew what to ask for, I reached out and made contact with the screen reader vendor and asked them to treat Chrome as a web browser. I learned another important lesson, that I probably shouldn't have waited so long to reach out and ask for help. It ended up being a long journey to make Chrome work well with screen readers, but I'm happy with the end result.
- throwaway914 3y agoThat is a good story :) It makes me wonder what future Wayland protocol may enable clients/apps to advertise themselves as screen-reader capable.
- lemper 3y ago[flagged]
- jwoq9118 3y agoLove the lesson here. Don’t wait to reach out for help!
- johnnyo 3y agoI had a similar problem with Nvidia drivers. My boss purchased some laptop with 3D glasses and drivers and wanted me to get our custom software working on it for a cool demo. I read the docs, implemented the right calls, but no matter what I did, I never could get the stereo to kick in. Finally, I renamed our app to doom.exe based on an obscure forum post somewhere, and it immediately worked. I think the driver had whitelist of games it worked with, and only enabled for them.
- Saigonautica 3y agoYears back, there was a CDROM drive I really needed to work at the moment, but it was jammed shut. I could hear it trying to open, and failing. I reasoned that the motor holding it shut had mostly failed in some way, but could still exert some force. So I popped the cover off the drive, took out the magnet that holds it shut, cooked it on a gas stove for a few seconds, and put it back in. Th Curie temperature for a neodymium magnet is a few hundred of degrees, but practically speaking, they will lose a lot of magnetism even at lower temperatures. Popped it back in and the drive worked for another year or so.
- wodenokoto 3y agoDidn’t all cdrom drives have a pin-hole you could jam a needle into and manually open them?
- bongodongobob 3y agoI was a remote sysadmin for a metal fabrication shop that backed up their CAD/machine files to a NAS daily. They had a recurring issue with their backups randomly failing maybe half a dozen times a month. I was told it was nothing to worry about, we've looked into it, tried everything, etc. Client says it's not a big deal. Until it was. They had lost some file, of course, and needed to pull it from yesterday's backup. "Ok, sure I'll just restore it for you." Nope, backups failed the previous night. I don't know exactly what it was, but it was a huge deal and I was tasked with figuring it out, that was now my job. The first thing I did was look at the log history. The only pattern I saw was that backups never failed on Monday nights. Huh. I have no idea what that could mean, so I move on and write a script to ping the NAS from their server using task scheduler every 5 minutes and write a failure to a log. Maybe it's just offline, I have no idea what the cause of the failure is at this point. A couple weeks later, the backup fails and I check the log. Sure enough, the NAS dropped off the network overnight, and came back online in the morning. So I call my contact (he was their CAD guy, technical enough to be able to help me check things out) and ask if anything happened overnight, power outage, anything. He isn't aware of anything. The NAS is online, uptime is good, hasn't been power cycled in months. I have him look at it and there's a MAC address sticker on it so I'm able to trace it back to the switch. Check the switch, sure enough, disconnected during the time shown by my ping log. I have him plug it into a different port, replace both the patch cable and cable connected to the NAS, and disable the previous port. And wait. The next time it happens, I was able to talk them into buying a new NAS thinking it has to be the NIC on it. It's about 3 years old so it's an easy sell, should probably replace it anyway if it's that important. We ship it out, they pop it in, we transfer the data, and we wait. Happens again. So now it this point we are talking about replacing switches, routers, and firewalls. I get 3 different vendors involved. No one is seeing anything out of order, and all their hardware is out of warranty. At this point, the network has been wiresharked to death and everything looks great, absolute dead end. Customer is not happy about having to potentially spend $10k on network gear we can't even prove is bad so I get routed the on call for this backup failure. It happens and I drive over there at 3AM. I arrive, find who is in charge, and they direct me to the network closet. I find out that the NAS is not here. I ask about the NAS. He says oh yeah, that's in a different room. He beings me there and it's in a closet down a flight stairs from the owner's office with the network cable running under the door. The cable is laying on the floor in the office, end completely stripped. Turns out, that was on the route to some supply closet that only third shift used. Third shift was 4 10's, Tues-Sat. They were tripping over the cable and the owner was plugging it in when he arrived in the morning. He was out of the loop for the whole thing so had no idea what was going on. He said it didn't seem to affect his "internet" so he never mentioned it. So what was the hack? I threw a rug on the cable and drove home. (Yes we did move it later, but there were some network changes out of my control that needed to happen first.)
- bmitc 3y agoThere was once an API for an instrument, I believe using COM, that was primarily designed to build an interface with. It had very limited actual functionality to get data from the API, whereas most data was simply to be displayed on user interface elements. We needed a piece of data, programmatically to do something with, that was only available via a user interface element. So I wrote and trained a vision application that would OCR the numeric indicator by taking a programmatic screenshot of the user interface element and then return the value. So at the top level, one simply made a function call that returned a number, but below, it was doing the UI display (hidden), screenshotting a region of the hidden window, OCRing it, and then returning the number. You'd be surprised at the hacks required when interacting with scientific instrumentation. I am not a hacker at heart, but I do take pride when I'm able to wrap a hack such that you'd never know what it was doing underneath. Leaky hacks are no fun.
- scanr 3y agoRestarting a service every night to deal with memory leaks comes up quite often
- sadd258 3y ago[flagged]
- WalterBright 3y agoInstead of translating C header files to D so D could use them, build an actual C compiler into the D compiler and then D can import .c files directly.
- snom380 3y agoOur startup needed to automate our invoicing process. Back in the day there were only a couple of reasonably priced, web based ERP systems in our country. The one we picked had good API docs, but we didn't read the fine print - API access was a high yearly fee, costing almost as much as the regular subscription fee. Their web interface functionality for importing orders/invoices from a CSV file, and looking at the browser requests I could see they were simply using the API in their frontend. A couple of hours later, and we had our invoice import job doing POST requests to their login page, getting the right cookies back and uploading invoice files. Worked fine for years, only requiring a couple of updates when they changed their login page.
- bluelightning2k 3y agoI've done a lot of this type of thing! Great example.
- Mr_Twinkles 3y agoI once had a CD that I really needed to make a backup of, but it was scratched to hell and truly unreadable. I put it in a pot of boiling water for a few minutes, and presto: the CD was readable for a while, letting me back up the files. It'd cool off and become unreadable again, but I'd just put it back on the stove and repeat until I had all of the data.
- Narciss 3y agoWow, was not aware of this hack. Really cool! (no pun intended)
- bluelightning2k 3y agoHotswapping!
- snom380 3y agoThe company I worked for had our office renovated/redecorated. As part of that, we moved offices temporarily, and one of the larger meeting rooms was relocated to a remote building. We didn't have a way of wiring up that meeting room to the rest of our office network, but building management were able to give us internet access in the room. I wanted our employees to be able to roam to that meeting room transparently without any hassle. I knew that OpenVPN had a layer 2 tunneling mode, that could bridge two ethernet networks over VPN. With two leftover workstations, I set up an OpenVPN server in the main office, and an OpenVPN client at the meeting room. By bridging the OpenVPN interface to the ethernet interface on the client, I was able to connect a switch, WiFi access point and videoconferencing equipment. Everything worked perfectly, with even DHCP requests going over the VPN.
- sideshowb 3y agoAs a kid programming games in BBC basic on the Archimedes, I didn't know how to do graphics with things moving around smoothly, but I found some code for changing the sprite for the mouse pointer and moving it to a desired location on screen. Guess how I implemented my main character.
- BiteCode_dev 3y agoIn 2010, one of my client employee kept complaining the report she downloaded from our intranet app couldn't be opened. It was only her machine. It worked on all others. I looked at the file, and it was a tad smaller than on the other machines. I disabled her anti-virus, it worked ! Realizing kaspersky was taking a bite at the report, I created a self signed tls certificate so the anti virus could read it. Worked.
- deleted 3y ago[deleted]
- ess3 3y agoAs a kid I acquired my parent’s login to the school platform meaning I could call in sick myself. However one day I actually got sick so they had to call it in which means they would’ve seen all previous calls. So I downloaded the HTML for all pages required for this exact flow and removed the previous sick days. I then changed my etc/hosts file, gave them my computer and prayed that they wouldn’t try to visit any other page than the ones I downloaded. Worked like a charm. Later I called in sick myself.
- gavinray 3y agoAbsolutely brilliant I used to do the same with school report cards, which began being delivered electronically when I was in Middle School ;^)
- V__ 3y agoHave you ever told them?
- pazimzadeh 3y agoThat’s good. I took AP computer science in high school thinking we would learn how to make apps with graphical user interfaces (didn’t know there was any other kind) so I was uninterested and never payed attention/studied since when we only learned Java and not the kind for making UI’s. I had a friend whose mom was a programmer and she would help us get the answers to homework problems. I would change variable names and a few other things, but one time we still got caught with way too similar answers. In order not to get my friend and his mom in trouble, I told the teacher that I had in fact cheated but not from my friend. I stayed up for a few nights learning HTML and other things (well, modifying other code I found) in order to make a blog where a similar question as the homework problem was discussed, so that I could cite it as my source. At first I tried using blogging software but the timestamps are automatically coded as the current date, which wouldn’t work. So I had to make my own blog-looking site from scratch complete with several months worth of content, which was pretty much plagiarized I think. It was way more effort than actually doing the homework would have been.
- poopbutt7 3y ago[dead]
- Agentlien 3y agoWhen I was a teenager my GPU fan broke, but i happened to have a spare CPU fan. I modified the connector so it would fit and just tied the fan upside down under the GPU with a string. It made an incredible amount of noise but worked very well.
- rpastuszak 3y agoFixing a CD drive with Polish Kielbasa: The CD drive in my first computer broke. We couldn't afford to get a new one, and after almost a year of using floppies I got a bit tired of having to carry them across the mountains every time I wanted play a new game. (context: I lived in a small village in southern Poland at the time -- imagine Twin Peaks, but with fewer people and bigger hills). Sometimes getting a copy of quake or Win 95 took several trips back and forth as I didn't have enough floppies and the ones I had would get corrupted. I turned 10 and finally decided to disassemble the drive and try to fix it. I found the culprit, but I realised that I needed a lubricant for one of the gears. In that exact moment my little brother was just passing by our "computer room", eating a bun with kielbasa (the smoky, greasy kind which is hard to find outside of PL). I put some of that stuff on a cotton swab, lubricated the gears in the drive, and magically fixed it. The drive outlived my old computer (may it rest in pieces). I miss a good Kielbasa Wiejska.
- eps 3y agoThis is glorious.
- badsectoracula 3y agoI have a similar story, except instead a CD drive and kielbasa i had a floppy drive (that was on an XT clone) and i used oil... that is olive oil :-). It worked perfectly for years after that.
- inglor_cz 3y agoAnimal fats make a very good lubricant if the temperature of the parts doesn't rise too high. Once upon a time, car transmissions used whale oil.
- lawgimenez 3y agoReminds me of my brother where he would bring 6-7 floppies to a cafe just to download an anti-virus update.
- alex3305 3y agoAt university we were tasked with making an Android application for a real client. This was part of our course and was really fun to do. Especially because we did this in two groups competing with each other. The app was some sort of geocaching mixed with a quiz to discover a city in groups. We also built a server side app that accompanied the clients. This app was targeting Android 2.3 and ran on some sort of old Xperia device. Building the app was a lot of fun and it worked pretty well most of the time. During beta testing however, we were given all the resources that were crreated by a third party. This mostly included UI elements and other images that made up the UI. Testing it out, again, it worked pretty good. Until one time it didn't... After about an hour or so of playing, the app would consistently crash. After some OS troubleshooting, we came to the conclusion that apparently Android (at the time) had the habit of not putting images in managed memory, but separately. And whenever this space overflowed, an app would simply crash. To resolve this you would need to manage this space yourself and clear out memory. However we only discovered this a week or so before the deadline. And implementing memory management would be nigh impossible to do. So I came up with the hackiest solution that I ever built. I added a crash handler to the app, which would start another instance. I also added a serializer / deserializer to the app and whenever you reached the main menu all play progress was serialized to storage. Whenever the app crashed and restarted, this was read again and letting the users resume play. The only side effected was some weird app flickering because of the crash and restart. A week later when we delivered the app to our clients, they wanted to try it out and play test it. So we did, along with the other group. And lo and behold, after an hour or so the app crashed. And restarted. Unlike the other group, were the app crashed and had to be restarted manually. In the end the client was really happy with the result. Because it just worked. AFAIK the app is still in production the same way it was about 10 years ago.
- emeth 3y agoB2B startup in the sales/financial space. We were solely targeting Salesforce customers in the USA at the time, who conduct all transactions in USD ($). So sprinkled throughout our very large app were thousands of dollar signs - some rendered on page load in the HTML, some constructed via JS templates, some built on graphs in d3.js, and some built in tooltips that occassionally popped up on the aforementioned graphs. One day, a Sales guy pops in with "Hey, I just sold our app to a big player in Europe - but they need the currency to display in Pounds instead of Dollars" (might have been pounds, might have been some other European currency - memory is a bit hazy). CEO steps in and supports Sales guy, says their demo starts in a few days - and the demo needs to take place with the client's data, on their instance, and show Pounds instead of Dollars. Wat? Small dev team, 5 members. We gather and brainstorm for a couple hours. Lots of solutions are proposed, and discarded. We get access to client's instance to start "setting things up" and poke around a bit. We discover that all the field names are the same, and SF was just storing them as numbers. No currency conversions had to be done. We literally just needed to display the pound symbol instead of the dollar symbol. One of the devs on my team says "Hey guys, I have a dumb idea..." In short, he remembered an extension from back in the day called "Cloud2Butt". When you loaded a page, it would scan all html on the page and transparently and instantly replace all instances of the word "Cloud" with the word "Butt". Recollecting this, the dev wondered if we could look at their code, and write something similar to crawl the DOM tree and just replace all dollar symbols with pound symbols. The resulting "fix" would then just be a simple JS function we put on top of our stack, instead of refactoring thousands of files. So... we tried it. With one small addition (making it do it on a setInterval every 100ms, which took care of the tooltips on the graphs) it worked flawlessly. We intended it as a stopgap measure to buy us time, but there were no complaints so we just let that run in production for several years, and the app expanded to several more currencies.
- hyperdimension 3y agoThe cloud2butt user script is great. It also translates "the cloud" to "my butt" for bonus fun.
- gia_ferrari 3y agoTwo car stories. 1. I got to my car and the battery was flat. Fortunately, I had ridden my home-built electric skateboard to it (this was before even the first Boosted Boards came out - completely homemade, I built the trucks, drive system, etc). I went to the Goodwill next door and bought an extension cord for the wire. I stripped the cord, wired the board's battery to the car, and was able to start it. 2. I was driving my classic car home when the alternator failed, at 2am, in the middle of a big city. With my headlights rapidly dimming, I managed to quickly exit and find a parking lot (just as my headlights completely died). Fortunately, I again had that skateboard. I rigged up the battery to the electrical system and made it to within a mile of my house before the fuel pump and spark ignition gave out completely. I easily walked home, put a new battery in my backup car, and I was good. The moral? Replace your car batteries when they're weak :) Also, LiPo batteries are beasts.
- eszed 3y agoOn our way to a remote cabin, when the alternator failed. Well, the alternator itself didn't fail: the bolt holding the distribution lead on corroded through and fell off. No cell service, long ways to any help, and my then-new girlfriend was not at all happy. I wandered up the road and found a piece of wood I could whittle to the right shape, and then dug through the boot. I hung the wire onto the bare stub of bolt remaining, locked the scrap of stick over it, then tied that on with the strap from a pair of old swim goggles. We made it the thirty miles to the cabin, had a good weekend, and the fix was solid enough to make it a hundred miles back home. Oh, and the new girlfriend is now my wife, so all things considered that's by far my most successful hack.
- andylynch 3y agoNeeded a hard drop copy of data from an industrial metering device for auditing and backup. It was the handover point for the delivery of natural gas for a large field and a quarter of the country’s energy supply. The engneers wired an extra serial port onto the lead and plugged it into a printer we had going spare.
- cracrecry 3y agoI bought a lot of DRM books that I could only read in restricted platforms in Windows. I wanted to use in any of my devices without limitations. So I created a VM image of windows inside VMWare inside a Linux computer and basically automated the scanning of the pages in ultra high resolution just using keystrokes from a Lisp Domain Specific Language. The first iteration hack was done in minutes. over time it could OCR almost anything and convert to ebook readable.
- throwawaaarrgh 3y agoAt a hacker con we built a public cluster of terminals. One set of terminals was a bunch of 486's that net-booted a mini Linux distro with just a kernel and an X client, connecting to a hardened X server. I left a root prompt in one of the VTY's so people could mess around with it, but it being a net-booted BusyBox shell, there wasn't much to play with. We weren't concerned about MITM, because the network was token ring - in the mid 2000s. Convention full of hackers, and a bunch of machines with root shells open, but nobody hacked it, because nobody could get on the network. We shipped all the gear up on an Amtrak from Florida to NYC. We had no budget nor interest in shipping them back or storing them, so we stacked them on the sidewalk and started yelling about free computers. In two hours they were gone.
- intellectronica 3y agoSQLite on the server. Did this again and again since the mid 2000s, each time getting reactions ranging from ridicule to horror, and each time achieving great results.
- dan-g 3y agoThankfully these days not as unheard of as it once was! https://fly.io/blog/all-in-on-sqlite-litestream/ https://fly.io/blog/all-in-on-sqlite-litestream/
- aisofteng 3y agoNot quite what was asked but a few of the stories here reminded me of this. Years ago I was working on developing a new cloud native service. The particular microservice I was working on had to call out to multiple other services, depending on the user parameters. Java 8 had just come out and I implemented what I thought was an elegant way to spin up threads to make those downstream requests and then combine the results using these fancy new Java 8 stream APIs. I realized at some point that there was a case where the user would want none of those downstream features, in which case my implementation would spin up a thread that would immediately exit because there was nothing to do. I spent a couple days trying to maintain (what I saw as) the elegance of the implementation while also trying to optimize this case to make it not create threads for no reason. After a couple days I realized that I was spending my time to try to make the system sometimes do nothing. When I phrased it that way to myself, I had no problem moving on to more pressing issues - the implementation stayed as is because it worked and was easy to read/understand/maintain. To this day, I avoid the trap of "sometimes make the system do nothing". One day, that performance optimization will be necessary, but that day has not yet arrived in the ~7 years since then.
- bradhe 3y agoOnce worked IT at a small company in college. Needed to run CAT5 to a new building we acquired. There was no conduit, but there was twisted pair for telephone running between the buildings. Occupying 3 lanes on each side gave us Ethernet on the new building :)
- aisofteng 3y agoYears ago my team was tasked with greenfield dev of a cloud native app while the platform/infrastructure was also evolving. We worked nights and weekends to get it done on time only to find out at the last second that the platform team had enforced controls on internal services being able to access the internet, requiring authentication to do so. This was news to us. We were behind schedule and had, I think, three separately implemented/maintained/deployed services that needed to be able to access the internet to do their work. Rather than implementing the intended auth mechanism in each service, writing tests for it, going through code review, and redeploying, I instead added nginx to the base Docker image they all used, configured them to send requests to that nginx instead of as normal, and made that nginx instance man-in-the-middle our own services to attach a hardcoded HTTP header with the right creds. I man-in-the-middled my own services as a hack - dumb but it worked. It was meant as a quick hack but stayed for I think a couple years. It did end up being eventually being the source of an outage that took a week to diagnose, but that's a different story.
- marginalia_nu 3y agoI built a recipe detector. You can, you know, train some sort of AI model to do this like with fasttext, or maybe roll it old school and do naive bayesian inference, but as it turns out, you can also: https://github.com/MarginaliaSearch/MarginaliaSearch/blob/master/code/features-convert/topic-detection/src/main/java/nu/marginalia/topic/RecipeDetector.java https://github.com/MarginaliaSearch/MarginaliaSearch/blob/ma... It works annoyingly well.
- volkadav 3y agoKinda mundane but it fits with the theme: well before 9/11, a client of the small web agency I was at wanted full drag and drop file management for their company's driver/manual download site, all integrated with their web admin portal. this would've been hilariously complex to implement "web native" with the browsers of the time, and their budget was ... not large. so we slapped an iframe in that part of the admin portal with the url pointed to ftp://admin:whatever@dl.theircorp.com. dumb, but it worked and took like a minute to hack out; client was happy. so it goes?
- AeroNotix 3y agoWorked for a large corporation that is now widely considered a very scummy printer manufacturer. For whatever reason there was an issue no-one could figure out where if either of two networked computers, attached to printers, couldn't communicate (e.g. ping each other) then the printing from the local machine itself would stop working. I wrote a small Erlang application which would monitor an Erlang pid on the other computer and restart the network interface in case it ever lost contact, which generally made things work again. Obviously many ways to solve (such as figuring out why it behaved like that in the first place!!) but I was learning Erlang at the time and it seemed a neat way to do it.
- forinti 3y agoAbout the year 2000, I wrote a web app in Perl that used a file-based hash as a database. This came about because there wasn't any database on the server and sqlite hadn't come about. This solution worked quite well for more than 20 years. The file grew to host hundreds of thousands or orders. My only regret is that I should have charged more. The ROI is unbelievable, the amount I charged is a rounding error. The thing got replaced when the original owner passed away.
- deleted 3y ago[deleted]
- swader999 3y agoAlmost anything with autohotkey. Never outside of my own pc though.
- unnamed76ri 3y agoI once unfroze a pipe by packing Hot Hands hand warmers around it and burying it in horse poop.
- andrewaylett 3y agoI was working on a graphing platform for a bank, back in the days of Adobe Flash. We were replacing server-rendered static charts with charts rendered in Flex, but as we neared completion and entered testing the client noticed an issue: they had a batch job that generated PDF reports containing charts, but the PDF still used the old server-generated charts! Given that the new charts were rendered on the client, this seemed to be an impossible ask -- certainly the client didn't expect us to be able to solve it, once they realised their mistake. I bodged together the standalone Flash player with a headless XServer and some extra logic in Flex, so it would repeatedly hit an endpoint, render a chart with the data returned, then post it back up to another endpoint. It took a couple of rounds of back-and-forth with their IT folk, but it worked! And we heard a couple of years later that it was still running happily in production. For several years I left "Adobe Flex" off my resume, I hope it's dead enough now that I can safely admit to having known how to develop for it. I'm still quite proud of having invented the monstrosity that was "Server-side Flash".
- junto 3y agoIt’s still alive on Adobe’s website at least
- pards 3y agoI was working on a trading system at a bank that didn't have automated deployments so we relied on the Ops team to manually release code to production on our behalf. Release plans had to be documented in MS Word with step-by-step instructions that the Ops team would literally copy and paste into a terminal. It was the worst kind of Sarbanes-Oxley separation of duties theatre. This system was built in Java and was launched using a simple shell script that used a `for` loop to build the classpath by looping over all the JARs in the lib folder and appending them to a shell variable. With the release "process" in mind, hotfixes and patches had to be kept as simple as possible. To release a hotfix we would JAR up the one or two classes that needed to be patched and into a single JAR file, then modify the startup script to pre-pend that JAR file to the classpath so that the patched classes were found first, taking advantage of Java's classpath loading algorithm.
- bnny 3y agoI used to work as a Network Administrator, the team I was on managed something like 200-300 L2/L3 switches and half a dozen core routers. Whenever a new device was connected, the people who ran the ethernet for us were nice enough to connect patch cables to the building switches. The on-site techs would go setup whatever was connecting and we'd go hunting through disabled ports for one that came up with the matching MAC. This could take up to 30 minutes depending on the size of the switch. One day I had enough time to scrape together some VBScript in an Excel document we used as our day-to-day documentation of our management IPs. It would snag the list of disabled interfaces from your clipboard, run a simple regex, generate a command to select all the interfaces, and shove it back into your clipboard. It was disgusting, but it also changed 30 minutes of mind-numbing work with the on-site techs sitting on their hands into around 5. It stuck around for about 3 years.
- kidintech 3y agoWhile working on an enterprise platform, one of its customers in the banking industry wanted to migrate from on-premises to running it on whatever cloud was popular at the time. The migration was long, tedious, and overly complicated in its own right (i.e. one proposed solution for the "how do we migrate all data safely across the continent?" question involved armored trucks) but just as we reached the T-1 day mark, I realised we had forgot something. The customer was regulated by various entities, and so it had to deliver periodic audit logs in a particular format. The raw logs (stored in a cloud hosted bucket) would not be sufficient and had to be parsed; in order to process the logs into the desired format, the customer wrote thousands of lines of code in the platform that I was in the process of migrating. This code could only run on the platform, due to some other esoteric privacy regulation. So there I was on a Sunday, with : - a few hours to deliver up-to-date, formatted audit logs to regulatory entities or risk legal action - raw logs in a cloud bucket that required ingestion and processing - a new cloud platform that could process the logs but was unable to ingest data from the other provider's cloud bucket (due to some temporary allowlisting ingress/egress issue and this being one of the first migrations onto the new cloud) - an onprem platform being decommissioned and no longer allowed to process the logs BUT capable of ingesting them The solution I came up with was to have the data flowing: log bucket in cloud provider A -> decomissioned platform running onprem -> connector I wrote that evening and had no time to test -> platform running on cloud provider B The ship was afloat the next morning and everything was in order despite cutting it close; I am now a big fan of exhaustive planning, months in advance.
- jjice 3y agoI work on an ETL service that interacts with a good few, semi diverse third party systems. We organize these by individual jobs that get run and a job will process certain types of data and spawn different sub jobs in specific situations. We wanted to have a compile time map of this data and a graph of the sub jobs. To do this, I tossed together a thirty minute script that took the source of our job functions and then ran a few regular expressions on them to extract the data we needed. It was filthy. Regex on source files just feels wrong. Problem is, it's worked great for the last six months and it's still going strong, so we can't justify changing it. The generated data has been extremely valuable for optimizing data fetching paths for customers.
- mycall 3y agoTo keep my MS Teams from going to "away from keyboard" and my work Windows 10 workstation from screen locking while AFK, I wrote a loop shell script which moves the mouse 1px left then 1px right every 30 seconds. Domain GPO can suck it.
- michaelcampbell 3y agoLowkey compared to some here. A friend of mine was hit with a "prank" that created a directory hierarchy so deep the OS couldn't get down to the lowest levels of it. Not even `rm -rf` would work, and I couldn't `cd` to the lower levels to start deleting things one at a time. I realized I could `mv` the top level directory to a sibling of its head, rather than to the child of it, cd into that, delete all the files, then do the same with any subdirs. So I was able to script that and started deleting the files/dirs from the top, rather than the bottom up. Took a while, but worked.
- myself248 3y agoBefore CPU throttling or fan speed control, I wanted my 486 to be quieter when it wasn't doing much. My siblings and I had built a 486DX/40. Intel's chips topped out at 33MHz until you got into the clock-doubled DX2/50 (which ran its bus at 25 MHz) or the DX2/66 (33). But AMD's DX/40 wasn't clock-doubled, the core and the bus both ran at 40MHz. In the days before accelerated graphics, all pixel-pushing went through the CPU, so this was a very big deal for games. It also ran hot enough that a CPU fan, optional-but-a-good-idea on slower chips, was an absolute necessity here. But the fan (a little 40mm Crystal Cooler™) would never be described as silent. So when I wasn't gaming, I'd remove the 3.5" floppy drive from the case (it was in a modular sled, and the cables had enough slack that I could just unplug it), then reach in through the resulting opening, and re-jumper the clock-generator IC on the motherboard. Live, and blind. I knew that moving the jumper-cap one position towards me would go from 40MHz to 8, and that was enough to seriously drop the heat. The first time I did this I was flabbergasted that the machine didn't crash, but evidently it was fine? The no-jumper state was something like 12MHz or whatever, so presumably it was just blipping through that speed as I moved the jumper. Then I'd unplug the CPU fan and enjoy the silence. This was particularly nice during a long download, where servicing the UART ISR didn't exactly take much processor time. Even better, the computer room was in the basement, and the FM radio signal from my favorite station was pretty weak. So weak that, if I tuned just a smidge off to the side of the station, my radio receiver would pick up little ticks of interference from the computer, while still being able to hear the music. This meant I could turn off the monitor too, and just listen to music while downloading whatever file. When the ticks stopped, the UART buffer was no longer triggering an interrupt, meaning the download was done, so I could turn the monitor back on and resume my BBS session, clock the CPU back up and plug the fan back in to unzip the file in a reasonable amount of time, and otherwise get on with my day.
- sandreas 3y agoI recently implemented pure-todo[1] just for myself, because I did not like any of all of the Todo list apps out there... I chose to not use any boilerplate, frameworks or libraries as long as I can get along. Did not respect any ES6 whatever limitations of browsers and used whatever I wanted to use. Just pure PHP, sqlite, vanilla JS and CSS like in the old days with ES6 flavour here and there :-) What sounded really stupid because I ignored all the fancy frameworks made me learn a lot of things and it also turned out that it just works on my systems (Android, iOS, Linux, Window with Firefox, Safari and Chrome). Maintenance will be a nightmare though... Caution: Use it at your own risk because there will pretty likely breaking changes in the near future :-) [1]: https://github.com/sandreas/pure-todo https://github.com/sandreas/pure-todo
- trws 3y agoRunning the largest workload I’ve ever personally launched (4,200 nodes, 144 cores each, 16,000 simultaneous jobs with a mix of one 1,000 node cpu job, 1 AI selection service on one node, about 3,200 nodes worth of 4-core cpu input pre-processing jobs and 4 GPU jobs per node co-located with all the CPU stuff) at 2am the day of the deadline for something about 50 of us had been working on for most of a year, realizing something was set wrong in the launcher. It was our last chance for a full run, we couldn’t start it over or try again, and it was going to fail because of a single runtime value. I attached gdb to the launcher, “print <var>=<value>” and detached. The run started going about 10 times faster and we got the whole thing done. Crazy, dangerous, but it worked. Question also made me think of the last-minute change we needed to make to a database’s structure to avoid about 6 million lost user updates when all DB admins were out with no password. That was a fun one too. Not sure I should admit how we managed it.
- pomatic 3y agoIt's the early 90's. A large regional Theatre wants to migrate their billing and customer contact data - all of which is held on an ancient computer the size of a desk to a shiny 286 based PC. Only the proprietary database management application frontend was available; there was no documentation, no programming tools or anything similar, the equipment was just too old (and the internet was still in its infancy, it'd be much easier today). My solution was to knock up a script on a PC that emulated the serial printer that was connected to the ancient system, wire a custom cable between them and then tell the database to run a full report. Took a day or two to run as I recall, and job's a goodun.
- lelanthran 3y agoIn the days of dialup internet, I used a phone company that offered, between 1900 and 0700, free calls for calls under 30m. So I wrote a cron job that, at 1905, started a script which sat in a loop, dropping the connection, dialing again, and then `sleep` for 29m, until the time got to 0655. Very stupid, but it worked, I guess.
- cdbattags 3y agoI worked for an education technology company that made curriculum for K-8. There are long sales cycles in this space and different departments of ed have different rules. Think "vote every 4 years because our books are out of date or just old". The technology wave came fast and most of this curriculum from incumbent providers was formatted to fit in a book with maybe some of the most cutting edge people having a large InDesign file as the output. The edtech company I worked for was "web first" meaning students consumed the content from a laptop or tablet instead of reading a book. It made sense because the science curriculum for example came with 40+ various simulations that helped explain the material. A large metropolitan city was voting on new curriculum and we were in the running for being selected but their one gripe was that they needed N many books in a classroom. Say for a class of 30 they wanted to have 5 books on backup just in case and for the teachers that always like a hardcopy and don't want to read from a device. The application was all Angular 1.x based that read content from a CMS and we could update it in realtime whenever edits needed to be made. So we set off to find a solution to make some books. The design team started from scratch going page by page seeing how long it would take to make a whole book in InDesign but the concept of multiple editing doesn't really exist well in this software. Meanwhile, my team was brainstorming a code pipeline solution to auto-generate the book directly from the code that was already written for the web app. We made a route in the Angular app for the whole entire "book" that was a stupid simple for loop to fetch each chapter and each lesson in that chapter that was rendered out on a stupidly long page. That part was more less straightforward but then came the hard part of trying to style that content for print. We came across Prince XML which fun fact was created by one of the inventors of CSS. We snagged a license and added some print target custom CSS that did things like "add blank page for padding because we want new chapter to start on the left side of the open book". But then came the devops portion that really messed with my head. We needed a headless browser to render out all of this and then we needed the source with all the images, etc to be downloaded into a folder and then passed to Prince XML for rendering. Luckily we had a ECS pipeline so I tried to get it working in a container. I came up with a hack to wait for the end of the rendering for loop for the chapters/lessons to print something to console and then that was the "hook" for saving the page content to the folder. But then came the mother of all "scratching my head" moments when Chromedriver started randomly failing for no reason. It worked when we did a lesson. It worked when we did a chapter. But it started throwing up a non-descript error when I did the whole book. Selenium uses Chromedriver and Chromedriver is direct from Google and Chromium repo. This meant diving into that C++ code in order to trace it down when I finally found the stack trace. Well yeehaw I found an overflow error in the transport protocol that happens from Chrome devtools as it talks to the "tab/window" it's reading from. I didn't have the time to get to the bottom of the true bug so I just cranked the buffer up to like 2 GB and recompiled Chromium with the help of my favorite coworker and BOOM it worked. But scaling this thing up was now a nightmare because we had a Java Dropwizard application reading a SQS queue that then kicked off the Selenium headless browser (with the patched Chromedriver code) which downloaded the page but now the server needed a whopping 2 GB per book which made the Dropwizard application a nightmare to memory manage and I had to do some suuuuper basic multiplication for the memory so that I could parallelize the pipeline. I was the sole engineer for this entire rendering application and the rest of the team assisted on the CSS and styling and content edits for each and every "book". At the end of the day, I calculated that I saved roughly 82,000 hours of work because that was the current pace of how fast they could make a single chapter in a book multiplied by all the chapters and lessons for all the different states because Florida is fucked and didn't want to include certain lines about evolution, etc and so a single book for a single grade but for N many states that all have different "editions". 82,000 hours of work is 3,416.6667 days of monotonous, grueling, manual, repetitive design labor. Shit was nasty but it was so fucking awesome. Shoutout to John Chen <zhanliang@google.com> for upstreaming the proper fix.
- mrngm 3y agoSome 10+ years ago on a small LAN party, we hooked up a tower PC to a projector to show some stats, last few lines of an IRC channel, those kind of things. For some reason, we directly started the application in X (the display system), but at regular intervals, the projector would stop working. Of course! Screen blanking. Having no window manager or other means* of controlling this, the projector would of course keep on displaying our lovely application if we would move the mouse once in a while, or type on the keyboard. Instead of tasking someone to move the mouse once in a while, we taped a wired, optical mouse to the tower PC at the front. At the time, CD/DVD players were still abundant, so this PC also contained one. We did know about the eject(1) tool, as well as its option to close the tray again (eject -t). From that moment on, the solution for our screen blanking problem was fixed: while true; do eject /dev/cdrom; sleep 5; eject -t /dev/cdrom; sleep 30; done; (this would eject the CD/DVD drive, wait five seconds, then close it again, and wait 30 seconds before starting the same sequence again) This would cause the optical mouse to detect movement, send this to the PC, and in the end keep the projector on. * we would later discover the xset(1) tool and its DPMS/screen saver settings. But that would've eliminated the periodic, comedic noise of the CD/DVD drive and the wired mouse bumping on the tower PC, so we kept the while loop intact during the rest of the LAN party.
- krallja 3y agoOur ElasticSearch cluster was running out of RAM. We were doing everything in 32-bit mode, for performance (we couldn’t do Compressed OOPs for some reason) so each node could handle, effectively, 4GiB of data. And we didn’t have the budget for a new machine. But I did notice that the most-recently-added node had 16GiB of physical RAM, for some reason. So I added a hypervisor and spawned two more VMs inside of it, each running ElasticSearch as well, thus increasing our cluster capacity by more than one year of growth!
- brirec 3y agoThis one is something I’m way too proud of, because it’s about as cursed as these hacks can get! I used to work full time as one of a two-person IT department at a consulting company that worked with construction. The owner of the company wrote backend business logic code nearly 30 years ago, in dBASE 5 for DOS, and switching to anything else was a non-starter. This code base was his baby, and he made it clear he’d sooner close up shop than rewrite it, despite the many reasons why it would have been a better idea than what followed. When I started with the company, they were using computers running Windows XP, which shipped a 16-bit/DOS emulation layer called NTVDM, which was used to run this terrible dBASE software. This was after Windows 7 was released, and we knew that using NTVDM on our office desktops wasn’t going to cut it for much longer — only 32-bit Windows supported NTVDM, and most newer hardware was only getting drivers for the 64-bit variant of Windows. Of course we tried DOSBox first, and it almost worked perfectly, but we were bottlenecked by a very slow network write speed even on a fast Core i7 at the time. This wasn’t going to cut it, either. At the time I had been first seriously getting into virtualization, had gotten pretty good at PowerShell, and was intimately familiar with Windows’s RemoteApp functionality from a prior project. This was software that would serve any running Windows GUI application to a remote thin client. And when I tried it, an NTVDM-powered COMMAND.COM window worked just fine as a RemoteApp! Things were getting interesting. I ended up using and using PowerShell + DOS Batch files to glue together a handful of tools to ultimately build extremely stripped down and locked down 32-bit Windows Embedded VM images, with just enough components to run these DOS applications and serve them over RemoteApp sessions. I basically built a fucking CI/CD system for remotely running DOS applications on thin clients. The best part? Now this stupid DOS software that we couldn’t get rid of was even usable on Linux, Macs, and mobile devices. Despite it being an awful idea, we really gave that horrifying piece of software a new lease on life! I no longer work there full time, but I still consult to them occasionally, and to this day they use this setup, and it still works super well! It’s horribly insecure (though I think we managed to segregate that Windows VM and its access very well), and probably violates numerous EULAs, but it was just about the only way to keep that specific application in service… (By the way, I’m looking for full time work at the moment if anyone needs a devops/automation engineer that can wrangle cursed environments… My email is hn(at)ibeep(dot)com.)
- welzel 3y agoBack in the day we where running a very nice Lotus Domino Server for a small organisation. We needed a machine to handle a complex domain setup + routing, and i donated as a temporary measure my old workstation, as i didn´t want to mess with the actual server. 3-4 years later the "temporary measure" was still in place, but the machine didn´t boot up after a power outage. Long story short, the disk drive was frozen, as it was a small consumer HDD (2 GB?) and didn´t like to be operational for such a long time. A very very oldschool sys admin helped out by opened up the poor machine, opened the HDD and then powered up the machine, given the disk a good spin at the right moment. The disk came back to life and so did the server, and we agreed to replace the machine with a new, proper server ASAP. As i left the organisation 2 years later the machine was still operational, the disk still spinning (ZERO defects!) and the disk was still open inside the case - running non-stop-no-problemo for 2+ years! I also miss Lotus Notes - it was an amazing concept in many regards that got murdered by IBM. And in case you ask: the machine was running Windows NT 4 Server.
- justsid 3y agoWe are shipping an OpenGL driver with our Vulkan game. For legacy reasons, our plugin SDK requires an OpenGL contex that plugins can use for drawing. Sins of the pasts and what not. But the game itself has moved on and is now using Vulkan on Windows and Linux. At first we took advantage of the Vulkan/GL interop mechanisms exposed by the IHV drivers, which works by exporting memory from Vulkan and then importing it into GL. Unfortunately the interop path is pretty brittle, the IHVs don't care too much about it since it's rarely used and on AMD we have had huge issues with GPU barriers executing incorrectly, thrashing the result in the process and also just generally really bad performance. So we took Zink, the Mesa OpenGL driver that emits Vulkan and slightly massaged it for our needs. I ended up having to implement a few missing GL extensions and also changing the Zink code a little bit so it would use our Vulkan device and instance instead of making its own. As far as plugins are concerned, there is still a real libGL.so/opengl32.dll just like there always was. But internally it's now emitting Vulkan calls against the device we use for our game. Solved both perf and interop issues and it's been one of my prouder achievements.
- pseudosavant 3y agoI had the wire for my doorbell go bad somehow. I couldn't figure out where the break was. It didn't seem to be near the ends of either of the wire, and it was run through the wall in a part of my house that made replacing it extremely difficult. I could have just put up a cheap wireless doorbell but we had a very nice decorative doorbell button my spouse had bought and she really wanted to keep it. Eventually I realized there were wireless doorbells that had a button whose circuit board was small enough to go into the hole in the wall for the doorbell button. I found one like that on Amazon, took off the wireless button casing, put the board inside the doorbell hole in the wall, and wired the fancy button onto the board. It works perfect. Eventually I'll have to replace the batteries, but it is easy to access just removing the button. I'm on the first set of batteries 5+ years in now.
- pseudosavant 3y agoThis is the weirdest fix I've ever done. I had a Surface Pro 3 that was working fine and then suddenly died and would not power on. I couldn't figure out anything to fix it. Eventually I read a random post on Reddit[0] how a guy tried putting it his SP3 in the freezer (in a sealed freezer bag) and it eventually came back to life. I skeptically tried it. I thought freezing was more likely to destroy something else on it, but what did I have to lose? It was already dead. I put it in a sealed freezer bag with as much air removed as possible, and then put it in the freezer for a couple of hours. I took it out, plugged power in, and I was able to turn it on! The first time I did it, it only worked for a few days. I tried freezing it again, and that worked. It still works to this day, many years later. My theory is that it seemed like a power problem, and that freezing the battery put the chemistry through some kind of cycle that repaired it. I did keep the Surface wrapped in layers of towel to warm it back up slowly. Mostly to help prevent any moisture from building up somewhere before it got to temperature. [0] https://www.reddit.com/r/Surface/comments/5tficj/how_i_revived_my_dead_surface_pro_3_has_been/ https://www.reddit.com/r/Surface/comments/5tficj/how_i_reviv...
- ncruces 3y agoI created https://rethinkraw.com https://rethinkraw.com that hijacks Adobe DNG Converter to provide a very limited Camera RAW that can even run on Linux. Why? Because why not.
- mikewarot 3y agoMy boss in a gear factory had some code from about 1982 that ran in "Tk!Solver" 1.0 under MS-DOS. He had moved it as far forward as he could, in DOS boxes, until Windows 10 got rid of 16 bit mode. The new version of Tk!Solver was something like $6000, totally unacceptable. I ended up running the program in MS-DOS, inside VirtualBox. I used MS-DOS to route the "printer" to COM1. Then on the outside, I routed the serial output to a file on the host machine. He just clicked the shortcut that fired it all off, did the calculations he needed to do, and "printed it", then exited Tk!Solver. The batch file then checked for output, and if it was there, it printed it. He was happy, and it only took about an hour to get it all working.
- slartibardfast0 3y agomy life
- mnahkies 3y agoAdded IE support to a web application that relied on web SQL by pollyfilling sqlite using asm.js. It was pretty slow, but it gave us enough breathing room to eventually replace web SQL with a local storage based implementation. That was also slow, but was able to speed it up by using compound keys and binary search to do range queries of "tables" based on key prefixes (the bulk of the data was time series/event like) Wasn't able to use indexeddb at the time due to compatibility issues as far as I recall.
- Waterluvian 3y agoLAN Party. Had an LG wireless keyboard that came with the monitor. AA batteries leaked acid inside and it stopped working correctly. Random keys would press. Opened it up, pulled apart the two sheets that had what looked like an oversized circuit board. Wiped the battery leavings off, then drew the circuits back on with a pencil. Then thought to use sandpaper to sever the Windows key so I’d never again minimize during Counter Strike. Keyboard worked for years after that.
- _bbih 3y agoIt's not the best story - I'm sure there are some greats here - but I tricked GitLab into running scripts that looked like https://gitlab.com/jyavorska/c64exec/-/blob/master/.gitlab-ci.yml https://gitlab.com/jyavorska/c64exec/-/blob/master/.gitlab-c... by modifying a runner to pass everything through the VICE Commodore BASIC emulator. It would even attach the output file as an artifact to the build.
- bluelightning2k 3y agoThere was a very early MMO game which leaked its server files & people started doing custom servers. There was a VERY limited scripting language for the server. This had some commands but missed basics like variables. However you could track the number of NPCs in a room. So this led to some rather interesting new primitives: - "Chickens in a room" became my preferred method of counting / implementing any kind of persistent global state. - For timers I would spawn an enemy and a guard. When the guard killed the enemy the timer was up. (The number of NPCs dropped back to 1). Combined these concepts to implement "dungeon instances": copied the map (as in literally copied the file) 10 times, used chickens-in-a-room to track which one players would enter, and whether you were entering the current instance or incrementing to the next was determined by the guard-kills-mob timer.
- qup 3y agoI have some less-interesting stories of cramming functionality into places it was not intended. Like Salesforce's backend. And the Spree shopping cart library. Makes me feel like macguyver. You kinda look around, see what you're working with, and figure it out.
- slowbdotro 3y agoSshfs so I can upload images onto my server to send links. :|
- Kinrany 3y agoI used SQLite for coordination between processes. It was a huge Python application that originally used the multiprocessing library and had to be migrated to Rust. In hindsight, it would have been better to use a local HTTP server. Seemed like overkill at the time.
- sokoloff 3y agoI had an old boiler that would sometimes trip and lock out the heat until someone went down and power cycled it. (It was its own monstrous hack of a gas burner fitted to a 1950s oil boiler and I think a flame proving sensor was bad.) Every time it happened, it made for a long heat up cycle to warm the water and rads and eventually the house. So I built an Arduino controlled NC relay that removed power for 1 minute out of every 120. That was often enough to eliminate the effect of the fault, but not so often that I had concerns about filling too much gas if the boiler ever failed to ignite. 12 failed ignitions per day wouldn’t give a build up to be worried about. That ~20 lines of code kept it working for several years until the boiler was replaced.
- progbits 3y agoI have a similar one. Our boiler has a pump to cycle hot water around the house - this makes it so you get warm water right away when you turn on a faucet and also prevents pipes in exterior walls from freezing in the winter. This stopped working, the pump is fine but the boiler was no longer triggering it. I just wired up mains through an esp32 relay board to the pump and configured a regular timer via esphome. Temperature based logic would be even better but I didn't find a good way to measure pipe temperature yet.
- myself248 3y agoI'm thiiiiiiis close to installing a circulating pump. I plan to power it off the bathroom lightswitch, which I might just replace with a motion sensor.
- sokoloff 3y agoI eventually switched to an ESP32 and added temperature graphing: https://imgur.com/a/VM7nD74 https://imgur.com/a/VM7nD74 IIRC, I used an RTD that I had left over from a 3D printer upgrade, but an 18B20 would fine as well. A 10K NTC resistor might even be good enough. For what I needed (and I think for what you need), just fixing the sensor to the outside of the pipe [if metal] will give you a usable signal. That sensor was just metal HVAC taped to the front cast iron door of the burner chamber. But a dead-simple timer solution gets you pretty far as you know.
- diarrhea 3y ago`envsubst` on a k8s manifest, for templating. The space for templating/dynamic k8s manifests is complex, needlessly so I felt. But this... just works. It has been running in CI for a couple months now, deploying to prod. I'm sure the day that breaks down will come, but it's not here yet.
- salamander014 3y agoAre you me? I’ve been working on the same thing for a few months now. Not only is it more customizable / less complicated than helm / other solutions, but GNU gettext is almost 30?! years old at this point, and environment variables are probably realistically double that age. They aint going anywhere anytime soon. Plus I feel that more complex logic removes value from the configs we are building, and so am not interested in many other tools.
- CharlieDigital 3y agoI worked at a startup where the core backend was 1 giant serverless Function. For error handling and recovery, the Function ran in a while loop. For all its faults, it worked and it was generating revenue. Enough that the startup got to a sizable Series A. That experience completely changed how I think about writing code at startups.
- cr3ative 3y ago"on error resume next" never died, it just became serverless!
- pmontra 3y agoA customer of mine wraps their Python code into try except pass so it never stops because of errors, it just skips what would have run in the code after the exception. I added some logging so we're slowly understanding what fails and why.
- krallja 3y agoOf course, there’s a package for that https://github.com/ajalt/fuckitpy/blob/master/README.md https://github.com/ajalt/fuckitpy/blob/master/README.md
- naikrovek 3y agothis is great. if you look at older game source code you find things like this. things that we view as horrible hacks which are both extremely stable and perform well. i see no reason to stop using these types of solutions, when appropriate.
- muzani 3y agoOld games also didn't use a database, they saved everything in a giant text file. I'm not sure if they were "extremely stable" though. Like Myspace, it might only work up until a certain point. What kills stuff is usually going viral.
- leonheld 3y ago`sed` text files as a replacement for templating. In the text file you have something you want to template (or "parametrize") from an outside variable, so you name that something like @@VAR@@ and then you can sed that @@VAR@@ :-)
- teddyh 3y agoI think the m4 macro processor might be the more canonical way to do it. Unless you’re writing a shell script, in which case a “here-document” with embedded $VARIABLES is more straightforward.
- _bbih 3y agoWait, you're telling me this isn't a Best Practice™?
- zblesk 3y agoIt totally is.
- Semaphor 3y agoThat's how we do it. Not with sed exactly, but string replacement. One is a bull email sender that only supports VBScript, the other is C#, but the users aren't supposed (or need) to have full templating powers, so this way it's easier.
- deleted 3y ago[deleted]
- blowski 3y agoGenerated HTML email newsletters from Excel (in 2004). It was a big old-fashioned bookseller trying to compete with Amazon. Software and the web was locked down tight, but they opened a daily report in Excel, and I built a VBA macro that generated the necessary HTML and published the images to an FTP server. Turned a 2 day job into a 10 minute one.
- simonbarker87 3y agoI had a GCP Cloud Run function that rendered videos. It was fine for one video per request but after that it slowed to a crawl and needed to shut down to clear out whatever was wrong. I assume a memory leak in MoviePy? Spent a couple of days looking at multiple options and trying different things, in the end I just duplicated the service so I had three of them and rotated which one we sent video renders to and do each render one at a time. It was by far the cheapest solution, means we processed them in parallel rather than serially so it was faster, all in all it worked a treat.
- seer 3y agoHah welcome to cloudrun! I was evaluating it a few years ago to host some internal corporate app. It worked great and was way easier to deploy than k8s setups. However after some testing we found out that the core logic of the app - a long running process, would just crawl to a halt after some time. It turned out google wanted to push you to use their (paid) queue / pubsub solutions, but they didn’t want it to be _too_ obvious, so cloudrun would actually throttle its cpu sometime after the request it was spawned was returned. Our logic was based on pushing stuff in a queue and having it be processed outside of a request, but google just f*ked with that solution. And it would have been fine if that was upfront info, but it was buried in a doc page somewhere obscure, small print… Thats the time I realized how bad gcp can be…
- simonbarker87 3y agoAh, that would make sense! It was always the second video being processed at about the same amount of time through it. Thanks
- arccy 3y agothat was the whole point of cloud run, which was obvious when you looked at the pricing for it: If an instance is not processing requests, the CPU is not allocated and you're not charged.
- cr3ative 3y agoThis reminds me of a service I recently found that was routinely crashing out and being restarted automatically. I fixed the crash, but it turns out it had ALWAYS been crashing on a reliable schedule - and keeping the service alive longer created a plethora of other issues, memory leaks being just one of them. That was a structural crash and I should not have addressed it.
- cr3ative 3y agoI was part of a team which had to make web interactives for an old desktop-only Java-based CMS which published out to HTML. This was back before cross-publishing to formats like Apple News was important; we only had to worry about things working on the browser version. The CMS didn't support any kind of HTML/JS embed, and had quite a short character limit per "Text" block. But luckily, that block didn't filter out _all_ inline HTML - only some characters. So, a bootstrap "Loading" element was inserted, along with a script tag which would bring in the rest of the resources and insert those in to the page where the bootstrap was placed. This quickly became a versatile, re-usable loader, and allowed us to launch the features. But all this grew from a very inelegant hack which just happened to work.
- baz00 3y agoI made my own version of AWS workspaces inside AWS because workspaces is a buggy piece of shit and the client sucks. It's just an EC2 instance which can be started and stopped by a makefile that runs awscli and I query the IP address and open it in MS RDP!
- justin_oaks 3y agoAt my company we used AWS workspaces for training classes. Whenever we'd have a class, we'd create 1 or 2 spare workspaces. If someone couldn't connect to their workspace, we'd give them the connection information for one of the spares. I was so happy when we reworked our classes to no longer use AWS workspaces.
- zwnow 3y agoI use a table object and a OnAfterModifyRecord trigger to process OData calls in Navision 2018 (ERP System). For some reason I can not call actions manually so I write whatever I want to do into a table and process accordingly with triggers.
- YaBa 3y agoA bunch of SQL triggers and procedures to overcome software limitations and workaround certain bugs which the developers won't fix (3rd party app).
- quickthrower2 3y agoReminds me when we started implementing features as an Oracle trigger. It was meant to be “just a trigger” but then there are so many edge cases when you do an end—run around application code that it took a couple of week total. Boss was like “couple of weeks for a trigger!”
- smallpipe 3y agoMonkey patching vendor code. They agreed their code didn’t work and produced wrong results, but the correct version would be slower, so they didn’t want to change it. So I dynamically replaced the part of their code that was wrong. That monkey patch has run years and is still going :)
- MBCook 3y agoYou just reminded me of an old story. The company I was working for purchased some kind of email spamming program to send mass emails. However they quickly found that when more than a small number (10 to 15,000?) of addresses were in the list it took forever. Support wasn’t being helpful, so I decided to look at it. It was some kind of PHP application and what I eventually found was it was doing a database query doing table scans for everything because there was a missing index that was incredibly obvious. I added the index, the program worked well into huge numbers of emails addresses, and we informed the vendor. The program was soon updated and it fixed the problem as well. Also all the PHP code was now obfuscated/encrypted. I guess they didn’t like my helpful nature.
- dormento 3y agoNo good deed goes unpunished
- mcv 3y agoWho cares if it's wrong, as long as it's fast?
- btzs 3y agoAs 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.
- gia_ferrari 3y agoOnce my phone died from a cracked solder joint. I had cold veggie sausages in the hotel room fridge. Holding my phone against the sausages let me grab a couple more files off of it. Saved my OTP keys that way (I've fixed my backups now :) )
- tomduncalf 3y agoHahah this is amazing!
- zeroCalories 3y agoWhen 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.
- bombcar 3y agoA 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.
- BillyTheMage 3y agoI 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.
- bryanlarsen 3y agoI 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.
- paulgb 3y agoI used a WiFi smart switch and a USB thermometer to make a sous vide cooker. I plugged a slow cooker into the smart socket, put the thermometer in it, and wrote a program to turn the switch on/off depending on the temperature the thermometer registered.
- myself248 3y agoA friend of mine brute-forced the access key on a particular piece of industrial hardware by using an X10 outlet relay module, predecessor to today's wifi-connected smart sockets. The key was only 4 digits long and it would lock out after 3 attempts and require a reboot, so he was looking at a few thousand reboots each taking a minute or so. Easy enough to run over a weekend. It ended up wearing out one relay, but he had a spare and just swapped it in and restarted the script from where it hung up. For the cost of like $30 and a few days, it gave us a new unobtanium unlocked unit.
- falcor84 3y agoIn a previous role, I automated an unholy amount of business processes by adding doGet() / doPost() handlers to expose google sheets as basic web services. It's a bit slow for large sheets, but was quite nice to work with and troubleshoot, and the built-in history in google sheets allowed me to experiment with little risk of data loss/corruption.
- davedx 3y agoInvestment banking analysts: “this is a hack??”
- spacecadet 3y agoDefine works? Ive seen stupid and not working but convinced it's working until proven otherwise... I use to work part time restoring Fiat, Porsche, and VW rares for an old head out in the mid west, lots of "stupid but works" in those old cars... Mercedes Benz once (1980s or so) employed glass containers to solve for fuel pressure problems. Insane coolant loop designs or early Fuel Injection systems that develop "Ghosts" lol...
- rudasn 3y agoLaunching a headless browser just to generate some PDFs. Turns out, if you want to turn html+css into pdfs quickly, doing via a browser engine is a "works really well" story.
- doix 3y agoI did the same. We had a tool that would let you export to pdf. That pdf would be sent to our customers. Initially we just used the print functionality in the users browser, but that caused output to vary based on the browser/os used. People complained that the PDFs generated were slightly different. So instead I had the client send over the entire html in a post request and open it up in a headless chrome with --print-to-pdf and then sent it back to the client.
- im3w1l 3y agoI mean browsers are built for and the best at displaying html+css. Given that they are "living standards", very few other programs can hope to keep up.
- polishdude20 3y agoWe did that at the previous place I worked!
- i386 3y agoThis is how we exported designs at Canva. It works!
- unnouinceput 3y agoI had Chromium component added to a project just to show the users the help file which was a giant PDF document. The PDF file was from a 3rd part vendor who didn't know better/refused to change the system so we had to show it "as is" to the users. Any PDF reader component we tried failed because the PDF file had some crappy features in it that none of those component knew how to parse. Chromium engine, for its hate that gets nowadays, had no problem with any of those PDF files.
- phanimahesh 3y agoThis also happens to be the easiest path. There are other options but no good ones
- hanselot 3y agoWouldn't you like to know Microsoft powerbi team... But for real I'd get fired if I said...
- mcv 3y agoA company I worked for had a website where you could order mobile phones and subscriptions from different providers. This was just a frontend, and behind the scenes, they just ordered them directly from those providers. But those providers had terrible sites still written for IE6 (this was in 2010 I think). And yet those sites where all they had (for some reason; I don't know the full background). So what happened is: the customer would order their phone subscription on the front end, that would create a job file that would be sent to a scheduler that managed 10 Windows VMs that used a Ruby Watir script to direct IE6 to fill in the data from the job file on the old decrepit website. It's the most horrific hack that I ever touched (I forgot exactly, but I had to make some adjustments to the system), but it worked perfectly for a couple of years until those providers finally updated their websites.
- calvinmorrison 3y agoGetting a ddos attack and just running a few iptables by hand mostly fixed it until upstream blocked it for us
- kotaKat 3y agoMy CPAP's onboard humidifier failed. I ended up swapping it out to a generic in-line CPAP humidifier, but at the same time, realized I could partially automate the process of refilling the chamber (and not have to keep unhooking hoses) by adding an in-line oxygen tee, some aquarium plumbing, a check valve, and a 12 volt pump and switch. In the morning I just hold a button and the tank magically refills itself ;) Introducing Semi-Autofill(tm): https://i.ibb.co/NmDbVvw/autofill.png https://i.ibb.co/NmDbVvw/autofill.png (Also: The Dreamstation, while recalled, was personally de-foamed and repaired myself -- I don't trust Philips any further than I can throw them now. I now self-service my gear.)
- LorenDB 3y agoI've been using sshuttle to create a VPN to my server. It's a wonderful abuse of ssh.
- fallinghawks 3y agoMy mom's place (about 100 miles from me) has a water heater that's of an age where it could fail, so I put together a Pico W and a water sensor. I had it notify me daily just to make sure it was still working. And for reasons unknown, every 8 days it would stop notifying. A reboot would resolve it. We tried logging errors and having it report upon reboot but I wasn't versed enough with Pi to figure out anything more than it being an HTTP POST error. So I changed the code so when it got to that error instead of logging it would just reboot itself, and all has been smooth since.
- NickM 3y agoWhen I was a teenager I had a friend who wanted to build a PC on a very limited budget, and she wanted it to be able to play The Sims 2. Well after much bargain hunting and throwing ideas around, we couldn’t find a way to afford every component we needed, but we were close, so we decided to forgo a case! Just put the motherboard on the desk with other components arrayed around it. Cables everywhere. The tricky part is we had no power button, but I showed her which pins to sort out with a paper clip, and it worked great.
- Scoundreller 3y agoRuns much cooler that way for the most part.
- jawns 3y agoI worked for a US media company that forced us to use a half-baked CMS from a Norwegian software company, with no apparent provisions in the contract for updates or support. The CMS was absolutely terrible to work in. Just one small example: It forced every paragraph into a new textarea, so if you were editing a longer news story with 30 or 40 paragraphs, you had to work with 30 or 40 separate textareas. So I basically built a shadow CMS on top of the crappy CMS, via a browser extension. It was slick, it increased productivity, it decreased frustration among the editors, and it solved a real business problem. If we had had a security team, I'm sure they would have shut it down quickly. But the company didn't want to pay for that, either!
- matsemann 3y agoEnonic? As a contractor in Norway I saw that multiple places before headless etc became popular. One hack I remember that fit this thread, is someone using Enonic as a headless cms long before headless cms was a thing. Basically every string in their frontend apps had a key, and that key was a hierarchy of articles in Enonic. So a whole "enonic article" for every single piece of text, like, every button, heading, menu element was backed by its own article. That meant that the editors could edit any piece of text in the SPA from Enonic. An article in /cms/myapp/something/myelement we then would export to the key myapp.something.myelement, and we did that for all ten thousands of small text string articles, and then built that into the SPA with a sync job running regularly. We also had a way to turn off templating in the SPA. Appending ?showKeys or something to the url would print the keys instead of the content, helping the editors know which article to edit for that element on the page.
- porker 3y agoezPublish?
- _lvbh 3y agoThis was a while ago so it probably wouldn’t work today. I had to get past a captcha for automation and the solution I came up with was to always choose 2. If it was incorrect, just request a new captcha until it passed. For some reason, 2 was the answer most of the time so it actually rarely had to retry anyways
- teddyh 3y ago> For some reason, 2 was the answer most of the time I’m getting flashbacks to LensLok™; the two-letter codes were often very hard to read though the plastic lens, and when you’d get the code wrong enough times, you’d have to load in the entire program again (from tape!), which took ages. There was also a “training” mode, of sorts, to help people familiarize themselves with reading the codes. In the training mode, the code letters were always “OK”. But here’s the kicker: For some unfathomable reason, the real code was very often (but not always) also the letters “OK”! So it was easier (at least on your eyes) to just always enter the letters “OK”, and hope it worked. What time you lost reloading for when it didn’t work you’d save by not having to adjust the scale to the size of your TV every single time.
- exikyut 3y agoOof, wow. That's a fun little rabbithole :x I found one video demonstration: https://youtu.be/Wpn9sLNg-6k?t=310 https://youtu.be/Wpn9sLNg-6k?t=310
- Snacklive 3y agoDefinitely wouldn't work today. Nowadays you need to classify like 30 images of bicycles and 20 fire hydrants and pray to god before they accept your answer...
- _lvbh 3y agoThis is why I don’t have an account with Snapchat/Instagram/etc. I tried signing up and physically couldn’t get past the challenges. I take too long to solve them and then I’m asked to solve more…
- wruza 3y agoI had to connect an old accounting system to a web app with enhanced ui (an operator determines a payment on a visual graph of contracts between companies, plus graphs editor). There were two ways: a separate db with periodic sync, and a direct COM-connection to the old app, which was scriptable through js<=>COM library. I chose the latter, tests worked fine. After a month or so I started to notice that something is wrong with performance. Figured out that every `object.field` access through a COM proxy takes exactly 1ms. Once there’s enough data, these dots add up to tens of seconds. >_< Instead of doing a rewrite I just pushed as much of js logic as possible beyond the COM, so there’s only a constant or little amount of `a.b.c` accesses on my side. Had to write a json encoder and object serialization inside the old app to collect and pass all the data in one go. The web app was abandoned few months later for unrelated reasons.
- pmontra 3y agoMid 90s, can't remember the tech (VB, C, Java?) In the very last hours before an important demo one of the programs stopped working. Not always, only every second time we run it. No version control, no unit tests. It's obviously some side effect but debugging it before the demo and making changes could make it worse. Maybe it won't even run anymore, anytime. We decide to wrap it into a script that starts it, kills it, runs it again. That worked and made us pass the demo.
- ben0x539 3y agoI wrote it up in a bit more detail[1], so I'm giving away the punch line here, but I used to use some cursed bash wrappers to smuggle my bashrc and vimrc along on ssh sessions to mostly-ephemeral hosts by stashing them in environment variables matching the LC_* pattern allowed by default for pass-through in debian-ish sshd configs. [1]: https://gitlab.com/-/snippets/2149340 https://gitlab.com/-/snippets/2149340
- hennell 3y agoNeeded to get data out of a CRM system for specific printed orders - when it was printed, who processed it, what was on the order etc. The process of authenticating with the CRM was complex and there wasn't a way to get anything at print time and most of the data was stored all over the place. But I found the printed report knew almost everything I wanted, and you could add web images to the paperwork system. So I added a tiny image with variable names like "{order_number}.jpg?ref={XXX}&per={YYY}" and then one for each looped product like {order_number}/{sku}.jpg?count={X}&text=..." etc. After a few stupid issues (like no support for https, and numbers sometimes being european format) it was working and has remained solid ever since. Live time stamped data, updates if people print twice, gives us everything we wanted just by a very silly method.
- azalemeth 3y agoAs a European I'd like to know how our numbers are differently formatted to yours! (Did you mean dates? The never ending source of pain!)
- gia_ferrari 3y agoTo me (USA) 1,000 is one thousand and 1.000 is one, and to me (Italian) 1,000 is one and 1.000 is one thousand :)
- azalemeth 3y agoAhh, that one. Do'h!
- SkyPuncher 3y agoAdding a Content Security Policy of “upgrade-insecure-requests”. It does nothing meaningful for your security, but it’s enough to satisfy a bunch of these scanning tools that giving you a letter grade. Yes, we want to add a robust CSP, but we currently have some limitations/requirements that make implementation more challenging.
- bonton89 3y agoI used to be really into modding the game Jedi Knight: Dark Forces II. The quirky engine has all sorts of weird bugs and limitations. I created a flare gun weapon (similar to the stick rail gun missiles so nothing to crazy here) but found that if a player died when they respawned the flares were still stuck on them and damaging them when they respawned even though their whole location had changed. This bug would exist with rail gun missiles as well but since the death animation was long and the fuse so sort it would never present in the base game. I experimented with using detach commands that ran on player death but they'd just instantly reattach to the player model because of their proximity. I ended up creating an invisible explosive entity that fired on player death from the center of the player which did a damage flag ignored by players but which destroyed the flares.
- omgbear 3y agoI built a vacation plant waterer with some tubing, 3d-printed heads, submersible pumps and an Arduino. For a longer trip, I needed a source of water that I could pump from. I realized the toilet tank is self-refilling because of the float valve and won't overflow . So clean it out and a good place to pump my submersible pumps.
- myself248 3y agoOh this is genius. That might just be my new humidifier hack.
- moozilla 3y agoFYI you shouldn't use anything other than DI water in humidifiers. Using tap water can cause bacterial/fungal buildup and emits harmful particulates into the air. https://dynomight.net/humidifiers/ https://dynomight.net/humidifiers/
- stormking 3y agoThe risk of bacterial infection is overblown. But you still don't want to use tap water for a humidifier because you'll get limescale all around the device.
- positr0n 3y agoThe link you’re replying to basically postulates that with tap water you are inhaling PM2.5 particles from the same chemicals that cause limescale, and as far as we know PM2.5 particles are harmful to your health in any quantity.
- neilcar 3y agoWhen I was a network support engineer, we had a case where a company had a bizarre & intermittent problem on workstations. Wish I could remember what the problem was but this is 20+ years ago now. To troubleshoot it, we installed Microsoft Network Monitor 2.0 (this was well before Wireshark...) on a few workstations. NM2 installed a packet capture driver and a GUID front-end. And...the problem went away. Our best guess was that the problem was some sort of race condition and installing the packet capture driver was enough to change the timing and make the problem go away. The customer didn't want to spend more time on it so they installed NM2 everywhere and closed the case. I occasionally imagine somebody trying to figure out why they're still installing the NM2 driver everywhere.
- karmakaze 3y agoWay back I had a friend that wanted his (maybe) "Sargon" chess program to run faster. Luckily it was on the Atari 8-bit and I knew a thing or two. The program seemed to use standard b/w hires graphics nothing super fancy, so I thought I could make a pre-boot loader. The theory was that the Atari spends a good chunk (30%) of its time for display memory access. That can be disabled (making a black screen) and re-enabled. My pre-boot program installed a vertical blank interrupt handler reading the 2nd joystick port: up/down for display on/off. After installing the handler, the program waited for diskette swap and pretended to be the original program loader reading the disk layout into memory and jumping to the start. Worked like a charm first go.
- webmaven 3y agoOne of the first things I built as a developer at the first startup I worked for (circa 1998 or 1999, I was originally hired as a graphic and web designer) was a system I wrote in Allaire ColdFusion that used Macromedia Flash Generator to render and save custom graphic page headers and navigation buttons for e-commerce websites by combining data stored in an Access database with Flash templates for look and feel.
- karmakaze 3y agoMy favorite one is probably when I was working at a retail Forex where consumers would try to make money on currencies. There were a lot of support calls where they disputed the price they saw and the price their order was entered. My solution was to log the price when they click the trade button. The interesting bit wasn't that I logged the currency pair and price, instead I did a tree walk of all the Java Swing GUI elements in the open trade window and render them into the log file as ASCII using "(o)" for options, "[x]" for checkboxes, "[text_____]" for text fields, etc. I wasn't sure if it would work as the elements were rounded to the closest line, and sometimes just inserted a line between two others if it was close to half a line in-between etc. The ASCII 'screenshots' came out beautifully. From then on when a call came it, we told them to use the view log menu item, scroll to the trade time, then they'd shut up quick. A picture is worth a 1000 words indeed.
- JohnBooty 3y agoTL;DR: Had no database so I made a PHP page with a hardcoded array of 100,000 coupon codes. --- Made a PHP landing page for a customer where they could redeem a coupon code they were sent via snail mail. About 100,000 codes were sent out via USPS. Threw together the basic code you might expect, simple PHP page + MySQL database. Worked locally because customer was dragging their feet with getting me login creds to their webhost. Finally, with the cards in the mail, they get me the login creds at 5PMish. I login and there's no database. Cards are going to be arriving in homes as early as 8AM the next day. How TF am I going to make this work... without a database? Solution... I just hardcoded all 100,000 codes into a giant MySQL array. Or maybe it was a hash/dict or something. I forget. Anyway, it performed FINE. The first time you used the page it took about 30 seconds to load. But after that, I guess `mod_php` cached it or something, and it was fine. Lookups returned in 100ms or so. Not spectacular but more than performant enough for what we needed. Got paid. Or, well, my employer did.
- wiseleo 3y agoMicrosoft SQL Server Express has limits on its database size. Windows Internal Database, which is the same thing as far as APIs are concerned, does not. Well, it does, but the limit is over 500GB. So, I made Sharepoint and other vendor apps run on it. In the same spirit, Microsoft shipped Business Contact Manager for Outlook on Office 2003 CD. That thing is functionally a CRM that was allegedly limited to 5 users. It, of course, runs on an SQL Server and so I made it run under Windows Internal Database, tested it with more than 5 users, and made it a lot more usable.
- DamnInteresting 3y agoAround 16 years ago, Wordpress security was just not up to snuff yet, and my popular Wordpress-based site kept getting hacked by pharmaceutical spammers and the like. After several such incidents, I wrote a "wrapper" that loaded before Wordpress to scrutinize incoming requests before a lick of Wordpress code was executed. It had blacklists, whitelists, automatic temporary IP blocking, and that sort of thing. There was no reason for visitors to upload files, so any non-admin POST request with a file upload was automatically smacked down. It wasn't pretty, but the hackers never got through again, and that clunky thing is still in service today. I coded it to quarantine all illicit file uploads, and as a consequence I have many thousands of script kiddies' PHP dashboards from over the years.
- azeemba 3y agoHaha you invented WAF! https://www.cloudflare.com/learning/ddos/glossary/web-application-firewall-waf/ https://www.cloudflare.com/learning/ddos/glossary/web-applic...
- earthboundkid 3y agoThat reminds me of my terrible spam prevention hack. We kept getting a bunch of spammers signing up for our newsletters, so I made the form require a JavaScript based hidden input to submit. That worked for a while, but then new spammers started executing the JS and getting through. So I added new JS that just waits 15 seconds before putting the right hidden values in the form, and that’s done the trick (for now).
- jpc0 3y agoSo CSRF?
- earthboundkid 3y agoPlain CSRF wouldn't help because they're scraping the site and executing the JS. It has to be time delayed CSRF so they give up and submit before it's loaded. The real solution is to use a CAPTCHA, but they're so user hostile, that's the last resort.
- GnarfGnarf 3y agoWe ran out of columns in our 80-column Hollerith card master file. So we divided the 12-row columns into three groups of four bits, giving us the “240-column” card, with triple storage. This was the 70’s, so our cards looked like lace doilies (0111).
- michael_j_x 3y agoI have centralized AC and the wall-mounted control panel is located in a small storage room. I wanted to hack the control panel with an Arduino and a Raspberry pi so I can control it remotely via my Alexa. I ended up buying a switch bot [0] and an IP camera and was done with it. 0: https://www.switch-bot.com/products/switchbot-bot https://www.switch-bot.com/products/switchbot-bot
- rented_mule 3y ago15+ years ago, I was working on indexing gigabytes of text on a mobile CPU (before smart phones caused massive investment in such CPUs). Word normalization logic (e.g., sky/skies/sky's -> sky) was very slow, so I used a cache, which sped it up immensely. Conceptually the cache looked like {"sky": "sky", "skies": "sky", "sky's": "sky", "cats": "cat", ...}. I needed cache eviction logic as there was only 1 MB of RAM available to the indexer, and most of that was used by the library that parsed the input format. The initial version of that logic cleared the entire cache when it hit a certain number of entries, just as a placeholder. When I got around to adding some LRU eviction logic, it became faster on our desktop simulator, but far slower on the embedded device (slower than with no word cache at all). I tried several different "smart" eviction strategies. All of them were faster on the desktop and slower on the device. The disconnect came down to CPU cache (not word cache) size / strategy differences between the desktop and mobile CPUs - that was fun to diagnose! We ended up shipping the "dumb" eviction logic because it was so much faster in practice. The eviction function was only two lines of code plus a large comment explaining all the above and saying something to the effect of "yes, this looks dumb, but test speed on the target device when making it smarter."
- fritzo 3y agoThose are my favorite functions! Two lines of code with a page of text explaining why it works.
- dharmab 3y agoSimilarly, a modder recently found that unrolling loops _hurt_ performance on the N64 because of RAM bus contention: https://www.youtube.com/watch?v=t_rzYnXEQlE https://www.youtube.com/watch?v=t_rzYnXEQlE
- pclmulqdq 3y agoUnrolled loops can also often hurt for the same reason on big server chips. It's not always clearly good to unroll your loops.
- o11c 3y ago... how does doing a full string dict lookup take less time than just checking a few trailing characters in a trie? For indexing it's okay to be aggressive since you can check again for the actual matches.
- bosky101 3y ago- gmail driven development. was small enough to start emailing myself when events happen, inadvertently mailing myself on (B2B) customer logins. But found it was a great time to also pick up the phone to catchup/guide. left this turned on as a feature! - got rid of the concept of passwords. 2FA only. - more of a productivity hack, but - spread sheets with columns that create sql statements, allowing ops to learn/run sql themselves - bookshelves as standing desks. usb keyboard on lower shelf. laptop at eye level. - raised an angel round with an android app with beautiful screenshots of the vision. but once installed the app only had a email waitlist implemented
- rickytheguy 3y agoSometime in my teen years, I had an insatiable desire to..download..all these expensive programs and play around with them. One day I got ahold of Acronis Disk Director and did some repartitioning of some flash drives I had. If I remember correctly, it had the ability to repartition the currently utilized system drive via some built-in boot environment. Well, I had to try it out. Now is a good time to mention that I was doing this on old Toshiba Satellite that would shutdown after overheating sometimes. As you can expect, the repartitioning failed at some point in the middle because the laptop shut off. What remained was an unbootable drive and a teenager that really didn't know what the problem was, let alone how to fix it. In my voyages of curiosity, I happened to have a gParted liveUSB laying around. I booted into it, took a look at the main drive on the laptop, and I noticed a few KB or MB of free space before the main partition. I thought this was weird for some reason and decided to use gParted to "shift" the whole partition to the left (the beginning of the drive). After some time it finished and booted up into my Windows install with zero issues. To this day, I am equally baffled and amazed that it worked.
- plz-remove-card 3y agoWe were developing software for an office in a timezone several hours different from our own. We flew there the weekend before the Monday launch, did several tests over the weekend and everything looked good. Monday morning, minutes before go live we do a couple more tests with staff and discover a critical timezone bug that if not fixed, we cannot go live. Even if our developers were able to quickly turn around a fix and skip formal QA, it still would be ~30mins before everything was updated and another 30 for us to do local tests on site... So we went around and changed the timezone on every computer in the office. The day was saved, devs fixed the bug during their day, our night and we fixed the timezones the following day.
- 0xADADA 3y agoI have a customer who refuses to migrate away from his Palm Pilot Desktop software Palm Desktop (Windows 7/8/10) last stable release was in 2008. No features have been added in 24 years. The Palm Pilot itself stopped working about 20 years ago. He runs the software in a Windows XP virtual machine. He runs his entire business off the contact list in the software. Customer has over 50,000 contacts, which the software supports a max of 8k. I got around this limit by using the "Profiles" feature in the software, which allows you to configure multiple users-Each user allowed max of 8k contacts. I created 10 profiles by dividing the English alphabet into 10 groups based on the frequency of last name first letter in his set of contacts: Contact Group 1: A, K, T Contact Group 2: B, L, U Contact Group 3: C, M, V Contact Group 4: D, N, W Contact Group 5: E, O, X Contact Group 6: F, P, Y Contact Group 7: G, Q, Z Contact Group 8: H, R Contact Group 9: I, S Contact Group 10: J Of course, when he needs to search or get data from his contacts, he needs to constantly switch profiles. I can only imagine how mundane that must be, but whatever floats your boat.