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-
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)”
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-
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”
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
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
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)”
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”