>>768494
For porn/masturbation, have a look at the website "your brain on porn", it should help.
The first couple of weeks are the hardest, after that it will occupy your thoughts less as time goes on. After a few months your brain will feel a lot cleaner, less constant flashes of porn-type ideas in your head. Stopping porn is the most important part, once you have done that, and beaten it, masturbation won't feel like such a strong urge anymore. It is the porn that formed the habit and made it so incessant, the hunting for porn.
For the first two or three weeks, stay very busy, stay around other people as much as possible, and reduce your privacy by leaving your curtains and door open. Going on a camping trip or somewhere with no internet will help a lot too.
If you slip up, don't make a big deal out of it, just think that you've managed to be porn-free for a few days and that's positive. Then start again. Even if it takes 20 attempts, it is worth it, and you will become more in control over it the more you try.
First step for me was deleting all my saved porn. Some people use a porn filter, but I didn't. It can help to limit which websites you go on though, even if you are doing it just consciously. Don't go on imageboards apart from perhaps this one. Some people use an image blocker so the browser doesn't display any images at all no matter what.
Also, redirecting your energy towards exercise helps a lot. It is a simple activity where you don't have to think too much, makes you feel good from the chemicals it releases, and is a positive alternative. Read how to do good quality pushups and start there. Going for a walk away from the computer helps a lot too.