Part of the compulsive aspect of it, is that I'd sit in front of a computer, and once I was there, it was a natural next step to look at garbage.
One thing that helped me was to use my imagination. Before I was in the situation, I'd picture myself being tempted, and getting up and walking away! After a few times of doing that, I had a better chance of doing that in real life.
The reason is that we have scripts in our heads of our responses to situations. I had given myself a new script!