Much of this is just sample code with extensive comments explaining what is going on for educational purposes. If there's borrowed code, it's cited somewhere in the comments.