Although I don't mind scratching up my bike in the normal course of using it, I do want to avoid battering the frame over and over when locking it up. Most of the time I lock it to vertical poles and the top tube rests against the pole. To protect against abuse I like to wrap the top tube with an old inner tube.
It's not rocket science or anything, but here are the few easy steps I took. First, I like to use the largest inner tube I have on hand since larger tubes provide more coverage. I have a road bike with 700 x 25 tires and rather than using the rather thin tubes that fit into those tires, I used some old 26 x 1.5 tubes. If you don't have any tubes around, just stop by your local bike shop and I am sure they will have some damaged tubes they will willingly give you. Start by cutting off the stem.
To get the most out of the tube, split it down the middle with the cutting device of your choice.
Then simply wrap it tightly on one end and anchor it with a zip tie. Continue to wrap and anchor with a zip tie and that's it. I will note that this job was made considerably easier by the fact that the top tube on my Vienna is void of any cables. On one of my other bikes I had to thread the tube between the cable and the frame which took a bit more time, but it is not a major challenge.
By far the item I use the most in my hacks is the common zip tie. I thought it might be fun to keep count of how many zip ties I use in customizing my bike over the next few months so I'll keep a running count. I like to double up at times just in case a zip tie breaks, so I anchored each end of the inner tube with 2 zip ties. Total zip tie count to date: 4.