I would say that 90% of my extensive music collection is from thrift stores or our library book sale. The most that I pay for cds is around four US dollars. I borrow some from our local library and rip them to my computer and then burn to a cd. I am working on burning my vinyl records to cds also. My wife and I have over 6000 records.
Here is a url for some music that you can download for FREE, They are old 78 rpm recordings.
Go to http://www.archive.org/details/prelinger
I downloaded enough to fill a dvd disk.
Don't code right up to the point where you go to bed. Do something different to take your mind off code for at least 30 minutes, then go to bed. Read a book. Watch a show. Clean the kitchen. Anything.
Watch Letterman or Leno. Thatill make you sleepy.