This is my suggestion:
1. Consider yourself as a person who needs to go through rehab in order to get rid of an addiction.
2. Set a certain period of time as your rehab time (this needs to be long enough so that it can be effective but not too long that makes you insensitive about it).
3. Before starting this period do a prayer of repenting, simply read two units of prayer and ask God to forgive you at the end and request Him to give you enough strength and determination to keep you from repeating your addictive behaviour.
4. Start your rehab time and be determined not only to avoid repeating the same adictive behaviour (that you described) but to avoid even going near it and thinking about it.
5. Make an agreement with yourself that when ever you seem to be tempted to repeat that behaviour, as a measure of protection, you need to do an act of worship (e.g. reading certain amount of prayers, reading certain amount of the Qur'an, saying Astaqfirullah - God forgive me, etc.)
6. At the end of each day during your rehab period think about your performance and reflect so that the day after you can be even stronger. You ask God to help you in this on a regular basis during this period.
7. If at any time during your rehab period you commited the same undesirable behaviour, that means you have been unsuccesful. This means you need to start all over again.
8. During this time you will do some regular extra religious worship of your choice to remind yourself about the exceptional programme you are going through and also to make you stronger.
9. During this time try to use some spiritual medicines to help you to stay away from that addicted behaviour. By spiritual medicine I mean anything that can encourage you and make you stronger, e.g. being in the company of pious people, reading the Qur'an and pondering over its meanings, as much as possible not staying alone, participating in collective religious activities, exercising, having discipline, etc.
10. During this time try to avoid those things that can easily tempt you to go back to your addicted behaviour. For instance, what is the harm of deciding to make TV Haram to yourself during this period? Why not deciding to keep your eyes down and refraining from looking around while in public during this period? Why not doing something with your PC so that you can only check your e-mails during this period? etc.
11. At the end of the period, you will celebrate your success by doing Shukr (Thanks) to God and you decide that you will never go back to your before-the-rehab-period condition.
My dear brother, the above needs a bit of discipline, determination and strength. May the Almighty give all of us the ability to get rid of our weaknesses and get closer to him as the result.