Unlock Your Mac Using A USB Device
sudo python setup.py
Code waits for your USB device to show up while your computer is asleep. Then it simulates your keystrokes and logs in. You just insert your USB device into the port.
I first tried to put a key file in the USB device and force the code to look up for it but OS X does not mount devices while asleep.I will try to find a solution for this.