All code that I post to Stack Overflow or Stack Exchange is licensed under CC0. This license is essentially equivalent to releasing something to the public domain, but also works where public domain does not exist. It is not a viral license. It does not require attribution. It does not require preservation of the copyright notice.