I'm writing an eBook (perhaps to be published physically one day) on the topic of programming. As such, it contains many coding samples. I want to expressly allow readers to copy the source code of code samples for their own use, and I feel no need to require them to give me attribution in their compiled output--I don't need a byline on some corporate web site, just because somebody copied 300 lines of my code.
On the other hand, I also don't want somebody to copy some or all of the source code, and redistribute it solo, or with their own text, as their own.
My ideal would be something that requires attribution only in source form, but not in compiled/binary/object form. I believe this would accomplish both of my key goals mentioned above. Something like the MIT or 2/3-clause BSD license would be fine with me, except that I don't need it to apply to the compiled program.
Are there any existing open-source licenses that would apply to such a situation? Or should I just stick with a well-known MIT/BSD-style license, even though it covers compiled output?
I can, of course, write my own, but since IANAL, I'm sure I'll screw something up, and end up with a worthless license.