This is common to many of us and until you really decide on what you want out of life, you'll keep on doing the same old thing, and hoping for different results. In some places they call that insanity. And almost all of us do it.
Yet here's some practical steps to get you to do what you want (apart from the awesome list jwdunne posted).
-Built a bucket list, and use those as the loadstar for your life. If your goals don't help you reach your bucket list items then those are usually bad goals.
-Use scheduling to choose ahead of time. Think of a schedule like a budget for your time. You get to decide beforehand what you are going to do, which helps you do it.
-Edit your /etc/hosts file and block out youtube, facebook, reddit, etc... for a whole month. This will help you break your social media addiction.
-read up on the Pomodoro technique and do it. Honestly it's amazing.
-Move your body more. You aren't designed to sit/stand for hours doing the same thing in the same pose.
-Walk/exercise every day. This will help you stay at your computer when you need to stay.
-Decide that you are stronger than your weakness. Man is buffeted when he thinks himself the creature of outside conditions. You have the power to change your life.
-And if you keep messing up, take time to figure out what is going wrong. Try something new, and sooner or later you'll find a way that works for you.