I made a cheap ($1.50) Arduino project that, when it receives any infrared signal (such as pressing the on/off button on a TV remote), sends out IR codes to the TV to toggle it on/off. It's pretty neat.
I based it off of Ken Shirrif's Arduino TV-B-Gone. It uses an Infrared receiver and 2 infrared LEDs to receive input/send output signals to and from the TV remote/TV.
Here's my instructable on it: http://www.instructables.com/id/150-Arduino-TV-Annoyer-Turns-TVs-on-when-you-/