Sunday, 28 February 2010

Laoshi release 0.1.0

I announce the first release of laoshi, my Chinese learning application. In this release I include four lessons for beginners. The code and files can be downloaded from the google code page.

Saturday, 20 February 2010

laoshi : A Chinese learning application


I had some free time recently so I created a small application to learn Chinese. The name "laoshi" is the pinyin for "老師" which means "teacher".

For the moment the application features :
  • A dictionary, using the database from cedict containing more than 90,000 entries.
  • A lessons viewer, with automatic dictionary lookup when we pass the mouse over the text.
  • A flash card player.
  • Two lessons that I wrote for beginners.
I wrote everything in python using gtk for the interface, so it should work on every platform. I don't provide any package yet, but people interested can check the code at google code.

Wednesday, 3 February 2010

Writing a resume using reStructuredText

reStructuredText (rst) is a simple markup language perfect for writing documentation. Altough it may not be as powerful as Latex, it is much simpler to use.

I decided to give a try at using rst to create my resume : here is the input file.

Now, thanks to this rst to pdf converter project (written in my favourite language), I can easily generate a nice pdf version of my resume. Here is the resulting pdf.

This approach has many advantages compared to my previous way of doing (using open office). I can easily update the document, change the style, and generate my resume not only in pdf, but also in html or almost any formats I want.

[edit] : as some people pointed out, the input file for my CV needs an extra file for the style. This file can be found here.

Thursday, 19 November 2009

monitor long compilation time

For people who like me like to keep logs of everything they do, this little script can be used to automatically add entries into a log file before and after running a long command.

It fits nicely into my org-mode system, I put the logs entries into an org file and they then appear into my agenda :

=====================================================================
#
!/bin/bash

# Automatically logs the task given as argument into my org log file.
# This is useful when running long compilations.

LOG_FILE=/home/guillaume/Org/Logs.org
CMD=$@

TMP_FILE=$(tempfile)
LABEL=$(pwd)

echo "* start: ($LABEL) $CMD <$(date +'%F %a %R')>" >> $LOG_FILE

STAT_FORMAT="\
- time :: %E
- retun status :: %x
"


trap ctrl_c INT

function ctrl_c() {
echo "* killed: ($LABEL) $CMD <$(date +'%F %a %R')>" >> $LOG_FILE

exit -1
}

/usr/bin/time -o $TMP_FILE -f "$STAT_FORMAT" $CMD

echo "* end: ($LABEL) $CMD <$(date +'%F %a %R')>" >> $LOG_FILE

cat $TMP_FILE >> $LOG_FILE
rm $TMP_FILE
=========================================================================

Friday, 7 August 2009

Check python coding style on the fly with emacs


A nice emacs trick : using flymake-mode and this python code styles PEP8 checker script written by Johann C. Rocholl, we can have automatic real time checking for standard python coding style.

To make this work I copied the script (pep8.py) in my PATH, and then I added this block of code in my .emac file :

(when (load "flymake" t)
(defun flymake-pylint-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pep8.py" (list "--repeat" local-file))))

(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pylint-init)))

After this I can just enable flymake mode when I edit a python file, and every coding style error will be highlighted on the fly.

Saturday, 13 June 2009

Fluid dynamics engine

After I read this paper I decided to try to write a small two dimensions fluid dynamics engine for video games. It is quite fun.

Now I need to see what I could use it for.

Sunday, 31 May 2009

Tichy 1.1.0 released

Yesterday I released tichy 1.1.0. In this new release a lot of internal refactoring, improvement of the style system, the text editor, the terminal, and the PIM applications. I also added some unit tests using py.tests.

See the release notes.