Lectures on Hartree-Fock theory and its applications to nuclei