Articles


Matplotlib tips, tricks and examples

Matplotlib tricks

Since matplotlib is the de facto standard for plotting with Python in science I am also using it for a while. From time to time there are questions I have got and I took some small notes how to solve different problems.

Though matplotlib 2.0 is much nicer by default than matplotlib 1, some of the following hints still might me usefull.


Enhance matplotlib and LaTeX

Plotting for LaTeX documents with matplotlib

To use \(\LaTeX\) efficiently you should use raw-strings (r"$\LaTeX^2$") otherwise you need to escape the backslashes with backslashes. To use \(\LaTeX\) and format-strings you need to escape all curly braces with curly braces, e. g. r"{} $\textrm{{nah}}$".format("escaping").

Standard official …

➟ Read more

bash-default-variables

Default-Variable

Auf den beiden großartigen englischsprachigen Seiten zur Bash-Prgorammierung tldp und cyberciti kann man jede Menge Tricks zur Variablenmanipulation in bash finden.

Ein sehr häufiger Fall ist die Default-Variable. Dabei gibt es zwei verschieden Fälle. Der mit dem Gleichheitszeichen (=), mit integrierter Zuweisung des Wertes

echo ${varname:="default value"}

Hier hat …

➟ Read more

Links about FreeIPA in Docker

Links to resources for test deployment of FreeIPA into docker

In the official page you can find three useful links to the Docker container, the github repo and, also useful for other things, the documentation on how to dockerize complex software (like FreeIPA).

Another interesting reading is the missing documentation …

➟ Read more

ls-tricks

Tricks with ls

List files except those with a specific extension (zsh)

To list all files in the current directory except those with special extensions often is very useful. For example if I am in a directory with many plots or many data files and only a few others in …

➟ Read more

sshfs

Mount a folder remotely

I like sshfs the secure shell filesystem. But sometimes I forget how the unmounting command is, so I write this short note to myself.

The mounting part is intuitive:

sshfs HOST:PATH mountpoint

It mounts the given path from the given host to the given mountpoint …

➟ Read more

X-forwarding combined with sudo

X11 forwarding combined with sudo

Unfornunately I have no better solution found for X-forwarding and sudoing afterwards, yet.

This solution is insecure, but works as a dirty hack.

user:~$ xauth list | grep unix $(echo $DISPLAY | cut -c10-12) > /tmp/xauth
user:~$ sudo -s
root:~# xauth add $(cat /tmp/xauth)
root …
➟ Read more