Bourne to be wild http://blog.jeanserge.com blosxom with a touch of python en Copyright 2010 Benjamin Sergeant 60 Sun, 16 Oct 2011 02:06 GMT bsergean@gmail.com PyBlosxom http://pyblosxom.bluesock.org/ 1.5rc2 20100803 Varnish web accelerator code/varnish http://blog.jeanserge.com/code/varnish.html I just did setup varnish on my machine to see if it makes my web server feels snapier. Facebook uses it so it must mean something... At least now I have some cool HTTP headers on all my request, not sure if it's faster or not. ab gives me pretty lame stats (like 60 request per seconds for a static page with), but maybe it was even lamer without it !

I installed it with aptitude on Ubuntu oneiric, you'll get a varnish 3.x if you do that, and a smooth install as usual. Quick note for myself (apache user). Update yourt ports.conf, and all the virtualhost port to serve on 8080 now (including 000-default.conf), then update /etc/default/varnish to serve on port 80 (it serves on 6081 by default). There is a secure telnet interface for diagnostic (on port 6082). Also, if one of your site uses Cookies you might have to set a magic option (thanks Google) by giving this flag to the varnish daemon when you start it. I think it augment the capacity of the HTTP headers (limited to 2K by default). There's a handy varnishlog tool that will let you know about errors; it's an interactive tool that you use like you'd use top.

-p http_req_hdr_len=20000 -p http_resp_hdr_len=20000 \
 
]]>
/code Sun, 16 Oct 2011 02:06 GMT
Apache Virtualhost code/virtualhost http://blog.jeanserge.com/code/virtualhost.html Here's my apache virtualhost config file for jeandiff. I'm gonna upgrade my Ubuntu Linode VPS from karmic to natty ... so I'd better do some backup.


     ServerAdmin bsergean@gmail.com
     ServerName jeandiff.jeanserge.com
     ServerAlias jeandiff.jeanserge.com
     ErrorLog  /srv/www/jeandiff.jeanserge.com/error.log
     CustomLog /srv/www/jeandiff.jeanserge.com/access.log combined

     # http://reinout.vanrees.org/weblog/2011/05/13/gunicorn-apache-zero-length.html
     # Force http 1.0 for proxying: needed for gunicorn!
     SetEnv force-proxy-request-1.0 1

     DocumentRoot "/srv/www/jeandiff.jeanserge.com/site/idiff"

     ProxyPreserveHost On
     ProxyRequests Off

     ProxyPass        /static/ !
     ProxyPass        / http://localhost:5000/
     ProxyPassReverse / http://localhost:5000/

]]>
/code Tue, 26 Jul 2011 01:05 GMT
Know your iTunes code/jeandiff http://blog.jeanserge.com/code/jeandiff.html Hey iTunes users, I've made this for you !!

It's still very alpha (hint hint ... if any designer want to help...), but it works. You can login with your Facebook account, and I won't post anything on your wall, I swear :)

Check it out !

For the nerd in you, it uses Flask, a super cool Python web framework. The huge database that contains 2 entries on the live site is an SQLite one, and for that project at this point it's all good because it means NO config NO extra server running and that's great.

I used gunicorn for the prod (laugh) site, proxied behing apache. Here's an extract from the amazing Makefile ...

prod:
        # http://gunicorn.org/configure.html
        env/bin/gunicorn -w 4 -b 127.0.0.1:5000 -t 90 -p gunicorn.pid -D hello:app

kill:
        if test -f gunicorn.pid ; then kill `cat gunicorn.pid`; fi

restart: kill prod
]]>
/code Thu, 21 Jul 2011 16:08 GMT
Linux on a plane mood/linux_on_a_plane http://blog.jeanserge.com/mood/linux_on_a_plane.html The last time I took the plane something funny happenned while I was watching a movie. I was fast enough to grab my camera and shoot that for posterity ;)

]]>
/mood Tue, 12 Jul 2011 15:44 GMT
Find the exit code/maze http://blog.jeanserge.com/code/maze.html A while ago I found a maze pic on reddit, and the goal was to paint/find the exit using some coding.

With some python PIL, it was easy to read in the png bytes, but then you had to find the exit ... looks like I found it ;) I still love to zoom in and follow that path to make sure my program is correct and really find a valid path. ]]>
/code Thu, 07 Jul 2011 03:54 GMT