Apr 05 2009

My memo -cheatsheet- page

Tags:, , , , , , , , , , Ignace Mouzannar (ghantoos) @ 2:54 pm

I have added a new page to my blog today. It lists commands/tips I collected over the past couple of month. I will be updating it every once in while.

Please don’t hesitate to comment suggesting/correcting commands :)

I hope this can be useful!

Cheers,
Ignace M -ghantoos-


Oct 19 2008

Creating a .deb package from a python setup.py

Tags:, , , , , , , Ignace Mouzannar (ghantoos) @ 10:09 pm

This article has been updated on July 2nd 2009.

As I worked on packaging a project I am working on (Limited Shell) I found my self reading many tutorials on how to build debian packages. But none where related to distutils setup.py. As a nice setup.py natively knows how to package RPM, I thought about a way to include setup.py in a .deb generation.

Here is a small guide to help generate a debian package from a distutils/setuptools setup.py.

The main steps of this procedure are:
1- make sure that your setup.py is functional
2- generate a GPG key to sign your package and a public key to put on your server or wherever
3- create the files that are useful for the debian packaging:
* debian/changelog
* debian/compat
* debian/control
* debian/copyright
* debian/rules
* debian/watch
4- write the Makefile
5- generate your debian package
6- check your files’ licensing
7- check your new package using lintian
8- Conclusion
9- Links

Continue reading “Creating a .deb package from a python setup.py”


Sep 28 2008

YUM output parser (yum-parser.py)

Tags:, , , , , Ignace Mouzannar (ghantoos) @ 7:51 pm

As I needed to minimize yum’s output for a project I was working on, I thought it was just about changing the debugging level. But I found out yum’s debugging level could add information, but not minimize it. So wrote a small python script that does the job.

What I wanted to do, is replace yum’s output with a very simple progress bar showing only the different stages of a yum procedure (dependencies/download/install/remove/update).

The script is quite easy to use:

Usage:
	$ yum-parser.py (-u | --update)
	$ yum-parser.py (-i | --install) package_list
	$ yum-parser.py (-r | --remove) package_list
	$ yum-parser.py (-s | --search) 'regexp'
	$ yum-parser.py (-h | --help) package_list

For a reason I still ignore, when redirecting yum’s generic output to a file (e.g. yum -y install irssi 2>&1 > yumoutput), the “Downloading Packages” part doesn’t appear. To remedy this problem, I had to insert some threading to have a “patience bar” (i.e. back and forth [ = ]) while the downloads are processed.

You can find the source code here.

Continue reading “YUM output parser (yum-parser.py)”


Jan 29 2008

Limited Shell (lshell)

Tags:, , , , Ignace Mouzannar (ghantoos) @ 11:42 am

As I was wondering how I could do to relieve my wrt54gl from the huge weight of libopenssl and nsupdate, I thought.. Wouldn’t it be cool if I could set a very restricted account on my server, and just ask my wrt54gl to ssh to it and execute locally nsupdate. So I started searching for a way to restrict user ssh accounts by listing a set a allowed commands. No luck there.

So.. python came to the rescue.

Limited Shell (lshell) is an application that lets you restrict the environment of any SSH user. It provides an easily configurable shell: just choose a list of allowed commands for every limited account. No installation is required.

You can download the current version of lshell from the following link: http://sourceforge.net/project/showfiles.php?group_id=215792

If you want to contribute to this project, please do not hesitate.
Send me a patch, or just your new lshell.py so I can check it out.
You can use the interface on sourceforge.net:
http://sourceforge.net/projects/lshell/

Cheers,
Ignace M -ghantoos-


Nov 22 2007

Nokia N70 (S60 series), python and your PC

Tags:, , , , Ignace Mouzannar (ghantoos) @ 4:21 pm

Here is a small briefing of how to connect your Nokia S60 series and your PC through bluetooth:
1- to send a file to your mobile
2- to get your mobile python console on your box!

Continue reading “Nokia N70 (S60 series), python and your PC”


Oct 25 2007

python: pyExcelerator module very little howto

Tags:, , , , Ignace Mouzannar (ghantoos) @ 5:02 pm

As a small reminder for myself, I post the thread about pyExcelerator.

pyExcelerator is a nice little python module that let’s you write Excel files (not openOffice spreadsheet, the other kind..).

For Ubuntu users, it is very easy to install: sudo apt-get install python-excelerator

Here basic script to write in ‘Hello World!’ excel file:

#!/usr/bin/env python    

import os
from pyExcelerator import *    

curpath = os.path.dirname(__file__)   

workbook = Workbook()
worksheet = workbook.add_sheet('My colour Sheet')
worksheet.write(0,0, 'Hello World!')
workbook.save(os.path.join(curpath, 'test.xls'))

Continue reading “python: pyExcelerator module very little howto”


Oct 05 2007

HOWTO: apache2 & mod_python.psp

Tags:, , , , , , , Ignace Mouzannar (ghantoos) @ 12:03 am

Here is a second howto about the PSP handler of mod_python.

Hope this is useful!

http://ghantoos.org/index.php/howto-apache2-mod_python/#mod_python.psp

Cheers,

Ghantoos


Sep 29 2007

HOWTO: apache2 & mod_python.publisher

Tags:, , , Ignace Mouzannar (ghantoos) @ 8:20 pm

After a bit of research and some debugging time, and as i couldn’t find obvious mod_python howtos, I decided to write a little Apache2/mod_python.publisher howto.

http://ghantoos.org/index.php/howto-apache2-mod_python/

Cheers,

Ghantoos


Sep 18 2007

NextGen Gallery SQL script (to scan folders and add them as galleries)

Tags:, , , , , , , , Ignace Mouzannar (ghantoos) @ 5:51 pm

This time I needed this time to provision the NextGen SQL database with all the folders I’ve put on my server.

Again, i did a little python script. I scans your NextGen gallery folder, and enters all new folders as “galleries” in the SQL DB, and creates the thumbs for the pictures.

This was usefull for me. : )

You can download the script here.
Continue reading “NextGen Gallery SQL script (to scan folders and add them as galleries)”


Sep 14 2007

Picture database recursive copier/resizer

Tags:, , , , , , , Ignace Mouzannar (ghantoos) @ 4:33 pm

That a little script I did yesterday because I needed to copy my 35gig picture gallery in a new directory then resize all the pictures.

Of course, this MUST not be done “à la mano”! So i did a little python script. : ) Here it is, hope you find it of any interest.

You can download the script here.
Continue reading “Picture database recursive copier/resizer”