Physics of the Interstellar and Intergalactic Medium