Man sentenced to life for killing ex-girlfriend