The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
A lot of it is time management.
A long time ago, I realized that concentrating on one thing for extended periods is bad - it forces you to think in a single line, and never consider alternatives. Basically, you "go stale" and your useful output drops. In those days, I smoked so cigarette breaks controlled the frequency of such interruptions. But I gave up - thankfully - so I deliberately take frequent breaks to do something else (CP stiff for example) which makes me think about other things. This has several effects - first it refreshes me for the task I'm trying to do, and second it exposes me to other ideas which are often unrelated, but can often spark a shift in thinking for the project I'm working on. Lastly, it provides a "reality check" that I'm doing the job right when I come back to it. If I'm not, then it's obvious immediately because it takes me time to "pick up the thread" of what I was doing. Then I can fix that as well, either by better documenting what I've done, or changing the way I'm doing it. All of which means I end up with a better product which is easier to maintain because I "goof off" doing something completely unrelated!
Give it a try: take a ten minute break every hour and stimulate your brain with other things. It's surprising how much of a difference it can make.
Plus I'm a gestalt mind of twelve clones, so you never know which one(s) of me you are talking to!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...