Live data from Hacker News

Ask HN: What's your proudest hack?

news.ycombinator.com

271–280 of 414 posts

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

#271
post #77

Years ago I worked in the VAX/VMS development group at Sybase where SQLServer originated. SQLServer was basically an SQL interpreter consisting of several layers of loops. The innermost loop was written in assembler for speed. I was able to remove one (1) machine language instruction from that innermost loop. I no longer recall if this resulted in a measurable difference but I've always been proud of this.

Happy to read VAX/VMS here :-) - my first project as a college fresher was migrating critical data from VAX/VMS ISAM files (written using Fortran code) to Digital Unix. The days when these two machine's did not talk to each other. Learnt dd, tape drive record limiter issues, all data was floating point so issues with binary compatibility etc. One of the best accomplishments in my career.

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

#272
post #269
post #258

I hosted a server, in my bedroom back in the late 90s. By server, I mean a desktop running Slack, connected to the internet and allowing me to SSH into it. It could recover just fine from a power outage, but unfortunately due to a RAM issue it would just randomly die - and RAM just wasn't something the local computer store was ready to bring in. Enter my Lego Mindstorm. I effectively built a box, on wheels with a big…

For the confused: Slack isn't just the modern messaging platform.

Seriously i was wondering what sort of time traveler OP was

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

#274
In the early 1990s, I was part of a group of high school students who wanted to enter the Finnish demo scene. I was responsible for coding most of our demos in 386 assembler. One of the things I wrote was a player for MOD, ST3, and S3M music files, which were similar to MIDI but included WAV samples. The player ran in the background on a hardware interrupt, while other code ran on the foreground to display something on the screen. For most sound cards, the player had to mix the samples in real-time and output a byte to an I/O port at a rate of 22 kHz, for example.

To enter a demo competition, one of the criteria was support for Sound Blaster sound cards. The problem was that we didn't have one and didn't want to buy one because we had already spent all our money on Gravis Ultrasound cards. Fortunately, a member of our group was able to borrow a Sound Blaster for a day. We had to figure out how to add support for it, but we had no documentation and there was no internet to speak of yet.

I figured that it must be possible to add support by sending I/O to the card. We put the card in my computer and started a third-party MOD player that had Sound Blaster support. I traced the execution in a debugger, instruction by instruction, while my friend took notes on all the I/O instructions. After some thought, it became clear that the program was scanning for a Sound Blaster and, if I recall correctly, configuring the card to DMA a particular byte in memory as the sound card output.

I added some hardcoded "OUT" instructions to my player and it worked instantly; my real-time mixer output was played through the Sound Blaster! There was a lot of cleaning up the code to be done, but we were able to add support for the Sound Blaster in just one day.

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

#276
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.…

Hah! A few years ago I did something similar.

I was in the process of porting some C code (a physics engine) to javascript. After porting the code I benchmarked it - and, no surprises - it was waay slower than the original C code.

One reason C is faster than javascript is that C structs get "inlined" into the containing object. For example, in C struct Body { vec2 pos; vec2 velocity; } would just be 1 object. But the equivalent javascript code would allocate 3 objects instead.

I inlined vec2 (replacing it with pos_x, pos_y, etc) and performance got a lot better. But I was curious what other structs were thrashing the garbage collector. So I added a call into all my constructors which generated a stack trace (new Error().stack), and used the stack trace as the key in a javascript object - with the value being the number of times that stack trace was seen.

After sorting and printing the result, I had a hit list of the hottest stack traces which were thrashing V8's garbage collector. I fixed all the worst call sites and by the time I was done performance improved by about 3x or so!

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

#277
post #258

I hosted a server, in my bedroom back in the late 90s. By server, I mean a desktop running Slack, connected to the internet and allowing me to SSH into it. It could recover just fine from a power outage, but unfortunately due to a RAM issue it would just randomly die - and RAM just wasn't something the local computer store was ready to bring in. Enter my Lego Mindstorm. I effectively built a box, on wheels with a big…

This reminds me of a story that isn't mine; one of my coworkers working a university and had a similar problem. They glued a stick to the CD-ROM drive of one server pointing at the restart button of another server. When they needed to force reboot that second server, they issued a command to the first server to open its CD-ROM drive.

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

#278
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 upstream host so it was not possible to download things into the client environment without going through a virus-checking firewall. This imposed various restrictions:

1) It prevented any executable, tarball etc from being downloaded. Basically if it was in a useful file format it was no bueno.

2) It prevented any file over a certain size from being downloaded. If it was over the size, the firewall would just cut the connection.

Time to get the unix toolset out and get to work. I realised first that I could easily get around #2 by slicing the file into chunks, downloading each chunk and then reassembling on the client side

#1 was a bit more tricky. The first thing I tried was encrypting the file. This would theoretically mean the virus scanner wouldn’t be able to find any signatures of hostile file formats, but it turned out that the encryption itself made the first bit of the file predictable and so my first chunk kept getting blocked.

Soo….. I added some random noise onto the front of the file. Once I tuned the length, it meant the virus scanner didn’t understand the encrypted file so it got through.

The two resulting shellscripts (called “shred” and “unshred”) are probably my favourite ever hack. You’d run “shred” on the far side, which would take any listed input files, put them in a tarball, encrypt it, add some random noise to the front and then cut it up into chunks small enough to get through the firewall, and then on the far side you’d download them and run “unshred”, which would reverse the process.

Once we had demonstrably got our software through the firewall a few times, IT/infosec realised their objections were futile and they relented and whitelisted our upstream so we could just do a normal install for all future releases.

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

#279

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 like those McDonald's hacks where people exploit flaws in the price calculations to get burgers for free. IIRC in one case they noticed that you could order a hamburger without patty, and it had a slightly negative price. So they ordered twenty hamburgers without patty and one normal hamburger, and got all free of charge.

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

#280
In the late 90-early 2000s, all the rage was PHP2/3, flash and IRC. We had a small hosting company with a friend, backed by a workstation in his room.

We would host small websites with PHP and PHPMySQL, as well as eggdrop and bouncers.

Most of these kinds of hosting were flaky and half baked at the time, and we were no exception. There was a brutal war of who would become the biggest host of egg drops and bouncers.

I'm not specially proud of it, but we did manage to find some PHP vulnerabilities on some competitor website (the typical kind at the time, where you type "?page=index.html" and that would load anything).

We managed to upload one of our PHP files on their server as an avatar on their PHPbb forum, and could then execute it with the include-from-url vuln.

We then proceeded to host eggdrops as PHP scripts on their servers that we would start by just loading the page we uploaded there.

No real harm done though, I think both us and them were just teenagers way too concerned by IRC social status :)

Post reply on HN