If outside of a job, like side projects and such, then go off and do something else for awhile, explicitly and on purpose. If you stew about not coding then you won't code and you won't do anything else (been there done that). So just accept that you won't be coding for awhile, and go do something fun or interesting or world changing or odd.
Read something specific. Ride your bicycle short distances. Learn to cook, in general or something specific. Learn a game. Invent a game (danger, may involve coding). Learn a (human) language; go somewhere that they speak it. Join a sports league. Make weekend trips out of town. Make weekend trips downtown.
If you like, keep a notebook during your adventures, for ideas for later projects. Keep in mind that those later projects might not involve coding; coding is not the only thing in the world available to occupy your head.
If you like, don't come back from your adventures. Be a renaissance man/woman. Those adventures may or may not include code.
If you're talking about inside a job where you're supposed to be coding, then ... just fucking do it. Sorry. But you can still be a renaissance adventurer on the weekends.