Hey!
As you may have expected because of the delay of my posts I got bored. Utterly bored. And what do you do when you are bored? Exactly, you write Python scripts! (Well, atleast I do)
On Python-Forum I already read sometimes about the attempts to realize a Python script which is extendable through plugins and quickly got myself interested aswell.
I wrote pyEnv. Python Environment, or short pyEnv, is an extendable Python-shell which allows you to easily add functionality to the shell by writing plugins.
pyEnv.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| #!/usr/bin/python
import types
import os
class pyEnv(object):
def __init__(self):
self.commands = {}
for plugin in self.plugins:
plugin = __import__(os.path.join('plugins', plugin))
for key, value in plugin.__dict__.iteritems():
if type(value) == types.FunctionType:
self.register_command(key, value)
def register_command(self, command, callback):
if not self.commands.has_key(command):
self.commands[command] = callback
def parse(self, string):
tokens = string.split()
command = tokens[0].lower()
if self.commands.has_key(command):
try:
self.commands[command](tokens[1:], self)
except (TypeError):
try:
self.commands[command](tokens[1:])
except (Exception), error:
print 'Error: %s' % error
@property
def plugins(self):
plugins = []
for file in os.listdir(os.path.join('plugins')):
if not file.startswith('__') and file.endswith('.py'):
plugins.append(file.split('.py')[0])
return plugins
pyenv = pyEnv()
while True:
command = str(raw_input('>>> '))
if command:
pyenv.parse(command) |
You simply need to create a new sub-folder called “plugins” and drop your scripts there. To use a function you defined in one of your scripts simply type its name:
>>> commands test1 test2 test3
commands
You passed me the following arguments:
test1
test2
test3
>>>
The sample function used above looks like this:
1
2
3
4
5
6
7
| def commands(args, pyenv):
for key in pyenv.commands.iterkeys():
print key
print '\nYou passed me the following arguments:'
for arg in args:
print arg |
As you can see you have direct access to the pyEnv object which called the function and you have easily acces to all arguments passed to the function via the shell. In case you don’t need the pyEnv object in your function simply define the function to use only the args parameter:
1
2
3
| def function(args):
for arg in args:
print args |
Greetz,
CracKPod
When I used Windows a good friend of mine, Chrysler, wrote a great little application for me that allowed me to easily upload a bunch of files via the context-menu. I painfully missed something similiar to this in Ubuntu and therefore I simply wrote my own solution, as you could have guessed, in Python.

How to integrate these scripts in Nautilus
- Download speedyshare.zip and imagebanana.zip.
- Extract the contents of both archives wherever you want to.
I chose to create a “.scripts” folder in “~/.gnome2/nautilus-scripts”.
- Create a symbolic link for SpeedyShare.py and ImageBanana.py in
“~/.gnome2/nautilus-scripts”.
You can find further information about those scripts at the “Projects” page.
You should be done. If you choose only one file to upload your Browser should open the URL to the uploaded file, in case you choose more, a new file called “Uploads.txt” will be created in the same directory with links to the uploaded files in it.
The webservices which the files get uploaded to are ImageBanana (for images) and SpeedyShare (for files up to 30 mb).
Later versions may support uploading whole folders.
PS: When you try to use the scripts via the context-menu directly from the desktop it won’t work. Apparently Nautilus doesn’t pass the file location as an argument to SpeedyShare.py or ImageBanana.py, you need to open Nautilus to use them.
CracKPod
Recently I stumbled upon Wuala. It is currently still in Alpha but it’s already more or less usable and works on Windows, MAC and Linux.
So what is Wuala?
Computer science dream
The idea behind Wuala is not new. In fact, organizing idle resources of unreliable computers into a large, reliable and secure distributed online storage has been an old dream of computer science. When we started back in fall 2004 at the Swiss Federal Institute of Technology (ETH Zurich), it was our vision to realize this dream - today, we think we’ve taken the first step. Because idle resources are used whenever possible, we can offer you a better service for free.
Idle resources
Instead of centralized servers, Wuala uses the idle resources (storage and bandwidth) of computers of its users who can opt to trade their local storage for online storage. Note that not everybody has to offer local storage and in fact, not everyone can. Local storage is only useful to the system if the computer is online more than 17% of the time on average (about 4 hours a day). Only when you meet this requirement, you are allowed to trade your local storage for more online storage. But even if you do not contribute, we give you 1 GB of free online storage which is already enough for most purposes.
Incentives
The more local storage you provide, the more online storage you get, depending on your online time (e.g., if you provide 10 GB of your local storage and you are online 70% of the time, you get 7 GB of additional online storage). Please note that Wuala doesn’t give you more storage in total, but that it changes the quality of your storage: It is able to transform local storage into online storage that can be accessed from anywhere and at any time, even when your computer is offline. The incentive for providing upload bandwidth is similar: The more upload bandwidth you provide, the faster your download speed will be.
Security
Security is a key design issue in Wuala: All files stored in Wuala are encrypted and all cryptographic operations are performed locally. Your password never leaves your computer - so no one, including us, can access your files unless you publish them. Wuala employs the 128 bit AES algorithm for encryption and the 2048 bit RSA algorithm for authentication.
Reliability
In order to achieve high reliability, all files are stored redundantly, using so-called erasure codes. This also allows for fast downloads since your computer can download many pieces of the same file in parallel from different sources. In case that a file cannot be found in the network at a certain time, we store an encrypted backup of every file on our servers. Furthermore, your computer keeps a copy (also encrypted) of all your files in its local cache. This not only allows fast local access to your files, but it also allows your computer to take care of your stored files and automatically re-upload them if necessary. You can decide, of course, which of your computers should keep the backup (e.g. your desktop PC, not your laptop).
To get to know more about Wuala I suggest you to take a look at this Google TechTalk.
CracKPod
Hey, I found by chance this great Python script which allows you to convert your Python source code into valid highlighted HTML.
A with pyColorize highlighted version of my pyTiddlyWiki module can be found here. I applied the PyDev syntax highlighting colors. In case you don’t want to use the standard colorize.css but the PyDev colors simply replace the content of your colorize.css with the following:
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
32
33
34
35
36
37
| pre
{
font-face: verdana, arial, helvetica, sans-serif;
}
.token_number
{
color: #800000;
}
.token_op
{
color: #000000;
}
.token_string
{
color: #00AA00;
}
.token_comment
{
color: #C0C0C0;
}
.token_name
{
color: #000000;
}
.token_error
{
color: #FF8080;
}
.keyword
{
color: #0000FF;
font-weight:bold;
}
.text
{
color: #000000;
} |
CracKPod
Yay! Thanks to flo I’ve got a new, cool, elegant and clean banner which really improves the looks of my Blog.

After seeing that amazing piece of art you can’t deny that he’s a genius if it comes to designing things, can you? Well flo, what can I say? Seems like studying design paid off in the end (atleast for me *hehe*).
CracKPod
PS:
I’ll warn you beforehand: In case I find by chance something that looks strangely similiar to flo’s work, I’ll somehow find out your adress, pay you a visit and break your neck. So don’t worry, you’ll notice soon enough if you’ve done something that I didn’t want you to. 
pyTiddlyWiki is a Python module which allows you to interact with your TiddlyWiki. You can easily edit already present Tiddlers, create new Tiddlers and delete Tiddlers you don’t want to keep anymore.
pyTiddlyWiki tries to act similiar to the TiddlyWiki itself. For example if you did the following:
1
2
3
4
5
6
7
| #!/usr/bin/python
import pyTiddlyWiki
tiddlywiki = pyTiddlyWiki.TiddlyWiki('TiddlyWiki.html')
tiddlywiki.new_tiddler()
tiddlywiki.save() |
pyTiddlyWiki would create exactly the same Tiddler which would have been created if you had done it through the browser interface. For more information on how to use this module visit the “Projects” page.
CracKPod
Hehe,
I got one of my friends, flo, to take a closer look at Python. Seems like he made already some progress and wrote some little scripts. I’m already eager to see how this will turn out.
In case you want to learn Python aswell I can recommend you A Byte of Python.
Although it’s already rather old it’s still great to make your first steps in Python.
There’s also a german version.
CracKPod
When I recently tried to download files with Python I found out that it is really simple. The most easiest way in my opinion is the following:
1
2
3
4
5
6
| #!/usr/bin/python
import urllib
urllib.urlretrieve('http://www.website.com/logo.gif',
'logo.gif') |
If you’ve got the module “mechanize” installed it’s quite similiar. Additionally in mechanize there is a class available called “Browser” which supports comfortable downloading of files aswell as the module itself:
1
2
3
4
5
6
7
8
9
10
| #!/usr/bin/python
import mechanize
mechanize.urlretrieve('http://www.website.com/logo.gif',
'logo.gif')
browser = mechanize.Browser()
browser.retrieve('http://www.website.com/logo.gif',
'logo.gif') |
And there’s still a third way which doesn’t rely on the “urlretrieve” function nor the “retrieve” method from “mechanize.Browser”:
1
2
3
4
5
6
7
8
| #!/usr/bin/python
import urllib
webfile = urllib.urlopen('http://www.website.com/logo.gif')
localfile = open('logo.gif', 'w')
localfile.write(webfile.read())
localfile.close() |
I wouldn’t recommend the third way, since the file you are downloading is stored completely in your RAM until you finished your download which can cause performance problems if you’ve got little RAM.
The “urllib” module and the “mechanize” module work differently. They download the file bit by bit and save each bit to the hard disk instead of storing it completely in your RAM until the download is finished.
CracKPod
Before I switched over to Ubuntu I used to use ComicRack to read my Mangas. Of course I could have tried to run it with Wine, but why? There is already a great solution available for Linux-based operating-systems: Comix!
Comix currently features:
- Fullscreen mode.
- Double page mode.
- Fit-to-screen, fit width and fit height modes.
- more …
If you use Ubuntu simply run the following command to install Comix:
1
| sudo apt-get install comix |
In case you want to open *.rar files you’ll need the additional package “unrar”, which you can install by running the following command:
1
| sudo apt-get install unrar |
![Comix - GTK Comic Book Viewer [screenshots] Comix - GTK Comic Book Viewer [screenshots]](http://crackpod.bplaced.net/wp-content/uploads/2008/07/comix-300x240.png)
More screenshots can be found here.
CracKPod
RSSOwl is a Java RSS / RDF / Atom Agreggator which I already use for years now. In my opinion it’s the best Newsreader out there because:
- It is completely free, since it’s open source
- It supports RSS / RDF / Atom Feeds
- It is cross-platform. In other words it runs on:
- Windows
- Linux
- Mac OS X
- Solaris
- more …

I mainly use it to keep track of new Anime & Manga releases.
CracKPod
Recent Comments