My first rule to not being laid off is to watch for signs of trouble and act accordingly. The majority of these layoffs are not random and are business segments we've heard rumblings about for awhile. If you were on one of these teams, try to find another job while you can. Sometimes they come out of nowhere, but for the most part, teams start getting less work and stop hiring new employees before layoffs happen. Pay attention and always be ready to respond accordingly.
Good advice from @3skl+1tB1UmNh.