ZERO cheating. Not a single beer. Not a single extra bite. Managed this for 3 months, losing 15 kg. Then occasional cheating for 6 months, losing 0 kg... Then managed once more for 3 months, lost another 15 kg. This is the hard part, I managed by introducing the following habits:
Same "default" meal every day. Chicken with broccoli, day in day out. It's not the best nutrition advice, but not having to think what to buy and what to cook is a huge factor.
Drinking a lot of water. 3 litres a day. I'd basically put two 1.5 liter bottles of water on my desk and made sure to drink all of it. Simple, effective.
Mindset shift. Told myself "I don't eat sweets" and "I don't drink alcohol" - sounds stupid, but very efficient to have preprogrammed reaction when facing a temptation.