Hey there. Slow down mate. Breathe. Slow and steady.
Worrying is the misuse of imagination. You're worrying too much. Anxiety and Depression. Even if you study all day it's not going to work as the psychology is drenched with all these maladies. First you need to take care of this. High spirits. It doesn't matter that you're 27 and have gone wrong paths. It happens. [ ohh the examples range from Colonel Sanders of KFC, Hugh Huffner, to Charles Darwin and ..uhh, Samuel Jackson ]. At Apple WWDC this year Tim Cook proudly said the eldest app developer was an 80-ish lady from Japan. 80+! Heck, you're just 27. The cube of three. Cool, isn't?
All these so proclaimed downs in your life come by. Embrace them. You have gone through and survived to come out better with experience and learning of your mistakes, not depression. You know deep inside who you are and know that you can definitely do whatever you want. You're that star in the night sky that has gone dim to come out later and shine brightest. High-five!
'Useless sitting idle at home' - Home is indeed useless, unless you don't have the zeal or work to finish. I recommend you to go out, maybe a place where people study for GATE or a work place. If money is a problem sure do join work what you would like. Why not try competitve programming? It's fun and brings back the zeal to code. You too learn algorithms and data structures which not only help you in interviews but also GATE.
As far GATE is concerned, read the subjects because you want to know why the math works this way, how a parser parses and can you do it better?, a new patch for the linux kernel? or a theory for computation? or a new schema for your database? or why the f**king memory exploded and is leaking for my code?
I know a "lot"of people will comment here, below to focus on GATE Topics only but I suggest you to learn deep and undertsand why rather how to solve the problem. Go deep, explore connections and slowly understand. This prepares you better for anything and sooner problems are visualized. Once you see problems you can easily solve them. Interviews, exams or random questions by your relatives near or far.
But.
The most important improvement would be your confidence. You would have the fun learning and that up's the soul. The mind. And then it's history.
History.
Good luck!
[ More tips. The better your math is the better your chance to top GATE, exercise and yoga indeed do help, trust me. If you know how to write a SNES Emulator in C you're ~the man~, also try out fields of computer science such as machine learning, computer vision, computer graphics ( <3 ), perception, computational neuroscience, applied mathematics etc. Read books. Anything you find across. Mystery, fantasy, anything you fancy. Learn to cook it reduces anxiety and boosts survival skills, play video games, talk more, don't overthink. ]
So, I'm asking you, [asker], are you in for this?
Let the ghost of your past not dim the bright soul of the future.
See ya!