On the verge of being "fired" from post-doc position, how to act towards supervisor? I am in month 5 of an extremely unfulfilling post doc position in France. My sole responsibility is debugging 10k+ lines of spaghetti C++ code. I am a mechanical engineer and although I did my PhD with a focus on numerical simulations, debugging isn't what I envisioned myself doing.

My current supervisor has been "controlling my life" by controlling when I leave from work by strategically placing meetings at such times. He has also suggested on numerous times, quite explicitly that I must not leave work until he does; and he is a workaholic - works 12 hours a day. This has continued for the last 4 months and this has severely affected my health. I am now depressed, balding and have lost 15 pounds of body mass.

Today I had a conversation with the director of my research lab and he hinted that since things aren't working out, "I may be given enough time to find employment" and leave. 

I am confused, hurt and extremely displeased to say the least.

Losing my job would be very problematic for me, as I am an Indian citizen and it would affect my ongoing H1B processing for a faculty position in the US starting next fall.

My current contract doesn't state what the "rules of being let go" are. All it says is that I am required to work 35 hours a week. I have consulted a lawyer "friend" and he tells me that most contracts are at will anyway and for foreign nationals, once your contract AND work status are revoked, you may not be able to fight the system.

Considering that I will be given a few weeks to a month or so perhaps, how do I behave towards my supervisor. Should I show up for work or just say screw it?
There are two problems here. An academic dilemma and a legal issue. The latter is specific to country's immigration, workplace rules, your residency status, etc., therefore I will politely keep the focus to the first one. There are also good comments to your post, so keep them in mind as well. Needless to say, the legal problem could be more intimate to your situation but you will find actual support from a legal authority as you yourself have stated. Now, to the academic dilemma at hand: first of all, I suggest talking with your supervisor and make your position clear in an honest sober way. Your problem is a practical one and need not to be emotional. Here, I would suggest and stress on keeping the best of relations with your supervisor (even if you decide to leave or they decide to let you go), especially if this is your first ever post-doc position. This is important for two reasons: first, you want to leave on good terms even if it didn't work out for you and so you don't need to give an impression of personal grudge. Second, there might be opportunities in future where you will have to work/collaborate with the said supervisor or the university. You also don't want to ruin the possibility of good references for your own future work from this university - hope things will work out for you, and my two cents help. Good luck.