Lath. A real time webchat with LaTeX support.

Lath is a real-time minimalistic webchat with LaTeX support (I know the name is not the best, it comes from LaTeX + Math). Rooms are predefined, and right now there are three: Calculus, Discrete Mathematics and Logic, because it is focused to CS students (based in Spain courses). Lath is built with NodeJS and ExpressJS, … [Read more…]

Mail client: An easy smtplib wrapper.

I published to github [mailclient](https://github.com/aesptux/mailclient), a wrapper for the standard smtplib and email libraries. Smtplib and email are no fun to work with, for example if you want to attach a file, you have to import the right MIMEType. I built this wrapper to make sending emails with Python easier, for example: # create message … [Read more…]

Quick tip: MySQL disallow database creation which certain name

If we want to prevent a name to be used as a schema name, it is pretty easy to accomplish: # move to your mysql data folder, default /var/lib/mysql cd /var/lib/mysql # create an empty folder with the desired name mkdir dontusethisname # set permissions to 000 chmod 000 dontusethisname # change ownership to mysql … [Read more…]

How to deploy django with nginx + gunicorn

Django is a great web framework and we have several ways to deploy it in production. You can use apache too for example, but for django my favorite is nginx + gunicorn. Nginx is a well-known player and it will be used as front-end. Gunicorn is not as well-known, but it has proved to be … [Read more…]

Fix pulse audio problems Fedora 17.

With this release, I have been having some pulse audio problems. Sometimes I do not have sound while playing  Spotify, Rhythmbox or any other desktop player. After a research, it is usually fixed with this three lines (not always): rm -rf ~/.pulse pulseaudio –kill pulseaudio -vvvvv Do not run it as root.

Convert m4a files to mp3 with this script.

Some of my library was in m4a files, which I have problems to play, furthermore I prefer having everything in mp3 format. So I wrote the following script: echo “Dependencies: mplayer and lame” if [ $# -lt 1 ]; then echo “Usage: sh m4a2mp3.sh ‘/path/to/files'” else echo “This could take sometime. Converting to 320kbps MP3 … [Read more…]

Quick tip: Adding and substracting dates in PHP

More simple than it may seems. It will take care of adjusting months and days automatically: **Working with days:** // My date Y-m-d $mydate = “2012-05-06″; //Adding five days $newdate = date(“Y-m-d”, strtotime($mydate. ” +5 days”)); // Substracting five days $newdate = date(“Y-m-d”, strtotime($mydate. ” -5 days”)); **Working with weeks:** // My date Y-m-d $mydate … [Read more…]