On my Snow Leopard-based MacBook at home, I use a neat little app called Caffeine. Caffeine prevents the system from sleeping or dimming the display during long periods of supposed inactivity.
Caffeine, though, has limitations; you can select periods of time for it to prevent sleep or set it indefinitely. What if you want the machine to sleep upon completion of a long running task? Do you set Caffeine to become inactive after you think the process will be complete in the predefined time settings? In Mountain Lion, you can use the command line or Terminal command caffeinated.
Say you want the unit to remain awake for an hour?
caffeinate -u -t 3600
3600 is the time, in seconds, the unit will remain awake. Say you want caffeinate to run only until another application completes a task?
caffeinate -s running_command_or_app -additional_arguements
For example, you could use caffeinate diskutil repairpermissions to keep the machine awake in your absence until Disk Utility can complete repair of permissions.
The command will prevent sleep on the computer until either the specified time has elapsed (keeping in mind your sleep settings in System Preferences) or until the specified application you have entered completes its task.