Live data from Hacker News

Ask HN: What's your proudest hack?

news.ycombinator.com

341–350 of 414 posts

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

#341
We had a laser printer in our computer lab that would, once in a while, shift the subscript in a mathematical formula several centimeters to the right. This was in a LaTeX-produced document. In those days, the path to print was LaTeX to dvi, dvi to PostScript, then send the PS file to the printer. I got hold of a LaTeX file exhibiting the problem. Oddly, if I made any change to the document before the problem spot, no matter how insignificant, the problem would go away.

So I dove into the generated PS file, located the code setting the subscript, noting that it placed the subscript using the rmoveto operator. The ‘r’ is for relative: It would take a pair of coordinates off the stack, add those to the current position, and move the current point to the new location.

So I added some code to the PS file, first to collect some information along the way, and then print it out at the bottom of the page. I turned out that the rmoveto operator got it wrong! So what to do?

I replaced the rmoveto operator by a few lines of PostScript reading the current position, do the addition, and then execute a moveto operator instead. That cured the problem! The next step was to put that code into a small job exectuting the magic operator exitserver (reads the printer password off the stack), followed by my redefined rmoveto operator. The effect is now global and applies to all print jobs until the printer is power cycled. So that print job went into a cron job running every 15 minutes. Problem solved! That hack was left in place until the printer was retired, years later.

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

#342
post #117

I was located in Sydney Australia, trying to fix a literally showstopper bug in the signal processing of the bank of Land Mobile Radio base stations that were being used to coordinate the stage management for the Opening Ceremony of the London Olympics. Less than 24 hours to go before the final dress rehearsal, and the production company was preparing to spend megabucks to pull all the radios out and replace them wit…

Noyce! This is 21st century if I ever saw it, and I tip my hat to thee.

I know you’re probably intending to say “nice” with an accent. But given the context I can’t help but also think of Bob Noyce, an engineer’s engineer. See https://www.esquire.com/news-politics/a12149389/robert-noyce...

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

#343

Earlier quoted context omitted.

Yes, it comes down to how the DPCM channel encodes sound data. A sawtooth gets most it's energy and harmonics from the sudden jump at one end. This impulse is impossible to encode in 1-bit delta encoding, the closest you can get is a slightly steeper slope. The audible effect is similar to a low pass, with the strength dependent on the intended amplitude, so instead of a nice sharp saw, you get a muddy not quite tria…

Ah sure, but how about just generating a triangle using a small block of code in RAM? Then you're not wasting any storage.

Further problems! The DPCM channel can only address memory from the region 0xC000 - 0xFFFF, due to how its "address" byte is interpreted. Most cartridges cannot place RAM in this memory region, so you're stuck baking the samples into ROM space. Many cartridges cannot even bank switch this region, so the samples additionally cut into your "fixed" ROM that is usually precious space for interrupt service routines and common framework code.

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

#344

Earlier quoted context omitted.

Ah sure, but how about just generating a triangle using a small block of code in RAM? Then you're not wasting any storage.

Further problems! The DPCM channel can only address memory from the region 0xC000 - 0xFFFF, due to how its "address" byte is interpreted. Most cartridges cannot place RAM in this memory region, so you're stuck baking the samples into ROM space. Many cartridges cannot even bank switch this region, so the samples additionally cut into your "fixed" ROM that is usually precious space for interrupt service routines and co…

Ah very interesting, thanks for the explanation! I'll definitely check out your lib if I ever get around to writing a homebrew NES game, I love quirky audio tricks :)

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

#345
When I was a teenager, my friends and I played this free MMO game online. A friend was told by another friend of him about a bug in the game. This bug would let you receive the reward of a certain mission without marking it as complete, so you could get the reward as many time as you wanted.

Me and my friend started exploiting the bug like crazy, spending hours literally just doing that. The problem was that the process to exploit this bug was very convoluted and a pain to do manually.

I had no experience of programming nor anyone around who knew anything about it, but I felt that there must be a way to do the whole process automatically. Computers are meant to automate stuff, right? Anyway, I started investigating online and found AutoIt, which is a BASIC-like scripting language that allows you to automate GUI stuff.

I then began building a script that did literally what I had to do manually to exploit that bug. And literally means literally. The way I made it work was by scanning colors in coordinates (to check whether a window it's opened, etc), moving the mouse and clicking. The script was full of duplicate code. I didn't knew about loops. All I knew was if conditions and mouse actions. I even remember having to go to a forum and asking for help (in super broken English) because I wanted to keep the program running indefinitely (they told me to use `while true`). But it worked.

Anyway, I spent about two weeks of after school afternoons building this bot. Then, when I had it working, got banned in a matter of days :^)

This might not seems like much, but I remember it fondly as this was my introduction to programming and the reason this became my career. I'm still holding onto the (terrible, terrible) script.

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

#346

Earlier quoted context omitted.

Noyce! This is 21st century if I ever saw it, and I tip my hat to thee.

I know you’re probably intending to say “nice” with an accent. But given the context I can’t help but also think of Bob Noyce, an engineer’s engineer. See https://www.esquire.com/news-politics/a12149389/robert-noyce...

You don't think it's safer to assume that this was an intended pun? Bob Noyce is pretty well heard of here. Neverheless, very Noyce of you to link the article.

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

#347

Being in Scotland and poor to the point of trying to eat on a few pounds ($5) a week. I discovered (by watching another customer) that a certain kind of very expensive Scottish smoked salmon was 4 pence more expensive than the price listed on the shelf. The supermarket (Tesco) also has a large sign stating that if the price was wrong on any item, they would both give you the item for free and the money it costs. I pr…

My uncle was in a similar situation: bought a granola bar, price was wrong, free granola bar. He went back a few days later and the price was still wrong. He’s a lawyer, and he sued the store and won (false advertising or something) to get them to fix the price. Pretty awkward because it’s the closest store to his family’s house. His son said it best one day, “dad, are you bored at work?”

"..He went back a few days later and the price was still wrong."

I've occasionally wondered about this, as an entirely new class of crime. One where a motivated regional manager at a modern supermarket chain could get together with someone in the IT infrastructure and decide to tweak a number (a price) in a database, and carefully watch the uncontested sales vs requests for refunds ratio. These 'mistakes' could be happening all across the stores' offerings and no one, including most of the employees, would ever be the wiser.

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

#348

Being in Scotland and poor to the point of trying to eat on a few pounds ($5) a week. I discovered (by watching another customer) that a certain kind of very expensive Scottish smoked salmon was 4 pence more expensive than the price listed on the shelf. The supermarket (Tesco) also has a large sign stating that if the price was wrong on any item, they would both give you the item for free and the money it costs. I pr…

> I went in three months later, and the same salmon still rang up at 4p more than it was listed at.

Incredible.

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

#349
I automated math education for my 9 year-old. It's a Unity application where a student required to solve basic (currently) math examples.

For 10 examples you're getting a 25-cent coin from a coin dispenser. You can keep it or you can use this money to buy Internet access. My OpenWrt router is connected straight to coin acceptor. For one coin you're getting 30 minutes of Internet on all devices (iPad and PC).

Since it's all automated I don't need to involve too much into education process. Math score in school has greatly improved, the kiddo solved thousands of examples.

Coin dispenser is proprietary (found on ebay, one of popular model), so I literally had to hack the USB protocol. The coin acceptor had no USB interface, so I had to introduce one. I've connected this USB to my OpenWrt 32-bit router, which is also ARM - so I had to hack some USB libraries along the way so my binaries can work with USB right from OpenWrt.

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

#350

I was working at Compaq in 1998 or so, and they had this thing called "SmartStart", which was a CD-ROM with drivers for Windows, SCO OpenServer, SCO Unixware, Netware, etc. Especially important were the storage drivers, because they had to be injected into the OS install to allow the OS to be installed on Compaq's newest RAID controllers, which the OS didn't have drivers for. There was a build process for all the SCO…

That floppy drive requirement for drivers lasted for YEARS it seemed like. Lol.
Post reply on HN