Category Archives: Python

Generating md5 encrypted password for chpasswd

If you want to generate properly encrypted password to feed to chpasswd, the most easier and proper way is to do that from command line : [code lang="bash"] echo "encryptedpassword"|openssl passwd -1 -stdin [/code] If you want to generate in … Continue reading

Posted in Programming, Python, Scripts, Solaris, Travel | 3 Comments

Cheetah Mode for Emacs

Here is a simple html derived mode for Cheetah templates files. The font-locking regexp can be improved thought but that’s a start. (define-derived-mode cheetah-mode html-mode "Cheetah" (make-face ‘cheetah-variable-face) (font-lock-add-keywords nil ‘( ("\\(#\\(from\\|else\\|include\\|set\\|import\\|for\\|if\\|end\\)+\\)\\>" 1 font-lock-type-face) ("\\(#\\(from\\|for\\|end\\)\\).*\\<\\(for\\|import\\|if\\|in\\)\\>" 3 font-lock-type-face) ("\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)" 1 font-lock-variable-name-face)) … Continue reading

Posted in Emacs, Python | 1 Comment

Assignement in Python with list.extend()

This is weird for me : d = [’foo’, ‘bar’, ‘ba’, ‘c’] print d f = d f.extend(d) print d give me the result -*- mode: compilation; default-directory: “/tmp/” -*- Compilation started at Mon Jul 31 16:49:41 python “/tmp/a.py” [‘foo’, … Continue reading

Posted in Python | Leave a comment

Jabber/Asterisk and Gajim notification

At work we are using Asterisk and Jabber and i am using Gajim as my client. I did a quick patch to have a notification on my desktop when someone call me and i get my big headphones (not that … Continue reading

Posted in Misc, Programming, Python | Leave a comment

Python 2.5 Beta

I have been looking at the What’s new of Python 2.5. There is some cool features inside it : Conditional Expressions: This stuff basically allow to do standard C idiom (that we found in every kind of derivative language) like … Continue reading

Posted in Python | 2 Comments