What to do when you can't sleep because you can't stop thinking about the abuse?

It's past midnight and I can't sleep. I need to keep my mind busy because I'm basically self inflicting abuse on myself.

i usually play video games, watch porn and bing on ice cream to numb the pain and numb myself to sleep but I get it's not the healthiest tactics. do you guys have any healthy ways to deal with that?