views:

202

answers:

3

As programmers, we typically HATE repeating operations. I find myself writing little programs every once in a while to help me with mundane tasks. I might take an hour to write a little console app to perform a task that normally takes me 5 or 10 minutes, but I use it probably once a week, so it saves me time (and arguably more importantly, annoyance).

What are some small apps like this you've written? Is it shared somewhere?

+1  A: 

Wrote a util to walk a directory structure and remove all empty directories.

Muad'Dib
+2  A: 

Since I'm almost always only interested in the most recent files in a dir, I wrote a simple script that I use all the time.

latest

#!/bin/sh

ls -lt $@ | head
Will Hartung
that would actually be easier as an alias, wouldn't it?
AndreasT
I dunno, I don't use aliases. What I like is the $@ which lets me add switches to ls and file params (like "latest *.jar", etc.). And, at a minumum, it works in sh, bash, ksh, csh, zsh, and from vi :-)
Will Hartung
+2  A: 

On my TRS-80 I wrote a little machine-language program (not assembly, but machine language--encoded that crap myself) that would look at the position of my joystick and report the result to a batch file.

It was one of the joysticks that you could unlock the springs so it would stay in a position.

Anyway, Upper-left started my BBS, upper-right booted into the OS, lower-left booted into..hmm, I forget what the other two did, but with the fairly long boot times it was great. I could be sitting there playing a game then just flip the joystick to the upper-left, hit the reset button and walk away and a few minutes later it was fully booted into the BBS.

Honestly at this point I can't remember if it was my TRS-80 or my first (pre-hard disk) PC. I did most of my hand assembling on the TRS-80, so I think that's what it was.

By the way, to get a joystick value you actually set a bit to charge up a capacitor, then you time how long it takes the bit to reset. The reset is based on the cap discharging through a rheostat (variable resistor)--the amount of resistance is set by the joystick position, so less resistance and it discharges faster.

You just sit there and tie up the CPU doing loops until the bits reset... Fun stuff.

Bill K