Total cross section measurements for electron scattering on H2 and N2 from 4 to 300 eV