On the statistical mechanics of classical Coulomb and dipole gases