Take a surface of some charge density, and of any general shape. At some point on the surface, construct a very tiny Gaussian pillbox that passes through the surface. At all points on the surface the field due to the surface is orthogonal to the surface, so the flux through the sides of the pillbox approaches zero as we make the pillbox smaller. The net flux out of the surface, if the electric fields on either side are ##\vec{E}_1## and ##\vec{E}_2##, will be$$\Phi = \vec{E}_2 \cdot \hat{n} \delta S + \vec{E}_1 \cdot (-\hat{n}) \delta S = (\vec{E}_2 - \vec{E}_1) \cdot \hat{n} \delta S = (E_{n,1} - E_{n,2}) \delta S = \frac{q}{\varepsilon_0} \implies E_{n,1} - E_{n,2} = \frac{\sigma}{\varepsilon_0}$$since the unit outward normals, ##\hat{n}## and ##-\hat{n}##, to the two opposite faces of the pillbox will be oppositely directed.