What crazily awesome (or crazily bad) stuff have you hacked together to meet a tight deadline? What are you most proud of?
Um, I am not really proud over the hacks I've done to meet my deadlines (although there are a few hacks there, isn't there? :)).
Recently I have been coding on a game editor for a game which is going to participate in an online contest. I would say that everything in that editor is crazily hacked together due to lack of time organizing code and analyzing requirements. Stuff just pile up, most of the code is copy-pasted (not very error tolerant, is it?). At the current state of the editor, every little change is a painstaking endeavour towards "go-and-change-50-copies-of-the-almost-same-code-block".
Whew. I tell you boys, that project reaks megabytes away...
None specifically. I'm proud of any hack that happily lives on, even though I've made an obvious note about how hacky it is :-)
While writing a server for a completely different network protocol, I added a hack to make it respond to HTTP GET requests.
This really was a hack, because it was above a layer which is very unlike HTTP, so the GET request gets reassembled from a bunch of variables in various types (e.g. the E and T of GET are in a long by this point).
I was actually experimenting with the idea of slipping an Easter egg into the service, but it turned out to be a really useful way for people to check the server status.
When I found that the virus I'd written on the ground couldn't quite handle the defenses of the computer system aboard the alien mothership, but I had a sudden inspiration of how to hack together a buffer overflow exploit to overcome them.
Oh wait, that was a movie plot. Never mind.
"Auto-Building" Years ago, I was the sole developer of a CAD-like program for metal roofing estimation. Salesman friendly. Written in Turbo Pascal to run on MSDOS. It could draw arbitrary rectangles, polygons, indicates slopes of roofs, and blah blah blah.... well one day the founder/president/boss asks if i could add a new feature to let the user easily add a simple building shape - rectangular with gable roof. To let them just type in width, height and pitch angle in a popup box. My mind was in tune that day. I added that feature, good looking, running well, and bug free in only about two or three hours. Normally that would have taken a couple days. Heh, normally it takes me all day to write a "hello world" program!
Many years ago I was sent on a last minute mission to a client site. I only had a desktop at work so I was given a loaner laptop. I had some file or document that was a must-have for the meeting in the morning that I was told would be emailed to me.
I got to the hotel very very late at night and dialed in (this is pre-ubiquitous-broadband) to download my email to get the file. The only email protocol supported by the mail server was POP -- and I had my email client on my work machine setup to not delete emails after downloading -- so I could also retrieve them on my home machine (also setup to not delete emails). So I fire up the mail client, enter in my settings, and see: "downloading 12 of 17294 emails (146 hours remaining)". yikes.
okay regroup. How does my email at home know not to download all of these emails? There must be a way to trick my netscape email client (what was that called? communicator?) into thinking it had already downloaded the first 17000 emails. Nope. Downloads of other email clients (eudora rings a bell) didn't give any relief.
By now it's 3 am and I'm frantic. So I looked up the POP specs and wrote a perl script to delete all of my old messages from the server. Turned out to not be that difficult.
My final year project on my degree...a complete hack from start to finish which got me 73% ('A' grade) :D
Well, I quess we define "hacking" as what we do when we make a shortcut to a goal, while we are perfectly aware that its not best practice.
So in that sence, i refeer to all my code that works as hacks, and the rest as bugs. Because i'm sure that there must be a better more perfect way :)
Once had to use a password protected zip file created by another program but no one knew the password.
managed to trick the password out of the other program by writing a file called pkzip.bat :)
This (official release of software):
int algorithm_procedure(.......)
{
#if 0
// a lot of code
....
// struggled for hours to make it work ... but eventually (see below)
#endif
return NOT_IMPLEMENTED;
}
Not that I'm very proud of but there was no solution at that time...
On a client machine, we had a large table of data to be imported in to the database in a compressed file.
But it turned out we didn't have the disk space to have the uncompressed file on the disk AND load it in the database.
So, I did this on the fly instead:
[Process 1]
$ mknod -p /tmp/mypipe
$ gzcat hugefile.gz > /tmp/mypipe
[Process 2]
(start DB SQL listener)
load from "/tmp/mypipe" insert into mytable;
This is one of those "Unix Moments" that gets Unix shell geeks all giddy.
I had an Apple //c as a kid with a 512kiB expansion card, that I initially used as a ramdisk. One day when playing with bank switching registers, I hacked up a small bit of code that caught the 60Hz mouse interrupts and switched in the 'next' bank. The effect was a (flickery) illusion of 10 multitasking applebasic prompts. The weird effect I remember was that because keyboard input was polled from an I/O-mapped memory location, typing on the keyboard would deliver the keystroke into an indeterminate 'vm'. I ditched the thing as pointless, and years later when taking an OS class recognised its potential. Sadly, when I went looking for it I found my parents had donated my //c to a junior school.
When I was in High school I got a job fixing lazer tag guns at a local arcade. The system was run by a 386DX and some awful DOS program. One day the computer caught on fire, and I had to put it out with an extinguisher. I was proud of that :-)
I can't remember but I think the thing still worked fine once we cleaned it out. :-)
#! /bin/bash
kill $(ps -C firefox -o pid=)
~/bin/restartff
#! /bin/bash
kill $(ps -C firefox -o pid=)
exec firefox
alias yamlxs="perl -MYAML::XS=LoadFile -MData::Dumper=Dumper -E 'unless(@ARGV){say q[Usage: yaml \"file_name\"];exit}; say Dumper LoadFile(\$ARGV[0]);'"
split up into manageable parts.
perl
-MYAML::XS=LoadFile
-MData::Dumper=Dumper
-E 'unless(@ARGV){say q[Usage: yaml "file_name"];exit};'
-E 'say Dumper LoadFile($ARGV[0]);'"
as a perl script
#!/usr/bin/perl
use 5.010;
use YAML::XS qw(LoadFile);
use Data::Dumper qw(Dumper);
unless(@ARGV){
say 'Usage: yaml "file_name"';
exit
}
say Dumper LoadFile $ARGV[0];