ejes consulting

Techincal Consulting Design and Automation

deployment.py

leave a comment »

#!/usr/local/bin/python

# <100,000 obsure
# 100,000-999,999 moderate
# 1,000,000 < 100,000,000 significat
# >100,000,000 very broad

import re,sys,os,urllib

if len(sys.argv)==1:
        print ‘Usage:\n%s “Search Term”\n’ % sys.argv[0]
        sys.exit(-1)

url=’http://www.google.ca/search?q=%22’+urllib.quote(sys.argv%5B1%5D)+’%22&start=0&ie=utf-8&oe=utf-8&hl=xx-hacker&client=firefox-a&rls=org.mozilla:en-US:official&#8217;

(cstdin,cstdout,cstderr)=os.popen3(‘lynx -accept_all_cookies -dump ‘+url)

i=0
for code in cstdout.readlines():
        if re.compile(‘of about ‘).search(code):
                s=re.sub(‘(^.*of about | for.*\r?\n|,)’,”,code)
                i=int(s)

cstdin.close()
cstdout.close()
cstderr.close()

if i>100000000:
        print ‘Very Broadly Deployed (‘+str(i)+’ google hits)’
elif i>1000000:
        print ‘Significantly Deployed (‘+str(i)+’ google hits)’
elif i>100000:
        print ‘Moderately Deployed (‘+str(i)+’ google hits)’
else:
        print ‘Totaly Obsure (‘+str(i)+’ google hits)’

Advertisements

Written by ejes

August 24, 2009 at 12:26 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: