Slovenian Gentoo community mirror introduction

underEnglish, Mirror, Gentoo, Community, Server

I'm very happy first stage of my Gentoo mirror project is done. More information about server, how to use it with Gentoo and statitics can be read here Server is an old box of my girlfriend (thanks!). The box used to have issues with rebooting during ubuntu gnome session, I hope it was graphic's card fault (no graphic desktop is running now). Consider this beta testing period, spread the world of Slovenian Gentoo mirror! Link is 50/50mbit FTTH. Current location of server is temporary, until I find free provider to sponzor full 100mbit link. Leave any questions at domen[AT]dev.si

pickle and cStringIO

underEnglish, Python, Oss

More of a note to myself: You just cannot (I guess because of lacking proper pickling C API support) pickle cStringIO.StringIO instances. Use StringIO.StringIO instead.

Small update to wbus.fubar.si

underEnglish, Python, Wbus, Pylons, Lpp

As most of you already know, I have small wap site running to check when LPP bus is coming to a bus station in Ljubljana. Today I added name of direction for each bus. Happy puncual days! link

upcoming project: spaces

underEnglish

I have been thinking about my development issue for a while. Working on many projects and quick switching is a pain. I could not find a solution that even thouches this subject, so I started my own development project management called spaces. Here is the basic configuration file (in YAML) that already works: --- !project name: gspaces --- !chromium-browser urls: - http://docs.python.org/dev/library/logging.html - http://docs.python.org/dev/library/subprocess.html - http://docs.python.org/dev/library/optparse.html - http://en.wikipedia.org/wiki/YAML#Basic_components_of_YAML - http://docs.repoze.org/configuration/index.html --- !gvim mode: tabbed open: - gspaces/__init__.py - setup.py - gspaces.yml --- !screen windows: - title: gspaces cmd: python manage.py runserver Obviously, it prepares your workspace and opens some stuff for you. I also plan to add "shutdown" support. I will release it under BSD licence and hope somebody else will find it useful.

Fragmenting one big nginx config

underPython, Nginx, English

Getting lost in all glory of big nginx.conf is not that uncommon. I could not stand it anymore, so I wrote this little clever script with support of pyparsing module for Python: from pyparsing import * nginx_conf_expr = OneOrMore(Suppress(SkipTo('server' + White())) + originalTextFor(Word('server ') + nestedExpr('{', '}'))).parseWithTabs() server_name_expr = (Suppress(SkipTo('server_name' + White()) + Word('server_name') + White()) + CharsNotIn(' ;')).parseWithTabs() nginx_conf = open('nginx.conf').read() new_nginx_conf = str(nginx_conf) for server in nginx_conf_expr.parseString(nginx_conf): try: name = server_name_expr.parseString(server)[0] f = open('nginxsite_%s.conf' % name, 'w+') f.write(str(server)) f.close() # update nginx config new_nginx_conf = new_nginx_conf.replace(str(server), '') except: print 'Entry failed:\n', server open('new_nginx.conf', 'w').write(new_nginx_conf) Warning! Do not use that on production data before making a backup copy! Script has been tested on ~1500 long nginx config, and is not bulletproof This script basically extracts all server {} entries and writes them to separate files named "nginxsite_sitename.conf" (all in current working directory). It also produces new_nginx.conf that does not include extracted entries. All you need to do is to add include directive to new_nginx.conf like this: