Seine flooding

Français : Crue de la Seine à Paris en 1910.
Seine, Paris, 1910. (Photo credit: Wikipedia)

On this mounth, the Seine decided to flood Paris and its neighborouds, so I took my camera to take pictures. I realised:

I was not alone

TV team waiting for the news
TV team waiting for the news
Guy taking picture thanks to a stick
People taking pictures
Taking picture with foot almost on the water

people live on boats

Even when it is barely reachable

homemade bridge
homemade bridge

Some places are impressive when flooded

Flooded road (Voie George Pompidou)
Pont Mirabeau
Voie Georges Pompidou
Temporary dam
Le zouave
Pedestrian bridge in front of the musée d’Orsay
Le Louvre

A flood carry garbages


Life reborn quickly

Small shop

Paris is still beautiful

In front of a boat

UTF8, base64 and other encoding conversion

A/D and D/A conversion.
encoding conversion (Photo credit: Wikipedia)

A common way to represent binary files in ascii-only diplay is to use base64. This is also done a piece of software does not handle unicode: it manipulate its base64 representation.

Let’s take as example this 2 binary sequence represented in base64:
6YCZ5YCL57ay56uZ5piv576O6bqX55qECg== and dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=

  • to text/unicode:
    echo '6YCZ5YCL57ay56uZ5piv576O6bqX55qECg==' | base64 -d
    echo 'dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=' | base64 -d
  • to text/unicode:
    echo '6YCZ5YCL57ay56uZ5piv576O6bqX55qECg==' | base64 -d | xxd -p -i | sed -e's/, //g'
    echo 'dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=' | base64 -d | xxd -p -i | sed -e's/, //g'
  • from hex:
    echo 'e98099e5808be7b6b2e7ab99e698afe7be8ee9ba97e79a840a' | xxd -p -r
  • mix hex and ascii to ascii:
    echo -e 'this\x20website\x20is\x20bueatiful'

GPG key renewal

English: An example of a standard key used for...
standard key (Photo credit: Wikipedia)

What happen when a PGP key expire? Obvious answer: you can no longer securely use it. Nevertheless, you may not delete it as you must be able to read your encrypted files.

Basics step that should be done are:

  1. generate a new (sub)key
  2. publish your key
  3. test your newly generated key

generate a new key

first setup

For the first key generation, you should have used
The common way using pgp is:

gpg --gen-key

On some installation, you may have used gpg --full-gen-key to a obtain a dialog for each option

key rotation

You must generate a new subkey:

gpg --edit-key 
> addkey
> save

Then you add two keys: one to sign and one to encrypt. Do not forget to save your changes.
I recommand to use the default choice when creating a new key (RSA and RSA for my current installation)

publish your key

quite simple:

gpg --keyserver --send-keys 

you may use any keyserver of your choice. A short list include,,,

test your key

You may use Adele ( Send an email to Adele. It is quite straightforward.

loop devices

Deutsch: Hondaknoten, als Auge für Lassoschlin...
Loop device (Photo credit: Wikipedia)

Loop devices are used to acces any file as if it were a block device such as a disk. On GNU/linux, the canonical command to interact with loop devices is losetup. To list the next usable loop device: losetup -f

disk image loop mount

The most spread usage of loop devices is mounting a file such as an iso or a img file as if it were a disk.

newloop = $( losetup -f )
losetup $newloop /path/to/iso
mount $newloop /mnt

freebsd md

On UNIX, loop device interaction is different. On freeBSD (since freeBSD 5) you may use mdconfig. To mount an iso file:

unit=$( mdconfig -t vnode -f /path/to/iso )
mount -t cd9660 /dev/$unit /mnt # -t mandatory

swap file over any filesystem

swap can be either into a dedicated partition or into a file. In the second case, the file cannot reside anywhere. I understand (but I may be mistaken) that the kernel will try to access the swap file without using VFS. Thus, the number of filesystem a swap can reside on is limited and does not include network filesystem. One way to avoid this limitation is to create a loop device. The kernel will access a block device (the loop device). You may expect a dramatic fall in performance (due to number of abstraction layers).

Donnot forget that swap can host cached information in an unencrypted way (such as RAM, but in a more persistent way).

create file

First of all, you may create a file. The most obvious way is to use dd:

dd if=/dev/zero of=/path/to/file bs=1M count=512

But one can also use truncate:

truncate -s 512M /path/to/file

Do not forget to format it as a swap partition (man mkswap) if you use it a partition or to check permissions if you use it as a swapfile; and to activate this swap (man swapon).

mount file

This section is greatly inspired by this post.

swapfile=$(losetup -f)
truncate -s 8G /path/to/file       # create 8G sparse swap file
losetup $swapfile /path/to/file    # mount file to loop
mkswap $swapfile
swapon $swapfile

awesome global shortcut

Multimedia keyboard
Multimedia keyboard (Photo credit: Wikipedia)

The awesome window manager does not provide GUI configuration tool.

Here is a litte how to to provide a feature using global shortcut, illustrated with wolume control.

Defining and identifying the feature and the shortcut


The wanted feature is usually accessible via the CLI. For example, to modify the sound, the alsa provides the amixer command (via the alsa-utils package in archlinux):

amixer set Master 40%     # put Master level to 40%
amixer set Master 9%+     # increase Master level by 9%
amixer set Master 9%-     # decrease Master level by 9%
amixer sset Master toggle # toggle Mute on Master

The shortcut can be a combination of keys including the modkey. You may also use some of the Xfree86 key binding[1. here is a list]  if your keyboard provides use some multimedia keys.

For sound control, the symbols of interest are XF86AudioRaiseVolume, XF86AudioLowerVolume and XF86AudioMute.


Modifying configuration files


I don’t fully understand the functionning of the awful.key function. It allows to execute a command when pressing some keys. Those keys are sepcified in the first two parameters, and the lua function executed in the last parameter. Several example can be found on the awesome wiki.


To enable a global keybinding, this awful.key() function must be placed inside the global.keys() function.

The configuration file to modify is the rc.lua whose default location is inside the $XDG_CONFIG_HOME/awesome/ directory (~/.config/awesome/ in my case).

For the sound configuration, modify the globalkeys adding the three wanted features:


globalkeys = awful.util.table.join(
    awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2%+") end),
    awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2%-") end),
    awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer sset Master toggle") end),




random unix notes (part II)

This legend is copied at a resolution of 100 p...
Specific file descriptor (Photo credit: Wikipedia)

Few weeks ago, I wrote down about some unix tools. Here are some other multiple process using the same stdout/stdin file desricptor.

file descriptor

The 3 most used file descriptors are stdin, stdout and stderr. A command’s stdout can easily be redirected to another command’s sdtin using pipe mechanism.

More about file descriptor can be found in this stackoverflow answer and this tiny tutorial. In short, file descriptors are located under /dev/fd/ (e.g. stdin is /dev/fd/0) and an unnamed pipe can be created using NN>&1 (redirecting stdout to /dev/fd/NN).

piping from multiple processes

The problem is the following: I have multiple command and I want to concatenate all the outputs. An obvious and easy way is to pipe all the outputs as input to the cat command. To do so, one must group all this commands together:

$ clear ; (ls /usr ; echo "foo bar" ; grep ntp /etc/passwd) | cat
foo bar
ntp:x:87:87:Network Time Protocol:/var/lib/ntp:/bin/false



moreutils (available in both archlinux and debian) is a tool collection. One (pee) is fitted to pipe an output to multiple command:

$ cd /usr && ls -1
$ ls -1 | pee 'tail -1' 'head -1'

Conference posters

English: This mindmap (Mind map) consists of r...
mindmap needing clarification (Photo credit: Wikipedia)

Few weeks ago, I wrote about mindmap in [latex]LaTeX[/latex]. Now I want to precise few ideas and to have all key ideas visible in one sight. I think the best layout is similar to a conference poster:

  • key ideas are easily seen few meters away
  • one can easily move close to the poster to precise those ideas

I found the beamerposter document class that answer my needs, but it is not well documented. Here are some results of my experimentation.


Its functionning is quite similar to the beamer package. The key concept to understand is the block.

The actual content is enclosed into one frame, and is divided in block. Making another frame will produce another poster. Blocks can go into a column or not. You may divide your poster in as many column as you want. Columns are enclosed in a columns environment.

To control the drawing of a box around blocks, you can modify your current theme. I choose to use the fancybox package and created a new environment based on this stackexchange answer.

The beamer block definition is controlled by the directive \setbeamertemplate{block begin} and \setbeamertemplate{block end}.


Themes are the same as for beamer presentation. It is possible to put no themes at all (the default one will be used).

Minimum Working example

As for many [latex]LaTeX[/latex] packages, finding a minimum working example (MWE) is useful. I think it is better to add specification to a working example than removing.

Here is my MWE:

\usepackage{fancybox} %ovalbox


% title %
\usebeamercolor{title in headline}{\Huge{\textbf{\inserttitle}}\\[0.5ex]}
\usebeamercolor{author in headline}{\Large{\insertauthor}\\[1ex]}

% rounded box around blocks %

\setbeamertemplate{block begin}{
\begin{beamercolorbox}[colsep*=0ex,dp={2ex}]{block title}
\usebeamerfont{block title}\large\insertblocktitle
\ifbeamercolorempty[bg]{block title}{}{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}
\usebeamerfont{block body}
\begin{beamercolorbox}[colsep*=0ex,vmode]{block body}

\setbeamertemplate{block end}{
\title{Nice minimal working example}

\addtobeamertemplate{block end}{}{\vspace*{2ex}} % White space under blocks
\addtobeamertemplate{block alerted end}{}{\vspace*{2ex}} 








\begin{block}{Dolor sit}
\item lorem
\item ipsum
\item dolor
Justo vitae lacus tincidunt ultrices.

\begin{block}{Dolor sit}
\item $1^{\text{st}}$ item
\item second item, very important item
\item third item



The result:


quick and easy calendar

English: Calendar
Calendar (Photo credit: Wikipedia)

A quick post to share something I was looking for for several month: a quick way to see a calendar.

A simple tool using the command line interface is the cal command that display a calendar in a terminal. In the archlinux distribution, this command is part of the util-linux package.

Here is a brief illustration:

$ cal -3
    November 2015         December 2015         January 2016    
Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su
                   1      1  2  3  4  5  6               1  2  3
 2  3  4  5  6  7  8   7  8  9 10 11 12 13   4  5  6  7  8  9 10
 9 10 11 12 13 14 15  14 15 16 17 18 19 20  11 12 13 14 15 16 17
16 17 18 19 20 21 22  21 22 23 24 25 26 27  18 19 20 21 22 23 24
23 24 25 26 27 28 29  28 29 30 31           25 26 27 28 29 30 31

UPDATE: Moreover, one can use calendar [1. available on debian in the bsdmainutils package] along with its own shell script(s) to periodically check upcoming events and possibly mail reminders.

this morning thought

Pour toi qui est touché, par ces rafales d’horreur
Pour toi qui  est tombé, et pour toi qui a peur
Pour toi je vais danser, la rage de vivre au ventre
Pour toi je vais lutter contre cette épouvante

Le poing plein de colère, et les yeux plein de larmes
Pour toi je lève mon verre, car c’est là ma seule arme
Contre cette lâche force, qui se cache, qui attends
Et qui tire sa force de notre enfermement

Oui pour toi je vais vivre, pour toi je vais jouer
Faire comme dans les livres, me permettre de rêver,
Et le faire pour toi

Celà ne m’empèche pas, d’aider dans la douleur
Tout ces proches qui sans toi, on perdu toute candeur
Et le faire pour toi



random shell notes

English: Coenobita clypeatus hiding in its she...
Different shells (Photo credit: Wikipedia)

Few month ago, I wrote some notes about Unix. Now is the conterpart about shell scripts. Note that many forum will give bash-specific help, and I’m not curently using bash (I use zsh).

wait until enter is pressed

the more portable I found until now:

while read answer; do
  if [ -z "$answer" ]; then

read a text file line by line

while read line
do a=$(($a+1));
echo $a $line;
done < "myfile"