I second everything the guys mentioned above.
Plus, go buy a new battery and while you’re under the hood, check to make sure that all of the fuses and relays are in good shape and fully seated. If it’s been on and off like that, chances are it’s going to $h*+ or already has. Don’t let it take out your alternator or a set of new cables (although that would be less likely if possible without operator error).
Do you leave anything in your vehicle plugged into any of the outlets (usb, cigarette lighter front or rear)?
Have you crawled underneath and cleaned ALL of the grounds? All of them? What about the ones behind the front windshield pillars?
*Bad grounds can cause all of the issues you described, especially if there is a bad battery involved.
Have you checked the brake light switch, the cam sensor and the crank sensor.
*Brake light switch can cause the stabilitrak codes, as well as other strange problems like not wanting to shift out of park, intermittent brake light flashes, and issues with the backup camera/sensors not engaging when they should.
*Bad Cam or Crank sensors can cause a myriad of issues ranging from the vehicle not turning over like it should, driving hard, feeling like it’s missing or running hard.
Keep us posted with your updates as it may help someone else out in the future.