Wednesday, January 06, 2010

Oldest python file in your home directory?

Feeling just a little nostalgic this time of year.

Just made a little script to find the oldest python files on your hard drive.
http://rene.f0o.com/~rene/stuff/oldest_python.py

oldest_python.py [path]
oldest_python.py mystuff/python
oldest_python.py
oldest_python.py ~
Update: Lennart mentions a unixy way in the comments of finding oldest files with this:
find . -name '*.py' -printf "%T+ %p \n" | sort | more

With that I found some really old python files of mine... woh! the oldest ones dated in 1998. There are older C, C++, haskel, javascript, java, pascal, prolog, asm, sql, perl, etc, etc and heaps of other old junk files, but those are the first ones I could find written in python.

I guess that means I've been programming python for around 12 years now. Python was at version 1.4 or so, and 1.5 was released not long after. New style objects did not exist, and it was not all too uncommon to be able to segfault the interpreter (ping could easily crash linux & windows in those days, so python was doing pretty good).

So what did some of the older python files do?

Cut up writing was the oldest tool I found. Cutup writing was a technique used a lot in the 90s (before then and to this day as well). The idea is that you cutup various pieces of writing, and move the pieces around to get ideas.

After that came a script to randomly ping different web hosts (by http) every few minutes. In 1998 it was common for ISPs to disconnect you from your modem if you were idle for a while. So this script seems to ping one of a random selection of hosts and then go back to sleep. I remember this being the first thing I wrote in python. It took me less than an hour to learn enough python do this little script. That one hour probably saved me $300/year or so in telephone bills.

After that there is a script to convert all file names to lower case. Useful for bringing the contents of FAT drives onto a linux box.

Then there was some thread testing code. Threads these days are way better, with lots better tools, better implementations, and more known about how to use them appropriately. Using threads in those days for IO was pretty crazy... but apache used processes! Python had a wicked set of async IO servers in its toolbox. Which were pretty darn cool in the day.

Finally there were some mp3 making tools - to convert my massive collection of CDs. This was when some machines could barely play mp3s without crackling. Seems my tool would use various linux tools to make my job easier. Rip cds, get their names, convert them to mp3s. Using some old scsi drives I could go about my business without my machine slowing down completely and becoming unusable.

What are your oldest python files? http://rene.f0o.com/~rene/stuff/oldest_python.py


2 comments:

Lennart Regebro said...

Your script took a while, so I found the oldest file by doing "find . -name '*.py' -printf "%T+ %p \n" | sort | more instead. :)

Anyhow, it was from 2008, proving that I'm a well organized person who doesn't keep crap around in my home directory. The oldest Python code that I wrote that still exists is this: http://www.zope.org/Members/regebro/luf_cms

illume said...

ah, nice one! Added it to the post.

Your luf cms brought me back to my days using zope around 2000. It wasn't too hard to whip up a quick zmi based site for through the web editing... hehe.

It's kind of fun to keep lots of old stuff around... in case it might be useful one day ;) Or maybe it'll be fun to look at it again in another 10 years and laugh/cry.