Powering a PC on and off with a controller, how can I do it?

I've wanted to do this for some time but can't find anything. At the very least it would be nice to find a way to shut it off with my controller as gaming at night helps me fall asleep and getting up out of bed to shut off my pc ruins the point of it. any thoughts? I'm thinking whatever I do it will probably have to involve sleep mode rather than a complete shut down but anything would be good.

For the record i'm using an Xbox 360 controller with a wireless dongle and it can connect to said dongle without the pc being turned on.

I do the same thing, I have Xpadder but if you don't have $10 to spare JoyToKey works just fine too, I have the right analog stick mapped to my mouse so I just navigate to the power off in windows.

For the turning off you can use steam's big picture mode's power button with a controller.

Very nice! I will look into these as soon as I'm near my computer again.