You will be able to find the code used to generate the examples in the book, along with the code I used in lectures about it at https://github.com/danspielman/sagt_code