How to connect to Rackspace Cloud Files via ServiceNET

If you are a Rackspace customer and you are are planning to use Rackspace Cloud Files via it’s internal network (ServiceNet) so you don’t get billed for the bandwidth going over Cloud Files this is how you can do. The first thing is to make sure with your support team if your servers are connected to ServiceNet and if […]

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 pure python you can do it like that : [code lang=”python”] def md5crypt(password, salt, magic=’$1$’): […]

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\\)\\).*\\” 3 font-lock-type-face) (“\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)” 1 font-lock-variable-name-face)) ) (font-lock-mode 1) ) (setq auto-mode-alist (cons ‘( “\\.tmpl\\'” . cheetah-mode ) auto-mode-alist ))

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’, ‘bar’, ‘ba’, ‘c’] [‘foo’, ‘bar’, ‘ba’, ‘c’, ‘foo’, ‘bar’, ‘ba’, ‘c’] Compilation finished at Mon […]

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 a = condition ? “true” : “false” the weird part is that Guido Van-Rossum implemented […]