Back in the early days of radio, 60 cycle hum was a problem because of insufficient power supply filtering getting in the audio stages of the vacuum tube radio. Someone cleverly injected an out-of-phase 60 cycle signal in series with the speaker drive called a hum-bucking-coil.
Don't forget the most popular technique invented by Alexander Bell and widely used today, twisted wires.
A few others: current mirrors, diffrential amplifiers, using a diode to compensate for a base-emitter voltage
On the mechanical side, don't grandfather clocks use a combinaton of alloys and linkages in the pendulum to keep the length constant over temperature?