Flask logging setup

dictConfig, user defined object

Setup a python logging configuration with dictConfig Logging configuration can be defined on different ways like a dict, ini file, yaml or json somethimes is more flexible to do it on code with python, all depends on the use case. This small example show how to setup the logging configuration using dictConfig method and how to add an user defined object to the logging filter. import os import logging import socket from flask import Flask from logging. [Read More]

Markdown Blog

Setup Blog using Hugo static site generator, Nginx, LetsEncrypt

For this blog, i’ve setup a linux KVM vps, using as distro Fedora 27. Fedora 27 comes with Selinux enforced security policy by default this is OK for system or apps where you required a high security level, but for my case to serve a static blog and run a couple of services like OpenSSH and Nginx is ok to set the security policy on permissive mode. changing the policy can be done via command or setup in permanent way on the selinux config in /etc/selinux/config [Read More]

Markdown Blog

blog with Hugo

There are many reasons and options to choose a static site generator, but the main reasons are speed and security. Speed because it can allow more control over the content you only load what is really required without additional server side content, for security not having a database that can be compromised and security updates to apply, reduce the attack vectors and the administration work. There are many options for static site generators created on diferent languages like: [Read More]

Checking and validating phone numbers


In applications sometimes is needed check and verify if a phone number is valid or possible if the number have all required digits to be valid for this purpose there are several options to tackle the problem like regular expressions for example to validate E.164 format, library like the Google libphonenumber and API like the Twillio Lookup for something more complete. for this post i created a small app for test a demo purpose using the python port of the Google library [Read More]

Some basics git commands

git cheatsheet

Basic workflow # setup the project git clone github/project.git git branch FeatureX git co FeatureX # make some changes git status git add . # commit changes git commit -m 'commit message' # push changes to branch git push origin branch-name # next pull request/merge with master on github or command line Sometimes you don’t want to track some files(like local env configuration settings) # no track file git update-index --assume-unchanged Gemfile . [Read More]