101 of Git Commands

Across the projects & users, we recommand to use a similar .gitconfig file should be used

For ease of use a unique .gitconfig file should be used.

Also the file types that are forbidden to be checked into the Git repository should be defined for every body. It is not considered as a good practice to commit binary files in the Git ... but sometimes teams do.

The fact that the file with the alias is common/shared across the team(s) allows to exchange best practice & common behavior. It is however not mandatory, just an advice. …

more ...

Usefull commands : python / python3 json.tools

Viewing the log statements in Logstash

Django logging configuration

Logging is done mainly by configuring the Docker hosting Django to ship via UDP (same machine) the log statements.

sudo docker run               \
   -d                         \
   --network djangoNetwork    \
   --log-driver gelf --log-opt gelf-address=udp://<ip>:port \
   --log-opt tag=ITNDjango    \
   --name ITNDjango           \
   itndjango

Viewing the logs is pretty awfull

tail -f   /var/log/logstash/tls-All-Series/ITNDjango-2021-03-21.log  
{"image_name":"itndjango","image_id":"sha256:f390481f05a37970d29e52bafea81bc7f634d69b7d0cff6adc6491493cfb1101","@version":"1","message":"def handler500(request)::invoked. Request = <WSGIRequest: GET '/en/Schedule/'>","host":"tls-All-Series","@timestamp":"2021-03-21T15:34:45.163Z","version":"1.1","level":3,"container_name":"ITNDjango","source_host":"172.42.0.1","tag":"ITNDjango","container_id":"45331982c3ac6ea18671b04ef45cdb223ed268c381c4bc1d9766e2deb2509125","command":"gunicorn -b 0.0.0.0:8000 wsgi:application","created":"2021-03-21T15:28:42.53984554Z"}
{"image_name":"itndjango","image_id":"sha256:f390481f05a37970d29e52bafea81bc7f634d69b7d0cff6adc6491493cfb1101","@version":"1","message":"\r// BODY : b''","host":"tls-All-Series","@timestamp":"2021-03-21T15:34:45.164Z","version":"1.1","level":3,"container_name":"ITNDjango","source_host":"172.42.0.1","tag":"ITNDjango","container_id":"45331982c3ac6ea18671b04ef45cdb223ed268c381c4bc1d9766e2deb2509125","command":"gunicorn -b 0.0.0.0:8000 wsgi:application","created":"2021-03-21T15:28:42.53984554Z"}
{"image_name":"itndjango","image_id":"sha256:f390481f05a37970d29e52bafea81bc7f634d69b7d0cff6adc6491493cfb1101","@version":"1","message":"\r// Encoding : GET","host":"tls-All-Series","@timestamp":"2021-03-21T15:34:45.175Z","version":"1.1","level":3,"container_name":"ITNDjango","source_host":"172.42.0.1","tag":"ITNDjango","container_id":"45331982c3ac6ea18671b04ef45cdb223ed268c381c4bc1d9766e2deb2509125","command":"gunicorn -b 0.0.0.0:8000 wsgi:application","created":"2021-03-21T15:28:42.53984554Z"}
{"image_name":"itndjango","image_id":"sha256:f390481f05a37970d29e52bafea81bc7f634d69b7d0cff6adc6491493cfb1101","@version":"1","message":"\r ","host":"tls-All-Series","@timestamp":"2021-03-21T15:34:45.176Z","version":"1.1","level":3,"container_name":"ITNDjango","source_host":"172.42.0.1","tag":"ITNDjango","container_id":"45331982c3ac6ea18671b04ef45cdb223ed268c381c4bc1d9766e2deb2509125","command":"gunicorn -b 0.0.0.0:8000 wsgi:application","created":"2021-03-21T15:28:42.53984554Z"}
{"image_name":"itndjango","image_id":"sha256:f390481f05a37970d29e52bafea81bc7f634d69b7d0cff6adc6491493cfb1101","@version":"1","message":"ERROR : ************************************************* ","host":"tls-All-Series","@timestamp":"2021-03-21T15:34:45.164Z","version":"1.1","level":3,"container_name":"ITNDjango","source_host":"172.42.0.1","tag":"ITNDjango","container_id":"45331982c3ac6ea18671b04ef45cdb223ed268c381c4bc1d9766e2deb2509125","command":"gunicorn -b 0.0.0.0:8000 …
more ...

BASH in colors

Problem

When scripting some tasks it is always better to use clear marking of what is OK (in green) and what is not OK (in Red). Now this was easy with simple colors but we sometimes require more than 2 colours.

Escape characters

As often, I saw a good trick and Copy-Pasted it without asking myself anything further.

Today every shell scripts (99,9% of the time bash) are like what follows.

#!/bin/bash

# Author     : "Thomas Lionel SMETS"
# Copyrights : "All rights reserved 2006-2021, A3-SYSTEM srl-bv"
# #####################################################################

#    .---------- constant part!
#    vvvv vvvv-- the …
more ...