Slides and codes for lecture 8