Improve everyday.

Beautiful color lists

|

Create easily a list of distinct colors (for plotting or visualisation), using matplotlib.pyplot colormaps

Get the color list (RGB)

To get a list of colors, go chose the colormap you want here. Multiple shading offs are provided, as well as discrete colormaps (qualitative section).

beautiful_colormaps

You can then create n different colors by passing a list of n float uniformly spaced between 0 and 1.

Example

Here, get the 8 colors from Dark2 colormap :

import matplotlib.pyplot as plt
COLORS = plt.cm.Dark2(np.linspace(0, 1, 8))

docker compose configuration override

|

Override your docker-compose.yml

The trouble in the docker-compose.yml and docker-compose-prod.yml is that you have to repeat common configurations.

To avoid that, you can use the override feature of docker-compose :

A docker-compose.override.yml file will override the configuration.

We can use docker-compose.override.yml for the DEV env, and a `docker-compose.prod.yml for production :

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

source: https://docs.docker.com/compose/extends/#example-use-case

Customize docker ps

|

Default

$ docker ps

CONTAINER ID        IMAGE                                                      COMMAND                  CREATED     
     STATUS                    PORTS                                      NAMES                                     
6f29940424f4        mxnet:compile                                              "entrypoint.sh"          21 hours ago
     Up 21 hours                                                          mxnet_compile_1                           

With a terminal too small, the output spans 2 lines

Customized

Ephemeral change


$ docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"


NAMES                                 STATUS                    IMAGE        
mxnet_compile_1                       Up 21 hours               mxnet:compile

Permanent changes

Write in your ~/.docker/config.json:

{

    "psFormat": "table {{.Names}}\t{{.Status}}\t{{.Image}}"

}

For more information check https://docs.docker.com/engine/reference/commandline/ps/#formatting

Merging strategy

|

1. Rebase branch feature-x

git checkout feature-x
git fetch origin
git rebase origin/develop [-i]
git push origin feature-x [-f]

2. Merge branch feature-x

  • open a PR on Bitbucket
  • merge and force a merge commit
    • when merging manually, go to develop branch and git merge feature-x --no-ff

git ls-files

|

Show information about files in the index and the working tree.

List all files in the repository staged

git ls-files

List all files in the repository not staged in the index

git ls-file -o

Useful if you need a clean repository and make a new install.