The key is to identify your bad habits and replace them with less bad ones. Not doing something is not an option, but you can do something different. When you have managed to do something different for 2 months the new objective is to not forget why you stopped doing the bad thing, be it smoking, drinking, gambling, porn.