Personal data point here. I was a co-founder of a tech start-up. Not software, but still more or less "tech". We had our travails and management changes. New CEO comes in, cleaning house. He and I chatted regularly. Then less regularly. Then rumblings of dissatisfied investors and the company at-risk. I commiserated with him, offering to take other assignments, plugging gaps where needed... or even to take an exit-package, if the company struggles to meet payroll. He thanked me profusely, reassuring me that no near-term actions are needed. In fact, HR asked my opinion and advice on various hiring and personnel matters. They scheduled an afternoon meeting, which I thought was a continuation of such matters. Instead, I was let go... right then and there. An hour later, the CEO called, saying that "in all honesty, he couldn't find a justification for my position".
Lessons:
1. Be circumspect, reserved and cagey.
2. Think only of yourself.
3. Expect the worst from management; that's why they're management (I was technically management too!).
4. Be mindful of when RSUs vest. Don't leave a day too soon, or a day too late.
5. Once you're gone, former workplace friends... won't be.
6. Never trust a CEO!