Archive for the ‘script’ Category

Goodbye WordPress, welcome Jekyll

26 January 2014 1 comment

Blog moved to:

I started this blog a couple of years ago to share my thoughts, ideas and projects. At that time is was using Mercurial on Google code for some software projects but I was not really using version control systems for my day to day work.

When I switched to Git (Github & Bitbucket) about two years ago, I got more and more used to text based document formatting, trying to avoid bloated GUIs when possible.

Currently, I am using LaTeX to write presentations, reports and articles. I like the text based approach because this allows you to focus on the content and not on the layout.

The last GUI that I was using for my personal content was WordPress. In my search for a decent replacement I found Jekyll, a simple, blog-aware, static site generator written in Ruby.

How it works:

  1. You write a website skeleton and define some settings. This is similar to the LaTeX approach where you select some packages and define some settings up front.
  2. You write your content locally using Markdown formatting and commit it to a git repository. When adding content later on this is the only thing that you have to do.
  3. The server runs some ruby code to generate a static website based on your content (you can also run the same generator locally)
  4. The website is hosted for free on the Github servers

All my future posts will be located at my new Jekyll-based website and this blog will stay here in “archive mode”.


LaTeX Handouts Builder (Python version)

22 August 2013 1 comment

This tool can be used to build “course handout books” using multiple LaTeX beamer slides sets.

I have been using a Bash script with almost the same functionality for a long time. Some background information on this old script can be found in this blog post.

Book structure:

  • Title page, introduction, table of contents
  • One chapter per slide set (three printer-friendly versions: no slides transitions &  less colors)

Example .zip output

How it works:

  • Just run one program: “python”
  • The program starts building all the LaTeX beamer slides.
  • The output is converted to the printer-friendly formats.
  • All documents are merged in the master handouts book.
  • Create a ZIP archive with all the documents

Code and examples available at GitHub.

Bash script to fix indentation for C++ code

28 November 2012 Leave a comment

This small scripts allows me fix the indentation of C++ source files with very little effort.


  1. Drop one or more C++ source files in the “toindent” folder
  2. Run the script “./ toindent” (this calls the bcpp indenter to indent all files in the ‘toindent’ folder)
  3. Done

There are some options for step 2:

  • Select one file to indent: “ file.cpp”
  • Select all files in the ‘toindent’ folder: “./ toindent/”
  • Select only files with a certain extension in a folder (e.g. “.h”):  “./ toindent h”


Indentations options can be changed in the “bcpp_indenter.cfg” file.

Build script: course handouts from latex-beamer slides

4 December 2011 1 comment

As a lecturer, a part of my job consists of giving presentations using some kind of presentation software.

In the past, I uploaded a pdf file for each presentation to the  educational learing platform we use at our university. Typically 12+ files for one semester. Because some students prefer to print out the handouts, I provided a printer friendly version (8 slides per page), instantly doubling the number of files.

During the semester, I tend to adjust/tweak/update these files from time to time, making it dreadfull for me to update the files, and making it difficult for the student to ensure they have downloaded the last version of each file.

When I switched from to Latex beamer to prepare my presentations, I also decided to resolve this annoyance and add some extra features to my handouts.

This resulted in a build script.

What is it does:

  1. Build two pdf version for each lecture: presentation version and handout version (printer friendly colors, no slide transitions)
  2. Build a 8 slides per page (8pp) version starting from the handout version
  3. Create a nice handout document by joining all the 8pp files + include title page, introduction, table of contents
  4. Create a .zip archive file with all these documents

The end result is an updated .zip archive, with the last version of all the slides.  About once a week, I do a full build and upload this one file to our learning platform.

Sample commandline output:

$ ./build
Now processing: 0-hfdst0
Latex build succesfull
PDF 8pp build succesfull
Now processing: 7-hfdst7
Latex build succesfull
PDF 8pp build succesfull
Now processing: 8-hfdst8
Latex build succesfull
PDF 8pp build succesfull
Now joining all documents
Latex build succesfull
Build took 6 seconds.

Sample files:

(remove ‘.doc’ from the file extension, wordpress does not allow .zip/.sh)