Monday, December 5, 2011

Python script to check valid email addresses

We were having discussion about checking a list of email addresses for validity.
one of member had posted a bash script for Linux to verify the email addresses before sending the emails.

I thought to write a python script for the same in windows. Well this script can be easily ported to linux with just one or two lines changed. But I was too tired after all day office work to write check for OS and write windows as well as linux code. Currently it is only for gmail domain. But can be easily ported to every domain. Just need to extract domain from email id and check its MX by the existing code. (I told you already I am tired to write more code)
If some people found this useful and need sophisticated version then I would release a next version of program.

This python code take one argument which is list of emails one per line in text format.

You can download python file HERE

Thursday, December 1, 2011

Control PC through TV Remote Control

Recently I attached a LCD screen to my PC to watch Movies.

While watching movies I came across the fact that I was only able to adjust Volume, Color, Contrast, etc. TV features only.

Whenever I had to play/pause the movie or control media player I had to go towards the PC keybord / mouse. I found it very irritating. Then I thought why not use the Teensy (I had got some days ago) to code something using Infra Red Receiver. So I went to my favorite electronics shop and inquired for Infra Red components. I got one IR LED and one IR Receiver (TSOP1738)
TSOP1738 Manual Here

IR Reciver Pinout:



Surprising to me this Receiver was very cheap (converted to US$ 0.40$), when I checked some circuit ideas online only this IR receiver + Teensy was needed in the circuit.

The Teensy Pinout for Arduino is as shown bellow





The circuit is so simple. Just connected GND to GND Pin of Teensy and Vs to +5v pin of Teensy.
Pardon me for such rough circuit diagram but , I didnt thought I should waste more time in circuit diagram of so simple circuit. If any one has some doubts drop me a comment and I would provide answer to queries.

Rough Circuit Diagram





After that there I used a sample program that comes with IR Library with little but modification to blink built in LED on the Teensy Bord. This Infrared dump program can be find HERE
Then I pressed buttons of Remote and Noted down the Code received by IR Circuit.

Then I wrote a new program that can control the Media Player Classic which I use to watch movies. I coded shortcut keys used by Media Player Classic in my program and executed them when received the particular code of the Remote Key.

Then I remember reading somewhere that Teensy can also move mouse. So I went ahead and mapped the Remote Directional keys to mouse. I used Mouse.move(x,y) function and mapped 4 movements of mouse to the four directional keys found on my Remote.

So the is TV remote used to control Media Player Classic and also Mouse Movement on PC.

My Code can downloaded HERE

Photo of my Circuit looks like bellow