Live data from Hacker News

Ask HN: What's your proudest hack?

news.ycombinator.com

281–290 of 414 posts

Re: Ask HN: What's your proudest hack?

#281

When requesting pizza delivery from the Domino's site I captured and modified the http request to delete the `crust_type` field. Turns out most of the price was calculated from that so I was getting incredibly cheap pizzas for a while until they found out and invalidated requests without crust selection.

What crust did they ship it with?

Sounds a little like None Pizza with Left Beef, also on Domino's: https://youtu.be/5yWTPtPYukg

Re: Ask HN: What's your proudest hack?

#282

I once needed to install a very large piece of enterprise software in a locked-down enterprise environment. The client had contractually agreed that we would download the software rather than using physical media and for complicated reasons due to IP licensing we were not allowed to install via physical media. However the enterprise IT/infosec folks at the client didn’t like our project and refused to whitelist our u…

Oh I just thought of another one. I was working at a client and it was going pretty well until we did a demo to a pretty quantitively aware person and he asked whether our thing (a time-series analysis and reporting tool basically) did linear algebra. Well it didn’t, and he was pretty sarcastic about that.

So I went back to my hotel room, put on some coffee and spent most of the night writing a bunch of boilerplate code wiring in various methods in apache commons math. The next day I had another meeting with him to discuss something. I chose as an example a function we had quickly knocked up that did a bunch of matrix math. “I thought you said it didn’t do linear algebra?” He said. Felt pretty good to say “Yeah that was yesterday. I just added it”.

Re: Ask HN: What's your proudest hack?

#283
Back in 2003 while I was still studying I spent some time working at a bank helping write some boring web form using a java servlet. I was really junior, and the code was an absolute mess - every time they made a new web form they copy+pasted a 3000 line java class (with no unit tests) from the previous form and modified it. For source control we were using visual source safe - which is one of the worst programs I've ever used. Every few days the repository corrupted itself and needed to be rebuilt.

Well, I made a horrible mistake. Right after deploying (compiling then manually copying a .class file onto our server), I accidentally lost the source code to all my work. There was no backup of the changes I'd made, and source control didn't have it. All testing was manual - which was a horrible process we went through before every deployment. So if I half remembered my changes, I'd have to manually test everything again and hope I didn't mess anything up.

All I had left was the compiled java .class with my changes in it. I was terrified to even tell my boss given all the work.

Well, I tried decompiling the .class file with my changes in it - but the result was 10k lines of nightmare fuel. How could I find my changes in that? But I also had the java file from a few weeks earlier, before I made my changes. So I compiled the previous version, then decompiled it. Then I diffed the two decompiled source code files. That showed me (in decompiled java form) all the places where I'd made changes, and with some work I managed to figure out what all my changes were.

A few hours later I had re-implemented all my changes in the java source file. I could guarantee I'd done it correctly because the output from the decompiler matched perfectly. So we didn't even need to re-do all our manual testing.

I don't think I ever told my boss.

Re: Ask HN: What's your proudest hack?

#284
One that's fun from a historical point of view was my hack for fixing palette flash. Back in the early 90s PC graphics cards typically had a "palette" of 256 colors at one time, selected from a possible 256K colors.

In theory this gave you a lot of options, but in practice, switching palettes tended to cause "palette flash" where the previous image changed color in a distracting flash.

I was doing a multimedia project that had video in it, and each CODEC had its own built in palette -- one for Cinepak, one for Indeo, etc. Then there were other palettes for the images. If you wanted to display video in a window on a page that had other graphics, you could determine the palette of the CODEC (with some effort) and then use that to dither your graphics. Theoretically they should play nice together, and it worked on some cards, but you'd still get palette flash on other mainstream graphics cards.

I tried every trick I could think of but could not eliminate the flash on every single card until I came up with this hack:

Make a video consisting of a single frame with a 1x1 black pixel, compressed in the desired CODEC, display a black screen for a moment, play that video (which was as fast as could be because it was so tiny) over the screen, then load your image and real video.

The black screen couldn't flash, and when the next screen and video (the real one we wanted to play) came up, the palette was already set correctly. And it worked on every video card.

Re: Ask HN: What's your proudest hack?

#285
At one place I worked one of the perks was you could buy their products at ~cost, and the way they'd do this is by sending each employee a load of coupons that they could redeem. When I got my coupons through I noticed they looked remarkably sequential:

    HDGT26YA
    HDGT26YB
    HDGT26YC
    HDGT26YD
    ...
Half an hour later I had a list of 10,000 working coupons with a value of a few million (if you could somehow redeem them all). I emailed some marketing manager who'd initially sent them out and got a snotty reply along the lines of "This isn't a problem p.s. please delete those coupons immediately", then started CCing in people progressively higher up the chain until they decided it was actually a problem. A couple of weeks alter a fresh batch of coupons came out that were better randomised.

Not that big in the grand scheme of things but pretty satisfying for an afternoons work.

Re: Ask HN: What's your proudest hack?

#286

Elementary school, Windows 3.x era. School district thought they blocked access to the built-in OS games. Nope, from any program (Wordpad, etc) you could FILE -> OPEN to find/launch/play Minesweeper. Nothing makes an 8-year-old feel more like a "hacker" than subverting school controls to play video games, while also gaining cred with your friends. The good ol' days.

In high school (using windows 7) cmd.exe was blocked, but only by launching it directly.

Creating a .bat file and double clicking on it got it loading just fine.

I didn't find any cool tricks to do with it besides just running it.

Re: Ask HN: What's your proudest hack?

#287
post #256

In my first job I work on a database product in development that leaked memory slowly, leading to crashes after hours of usage. The software was written in C and there were no tools like Purify or Valgrind back then to deal with memory problem. It was a vexing problem that got punted until release time, when it became a show stopper. I looked into the problem and found that the memory allocation used malloc and free.…

This is awesome, i had to do the same, ended up writing a .h file that redefined malloc/free with macros, and then reported the missing and double frees.

https://github.com/qustavo/smc/blob/master/smc.h#L191

Re: Ask HN: What's your proudest hack?

#288
A few years ago I was planning to meet some friends in Brazil for the holidays. I waited until the last possible day to apply for a visa. When I tried to apply for the visa, there was an off by one error in the front end form validation that was checking that some dates were valid, and since one of the dates on the form was in December, the validation thought that it wasn't a valid date. I had to edit the JavaScript on-page to allow myself to submit the form. Got it submitted and got my visa a couple days later. I'm wondering if I'm the only person who managed to apply online for a Brazilian visa that day.

Re: Ask HN: What's your proudest hack?

#289

After reading an inspiring story in the mid 90s about someone that collected rejection letters for jobs they weren't qualified for (CEO of a national rail carrier etc), I turned to a life built on a similar idea. I applied for jobs I thought I could do, using mostly made-up resume information. If I was scheduled for an interview I would study like mad every waking hour until the interview. My career was absurdly succ…

> I retired rich 30 years early.

Sounds better than working as a product manager for 25 years.

Re: Ask HN: What's your proudest hack?

#290
post #256

In my first job I work on a database product in development that leaked memory slowly, leading to crashes after hours of usage. The software was written in C and there were no tools like Purify or Valgrind back then to deal with memory problem. It was a vexing problem that got punted until release time, when it became a show stopper. I looked into the problem and found that the memory allocation used malloc and free.…

Oh man this brings back memories, and is the exact same approach I used a couple of decades ago — there was some undefined behaviour in some code, and it ended up being nearly impossible to reproduce when using valgrind.

Using the approach you described is extremely effective and low-overhead, and allowed me to actually reproduce the issue (I think in the end it was due some async / race condition issue, because I was using “if map[key]” in a place where I shouldn’t, which actually inserts the key if it’s missing (and thus mutates the map).

Fun times.

Post reply on HN