Linux

How to install the latest version of Postgresql on Ubuntu

It is quite easy to install the latest version of Postgres on Ubuntu. First, declare Postgres repository, create the file /etc/apt/sources.list.d/pgdg.list like this :

Import the repository signing key, and update ubuntu package lists

Then install latest postgresql (actually version 11) and its latest GUI pgadmin (actually version 4) :

Postgresql is now running, you can check that by…

Continue Reading

Uncategorized

rsync two remote hosts

Usually, rsync is used to synchronize one local directory to/from one remote directory. But sometimes, because two hosts cannot see each other directly, one cannot log into one host and rsync to from the other. The solution is to find a third host that can see both hosts and then sync them. Unfortunately, rsync accepts only one remote host. The…

Continue Reading

Uncategorized

How to add existing project to git and configure remote repository

You already started a new project, but it is not under GIT yet. No problem, let’s create a local repository dedicated to your project :

Et voilà. Now, in order to have the project available everywhere, you can configure a remote GIT repository. You first have to log into your remote host and configure a new repository :

Continue Reading

Git

How to reconcile detached HEAD with master/origin

If you are using pycharm or other IDE, you can easily checkout an older version of your source code, just by right-clicking on the revision you want. Unfortunately, it is not so obvious to go back to the master branch if you do not care about what you are clicking on. Logically, you may have done the same process to…

Continue Reading

Python

Linked items to a Tree

Let’s say you receive a list of 2 linked items having a “is included in” relation. For example, you receive this list :

Here (‘cpqswcc’, ‘compaq’) means ‘cpqswcc’ is included in ‘compaq’. You may want to build a relation tree like this :

The cool function to do that would be the one in this code :

   

Linux

Install ubuntu 16.04 on a mac book pro in dual boot

Tired to use Mac OS for development purposes, I wanted to install Ubuntu 16.04 in dual boot on my Mac book pro retina 15.6″. For that I needed : A mac book pro with an intel processor A bootable USB stick with ubuntu 16.04 The Disk utility from mac OS The rEFInd boot manager A RJ45 adapter, because Wifi does…

Continue Reading

Linux

‘lnav’ : The log file navigator

You know the following commands : more, grep, tail -f, vi : here is the command that does all that : lnav You can install lnav just by installing the corresponding package :

You get a listing which is dynamically refresh like tail -f does. You can search like vi by using / command, you can also filter with…

Continue Reading

Linux

‘htop’ command tool

To monitor running processes, you already know the ‘top’ command, you will get such an output : Now there is the ‘htop’ command which provides much more features and detailed informations : You’ve got colors, text bars graph, commands with arguments : You can scroll up, down AND right and left, and the best : despite it is a text…

Continue Reading

Python

How to get Class attributes order

Before python 3.6 it was difficult to get attributes order from a class. Let’s say, for instance, you want to create a listing class which contains columns to display :

With python 2.7 you will get :

With python 3.5 you will get :

And finally, with python 3.6, there is no problem any more : attributes…

Continue Reading

Python

How to dynamically create a class with some mixins

Let’s say you want to create a class that includes mixins having names that are known at execution time only, you would do some thing like this :

To get mixins_classes, juste use importlib to get mixins classes from names. A function that would create an instance of such a dynamic class would be something like this :

Continue Reading