Laptop Mode Tools allows you to control various power management settings based on AC/battery power state. Among other things, it controls Linux's "Laptop Mode" feature that allows your hard drive to spin down for extended periods. It can also control CPU frequency scaling and screen blanking timeouts (both terminal and X). It supports automatic hibernation when battery is low.
The Open Source toolkit for Secure Sockets Layer and Transport Layer Security