As it turns out, probably about 90% of the coding that I do these days is in the form of nifty hacks. This is particularly because in research the impetus is not necessarily to have code that is reusable in a lot of situations, but rather to try out an idea quickly and then throw the code .
For example, just today, I needed a couple of images to put into my research poster for the conference I’m presenting at in a couple of days’ time. This involved drawing some rectangles over photos were faces had been detected by some other software. Basically, by having sufficient data in a format I had documented (in the form of other code) this was easy to extract. There are countless other things in my Honours thesis which looks somewhat like this — lots of experiments done with a tiny bit of Python code tying other big packages together.
The hacks that I’m proudest of are the ones which provide me with sufficient useful output that I can reuse their results, and not necessarily the code.
 Obviously, no code should ever be thrown away. When I say ‘throw away’, I mean something more along the lines of ‘ceasing maintainence’. This is because you can never know when a piece of code you’ve already written could be useful.