pypt-offline 0.6.Beta Released

I’m happy that a new release has been possible.

This new release is almost a complete re-write and has many fixes and features.

For details, visit:

http://pypt-offline.sf.net

There’s also a small HOWTO about pypt-offline

Cheers!

Ritesh

pypt-offline – An Offline Package Manager
(C) 2005, 2006 Ritesh Raj Sarraf rrs@researchut.com

INTRODUCTION

So you’ve decided to give this small piece of work a try.
Good ! Let’s get it done faster.

pypt-offline is an offline package management tool written in the Python Programming Language. This program, as of now, is intended for people using Debian (And Debian based) systems.

[Read More]
Categories: Tools 

Software Suspend 2 with root/swap on LVM

Disclaimer: YMMV

I had always had failures with Software Suspend 2 (swsusp2) on my laptop because of which I had a perception that it really wasn’t ready for use for beta users also. But recently after reading the comments of many users on LWN I felt how wrong I actuall was.

Anyways, setting up swsusp2 with root/swap on LVM is a little tricky. From my past experience I’ve felt that to be the major reason for me to not able to use this excellent feature.

[Read More]
Categories: Debian-Pages Tools 

Creative Destructivity

Creative Destructivity by Raghavendra Buddi

Categories: Fun 

Good Morning

Good Morning. Good Food. Good Place…….

Finally, I ended up with a change.

Categories: Psyche 

Debugging Techniques

Abnormal Program Termination are not something just seen on Microsoft Windows. I hope most users will have seen some kind of program error in GNU/Linux and *BSD platforms also.

Abnormal Program Termination can happen for multiple reasons of which Programming Errors are one of the major reasons. Badly Carelessly written programs often end up having such bugs.

Here’s a sample C program which has generic programming errors because of which the compiler doesn’t catch it but the program does do unexpected behavior.

[Read More]
Categories: Programming 

Bash Endless Loop

I always keep forgetting where the colon (;) key should be placed in a Bash endless loop so thought of jotting it down.

while true; do ls; done

Categories: Programming 

Pivot at its best

It really is amazing to see no more spam coming to my blog. Kudos to the Pivot team who’ve done a great job integrating spam features into this great software. Also the spam cleanup utility (integrated into the application) is excellent. Thanks.

Categories: Tools 

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
Categories: Programming 

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() 
Categories: Fun Programming