One way to kick a bad habit is to remove the easy availability.
Here's an example. Since I've started blogging I've been checking up on the statistics of my readers and earnings several times a day.
Many bloggers/webmasters fall into this habit. We all hope that our readership/earnings will increase so we watch our all of our statistics many times each day.
This interrupts our workflow, wastes time and creates a habit of being disappointed. Your website may be growing, but it's most often a slow process. So checking too often mostly just means that you'll be disappointed. This will lead to doubts and possibly even giving up.
So what did I do? I simply deleted the bookmarks to my statistics.
You can do this with any bookmarks or shortcuts that have created an addiction for you. Maybe your addiction is to a forum, maybe it's to a frequently updated blog, maybe it's to a computer game.
Now, if you want to visit the sites you have to have google it or type in the address manually. If you want to play then you have to go into the folder where the game is installed.
This has saved me time and reduced negative energy. Since it's become a bit harder to access my statistics I check them much less, only once or twice a day. I have done the same thing to my RSS-reader. To access it now I google it and only quickly browse it once in the morning and maybe once at night instead of checking it something like eight times a day.
You can also expand this beyond your computer.
If you have a bad habit of eating too much sugar then don't have cookies and candy at home. I recommend having something to snack on though. I always keep some oranges and carrots in my apartment. When I feel the craving for candy, but find none in my kitchen then I eat an orange instead. Doing this will over time replace one habit with a more useful one and probably make you lose some weight too.
Easy availability is one of the big reasons for developing stupid and unnecessary habits. Take an example like McDonalds. They are everywhere. It's so easy to just go in there and have a meal. The high availability increases the usage. Reducing the availability redirects you to take another, hopefully more useful path.
This can also be used to your advantage in another way. If you want to establish a habit of writing down your goals each morning then, before you go to bed, put out the pen and paper where it's most visible at your desk. If you want to establish a habit of working out then leave your training clothes out on a very visible place in your room/apartment/house instead of having them tucked deeply into your closet.
This tip is almost stupidly simple. But, when used, it works surprisingly well.