Tesla Model 3 1000km test review

I was considering buying an electric car and Tesla is an obvious choice, so I decided to rent a Model 3 for a weekend and drove it about 1000km in order to evaluate it.

I am from Genova, Italy but live in Zurich, Switzerland so my use case is to find a car that allows me to enjoy a weekend/day trip in Switzerland and occasionally can comfortably bring me to Genova without increasing the total trip time too much (over 30 minutes) due to charging needs.

With a common ICE car, the fastest one way trip without any rest/fuel stop can be done in about 5-5.30 hours; on average it takes 6-6.30 due to queues (damn Gotthard) and rarely it is 7+ hours.

So what about an EV? Here is my review after a 960km round trip in two days.


[bash] Extract all distinct lines from file

Using a combination of cut and uniq, it is possible to extract all distinct lines from a given file:

cut -d\; -f1 file.txt | uniq

It is optionally possible to sort the file as well adding sort to the command:

cut -d\; -f1 file.txt | sort | uniq

[bash] Extract characters before marker from all lines in a file with sed

Using sed, it is possible to quickly extract all characters before a given marker from all lines in a file with:

sed 's/MARKER.*//' file.txt


[C++] Graph adjacency list shortest path BFS

Here is a simple graph model using adjacency lists. The edges are undirected and we will also track edge weights, but ignore them at this time for the shortest path calculation between two given points (therefore we can use a simple BFS).


[Docker] Move docker directory to different location on NTFS filesystem

The default location of docker files (images, volumes, networks, etc) on most distributions is /var/lib/docker

This can be easily changed with the daemon.json configuration file.

First stop the docker service and make sure it is completely stopped.

You can now edit or create the configuration file under /etc/docker folder. In there, you can specify a new location for the docker files with the graph attribute:

   "graph": "/path/to/new/docker_folder"

You can then copy ALL the content to the new location or let docker recreate everything from scratch there.

WARNING: if the new location is on a different filesystem you might need to change the storage driver AND existing data might become inaccessible (it will remain on the filesystem though)

To set a new storage driver, set the storage-driver attribute as well (example for NTFS):

   "graph": "/path/to/new/docker_folder",
   "storage-driver": "vfs"


[GNOME] Create application shortcut that can be added to favorites

Some applications you install come as archives that you extract in a desired location. However, not all come with an installer that takes care of creating the proper application entries, leaving the task to the user.

You can add a shortcut for any application by creating a file APPLICATION_NAME.desktop under /usr/share/applications and adding this content:

[Desktop Entry]




[Linux] Find WM_CLASS value for an application

In order to group application windows together, the WMClass and WMInstance attributes have been specified in the Inter-Client Communication Conventions Manual for X server 11.

Long story short, they are two strings that are used to associate application windows to a specific application, they can be set by the application (WMClass) or the user (WMInstance).

They are very useful especially for those applications that are customizations or based on existing tools, which alone would have a different value (eg Java or Eclipse based apps).

Finding the value for a window is as simple as opening a terminal and running:


Then clicking on the desired window