Saturday, January 14, 2012
python script to download files via google search
When thinking I suddenly remember that I had coded such a script some time ago using xgoogle libray of python. So I just searched for my script and here it is.
As you know I am lazy, I have used xgoogle and not directly handle google via httplib or urllib etc etc. My script used getopt library to parse the options given to the script. (again I am lazy)
(xgoogle library can be downloaded at http://www.catonmat.net/blog/python-library-for-google-search/)
The general syntax of this script is
python gsrchDwn.py --query "query_text" [--ftype file_extension] [--cnt contine_result_number] [--dir download_dir]
usage: python gsrchDwn.py --query maths made easy --ftype pdf
IMP Notes
1)It proper results are not got try the query in " (double quotes)
2) This file need xgoogle library found at http://www.catonmat.net/blog/python-library-for-google-search/
If --dir is not given it will download files into current directory.
If the script is stopped inbetween you can continue from the last result number by using --cnt result_number
This time I am have become a good boy and also added a status printing which shows how much percentage of current file is downlaoded.
grsrchDwn.py can be downloaded HERE
Let me know any comments.
Monday, December 5, 2011
Python script to check valid email addresses
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
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
Tuesday, September 20, 2011
Automate irritating ISP login
loginURL = "http://login.example.com" # URL to Login form of ISP site
loginID = "myUserName" # ISP user nameloginPassword = "mYp4ssw0rd" # ISP Password
loginFormName = "loginForm"
successString = """NOW ACTIVATING YOUR SERVICES"""
Monday, September 12, 2011
SL4A:The Scripting Layer for Android
interpreters. In order to make practical use of SL4A, we will need atleast
the rudiments of one high-level scripting language such as Python, Ruby, Perl, Lua,
JavaScript, or BeanShell.
For me it meant ability to create and run python scripts on my phone without having to ROOT the phone. It makes possible to use lots of GUI like Checkboxes, Radio buttons, Inputbox very easily. I checked out some sample scripts and they were small and simple scripts just like normal python.
For ex. only 4 lines code was able to speak time using text-to-speech engine. Mind it two lines of them were import statements :D
import android
import time
droid = android.Android()
droid.ttsSpeak(time.strftime("%_I %M %p on %A, %B %_e, %Y "))
I found out about python scripting on android after months of buying the android phone :D
I feel ashamed of myself for not finding out this long ago. Well there were some battery problems with phone so had to give it back to service center two times. But it feels great now.
Better than that it allows directly creating & editing the scripts directly on phone also :-D
So I would be starting some scripting on python. If done anything interesting I will post it.
Wednesday, November 3, 2010
What not to do...Job Seekers
and offcourse some to do...
Well I have seen a large number of Resumes and also taken interivew of lots of candidates. I wanted to give some thoughts about to do / not to do about the resume, telephonic conversation, interviews. Others are welcome to add / discuss any points.
Resume
1) Keep your point wise
a. Don’t keep paragraphs of information regarding your skills or background.
b. Always keep information point wise.
2) Highlight the key skills for the job for which you are applying. If you looking jobs in multiple fields (Ex. Developer / Tester / Etc.) keep different resume ready for each field. Each field would have some different skills which you need to highlight.
3) Don’t put too much of information in resume. Also what ever tool / skill / project you have put in to your resume you should be able to answers any question regarding to that.
4) In my experience half of the interview questions would come from what you have written in the resume.
Telephonic Conversations
1) Be professional always ask the basic information like job profile , job location in the first place.
2) If the job profile and job location meets your need then only take forward the talks. Other wise you would be wasting your and other party’s time as well.
3) Always make a note of Name of the person with whom you had conversation for future reference
4) When you give time to any person for telephonic conversation, keep you mobile reachable, well charged. Its not good to give these reasons for not attending the call.
Face to Face Interview
1. Do dress decently in official dress.
i. Even if the office is using casual dresses
ii. Interview is not the place to show off with casuals
2. Carry a copy of resume with you and 2 photographs even if not asked by the company. You don’t know when they would come in handy
3. Do ask permission before going in to the interview room
4. Do not seat down before you are asked to do so
5. If interviewer offer shake-hand give a firm shake-hand.
6. Listen carefully to the question asked , if you don’t able to listen to a question politely ask to repeat the question
7. But don’t ask every time to repeat the question , some time its ok not every time.
8. Do answer with truth, if you don’t know any thing admit it that you don’t know it. No one is perfect.
9. Study the basics well before going for interview.
i. Ex. If you going for Developer interview you should know the basics of the programming language.
ii. If you going for Networking / Security profile your networking knowledge should be sound. (Ex TCPIP / ISO Layers etc). For a fresher at-least there is no excuse to Not have knowledge of TCPIP
Tuesday, March 30, 2010
Hide text in notepad
After some busy weeks, I am back. I had discussion with my regarding hiding text in the txt file using the notepad. So I am giving here the way by using which any text can be hidden in the notepad and you can have your own password for the hidden text also.
If you already dont know this go forwarding reading...
In windows you can hide some text in the txt file using only notepad and no other tool.
The way to do is ...
use following command to create a text file..
go to any specific folder of your choice in cmd prompt,
type command
notepad secret.txt:thisismypassword
Notepad will ask "Do you want to create a new file?"
Click "Yes"
Now the title bar of notepad should read like
secret.txt:thisismypassword.txt - Notepad
Edit and enter any text in this notepad file.
Close this file.
Go to windows explorer and navigate to that specific folder you will see only one file
secret.txt.
If you open this file you will see blank. You can enter any garbage in this secret.txt also and save it. It will not change your secrte data which was entered earlier.
To reopen the secrete data type same command again
notepad secret.txt:thisismypassword
You will see your data again. When opening file like this you can edit it and change your secrete data.
P.S. Regards to Cybercrawler for his posts