Energy principles for linear dissipative systems with application to resistive MHD stability