Python Crawler
Posted on April 16, 2006
(Last modified on June 25, 2011)
| 1 minutes
| 192 words
|
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.
[Read More]Pythonic Addiction
Posted on April 15, 2006
(Last modified on January 22, 2011)
| 1 minutes
| 140 words
|
#!/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.
[Read More]iprint - Andrew "Tridge" Tridgell's iprint in Python
Posted on February 5, 2006
(Last modified on January 22, 2011)
| 1 minutes
| 94 words
|
Following code does the same thing that Tridge’s iprint.c does.
#!/usr/bin/env python import sys "iprint - Andrew \"Tridge\" Tridgell's iprint in Python" def toBinary(dec): """ This function does the coversion from integer to binary """ bin = '' while dec: bin = (dec % 2 and '1' or '0') + bin dec = long(dec/2) return bin or '0' x = 1 text = '' while len(sys.argv) > 1 and x < len(sys.
[Read More]Python Fun
Posted on September 19, 2005
(Last modified on January 22, 2011)
| 1 minutes
| 34 words
|
Just think what all this small piece of code can do
while x <= 100:
… temp = urllib2.urlopen(address+prefix+str(x)+suffix)
… data = open(prefix+str(x)+suffix, ‘wb’ )
… data.write(temp.read())
… data.close()
… temp.close()
… x +=1
Who says GUI Programming in shell is difficult ?
Posted on July 7, 2005
(Last modified on January 22, 2011)
| 2 minutes
| 380 words
|
Today, I wanted a quick utility to help me enter passwords for encfs during mount.
I was looking for something plain, simple and userfriendly.
At the end I ended up to use the shell for it.
Yes, using dialog/Xdialog you can be a GUI programmer in minutes.
If the text is scrambled, you can download the script here.
Cheers!
#!/bin/bash 1. encfsmount - A simple frontend for encfs 2. (C) Ritesh Raj Sarraf July 2005 1.
[Read More]