Just glue an envelope with a CD to the backcover, this is what people were doing before your fancy internets became a thing. But really, if you a writing a book on a modern language, and your code has external dependencies, chances are it will not build 5 years forward, even if there are no URLs directly in the book.
I can see the comments now: “Just put it on GitHub! Why do they put it on something physical that I’m just going to lose!?”
Retailers loathe books with extras (CDs, USB, or otherwise) because the rate of issues and problems with returns goes way up. Customers dislike it because they’ll lose the thing. Just put it on GitHub and call it a day.
I could understand some of these complaints if a certain publisher has gone out of business and all of their links were dead or something, but I can’t really get worked up about someone having to clone a repo from the internet to work with code. I’d much rather deal with that than I would keeping track of a physical thing that comes with a book, which I have to stick into my computer.