RESEARCHUT
Minds With Innovations

RESEARCHUT - minds with innovations

Search!

Archives

Next Archive Previous Archive

01 Jun - 30 Jun 2005
01 Jul - 31 Jul 2005
01 Aug - 31 Aug 2005
01 Sep - 30 Sep 2005
01 Oct - 31 Oct 2005
01 Dec - 31 Dec 2005
01 Jan - 31 Jan 2006
01 Feb - 28 Feb 2006
01 Mar - 31 Mar 2006
01 Apr - 30 Apr 2006
01 May - 31 May 2006
01 Jun - 30 Jun 2006
01 Jul - 31 Jul 2006
01 Aug - 31 Aug 2006
01 Oct - 31 Oct 2006
01 Nov - 30 Nov 2006
01 Dec - 31 Dec 2006
01 Jan - 31 Jan 2007
01 Mar - 31 Mar 2007
01 Apr - 30 Apr 2007
01 May - 31 May 2007
01 Jul - 31 Jul 2007
01 Aug - 31 Aug 2007
01 Oct - 31 Oct 2007
01 Nov - 30 Nov 2007
01 Jan - 31 Jan 2008
01 Feb - 29 Feb 2008
01 Mar - 31 Mar 2008
01 Apr - 30 Apr 2008
01 May - 31 May 2008
01 Jun - 30 Jun 2008
01 Jul - 31 Jul 2008
01 Aug - 31 Aug 2008

Categories

Fun
KDE
Sex
Rant
News
Debian
Romance
Computer
Software
Philosophy
Technology
Programming

About

A space which could be philosophic, energetic, poetic, technic, mantic, idealistic, frenetic and sarcastic at times,
I guess!


Copyright © Ritesh Raj Sarraf

Unless specifically stated otherwise, the information on this page is available under the terms of the
GNU Free Documentation License.

Calendar

« March 2010
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Links

RESEARCHUT
Technical Consultancy
Photo Gallery
About Me

Last Comments

Ashish Shukla (Boston, MA): So, are you also going to …
Ravi (Boston, MA): How did they allow you? BT…
Ritesh (Lambroghini Drink…): Stopped != Quit Blame th…
Ravi (Lambroghini Drink…): Someone said that you stop…
Ritesh Raj Sarraf… (KDE4 with KDE3): Sorry. One more important …

Powered By

Powered by Pivot - 1.40.6: 'Dreadwind'
XML: RSS Feed
XML: Atom Feed
Pivot Blacklist
Powered by Debian

Linkdump

+ 7 - 4 | § iprint in mod_python

This small script demonstrates mod_python.

Used tags: , ,

Keywords: Python,iprint,mod_python

+ 7 - 4 | § Python Crawler

This IMO is one of the dirtiest way for me up till now to accomplish a requirement. But it does the job I want. :D

 DISCLAIMER: I'm a learner. There must be better, smarter and easier way to accomplish the same task.

rrs@learner:~/My_Documents/My Books $ cat /home/rrs/devel/eclipse/PythonFun/web_pattern_fetcher.py

#!/usr/bin/env python

"""
This tiny little script does the job of crawling into Apache generated directory listings
and download scanning a specific pattern.
I'm using it to download anything that apache shows as TXT or IMG.
I'm sure others will be able to extend it more.
"""

import urllib, urllib2, string

url = "http://www.wuppy.net.ru/Fun/"
req = urllib2.Request(url)
handle = urllib2.urlopen(req)

x = 1
data = ''

while x:
    data = ''
    line = handle.readline()
    if "[TXT]" in line or "[IMG]" in line:
        word_list = line.split(' ')
        word = word_list[4:5]
        req_word = str(word)
        # Break and take out the relevant data uri
        begin_num = req_word.find(">")
        end_num = req_word.find("</A" )
        req_word = list(req_word)
        while begin_num < end_num - 1:
            final_word = string.lstrip( string.rstrip(str(req_word[begin_num+1:begin_num+2]), "']"), "['")
            data += final_word
            begin_num += 1
            #data.append(req_word[begin_num+1:begin_num+2])
        real_url = url + data
        urllib.urlretrieve(real_url, data)
    if line == '':
        x = 0

Used tags: , ,

Keywords: Python,Web_Crawler,web_pattern_fetcher.py

+ 2 - 9 | § Pythonic Addiction

#!/usr/bin/env python

def files(root):
    for path, folders, files in os.walk(root):
        for file in files:
            yield path, file


def find_match(repository): # aka walk_tree_copy()
    for path, file in files(repository):
        if file.endswith ('html') or file.endswith ('htm') or file.endswith ('HTML') or file.endswith ('HTM'):
        #if file.endswith ('html.gz') or file.endswith ('htm.gz') or file.endswith ('HTML.gz') or file.endswith ('HTM.gz'):
            try:
                os.environ['__TEMP__VAL'] = file
                os.chdir(path) # We need to chdir so that gzip can see the file in the cwd
                os.system('gzip $__TEMP__VAL')
                sys.stdout.write("%s/%s has been gzipped\n" % (path, file))
            except IOError:
                sys.stdout.write("Aieeeee.... I got some error with %s!\n\n" % (file))
            continue
            #return True
    return False


def main():
    REPOSITORY = raw_input("Please enter a path to look for the files to zip.\nHit Return Key if you want the default path i.e. \"/home/rrs/My_Documents/My Books\"")

    if REPOSITORY == '':
        REPOSITORY = "/home/rrs/My_Documents/My Books/"

    find_match(REPOSITORY)

if __name__ == '__main__':
    import os, sys, shutil
    main() Used tags: ,

Keywords: Python,change_extension.py

+ 7 - 6 | § Ritesh Sarraf Ticketed Again

Ritesh Sarraf Ticketed Again

Used tags: , , ,

Keywords: Ticketed,Sleep,Workplace,Insomnia

- Powered by vIm && Mozilla - Best viewed with your eyes