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, MathJax for LaTeX and it stores each message to a MySQL database. The code has…

Read more

Mail client: An easy smtplib wrapper.

I published to github 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 msg = mail.Message('This will be the subject', 'This will be the body content', '…

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 user chown mysql:mysql dontusethisname If you try to create this sch…

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 quite stable (instagram and pinterest use it). Installation: yum install nginx pip install gunicorn P…

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.…

Read more

How to remove ati propietary drivers. Fedora.

I wanted to give it a shot, and installed ATI propietary driver. It did not ended well. Gdm could not start, it stucked after loading services. To remove it: # yum remove kmod-catalyst* xorg-x11-drv-cata* I will not try them again.…

Read more

Fix bug: Fedora 17 does not shutdown. Kernel Panic.

If you upgraded from Fedora 16 to Fedora 17, you may get an error when shutting down the system. This happens because the kernel is the same, and grub2.cfg does not get the Fedora 17 kernel, but it is installed, although not recognized. To fix this just run the following command: # grub2-mkconfig > /etc/grub2.cfg && grub2-install /dev/sda Notice that you should change /dev/sda f…

Read more

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 files..." sleep 1 cd "$1" for i in *.m4…

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 = "2012-05-06"; //A…

Read more