Image for post
Image for post
Photo by Cookie the Pom on Unsplash

Lately, I have been working on a project in which I needed to pretty print some data on the console. That was how I discovered Rich, a Python library for rich text and beautiful formatting in the terminal.

In this story I will show you some of the features of this library, and how you can use it in your projects.

Installing the library

First, we need to install the library in our environment using pip.

pip install rich

Rich text printing

One of the features that I use the most is to print…

Image for post
Image for post
Photo by Sylvain Thrd on Unsplash

Python 3.5 introduced Type Hints, a new feature that allows developers to use static type checking in python.

Type checking in Python

Python is a duck typed programming language. Duck typing in computer programming is an application of the duck test:

If it walks like a duck and it quacks like a duck, then it must be a duck.

Duck typing is a concept related to dynamic typing, where the type or the class of an object is less important than the methods it defines. When you use duck typing, you do not check types at all. …

Image for post
Image for post
Photo by asoggetti on Unsplash

In C/C++ applications it’s usual to use structures to group related data registers. The data contained into these structures can be persisted/loaded into/from a file through a serialization/deserialization process.

During the development of one of my pet projects I needed to analyze my workout statistics registered in my Geoanute ONMove 220 GPS watch. In a previous research, I discovered that this watch stores the workout statistics and the GPS track log into binary files. The content of these files is defined by C structures, so I had to do some more research. …

Image for post
Image for post
Photo by Ranit Chakraborty on Unsplash

In this post I will cover a brief introduction to WebGL for all those who want to get started with 3D web graphics. I will explain how the Rendering Pipeline works and we will render a simple graphic as an example.

What is WebGL

WebGL is a cross-platform, royalty-free API used to create 3D graphics in a Web browser. Based on OpenGL ES 2.0, WebGL uses the OpenGL shading language, GLSL, and offers the familiarity of the standard OpenGL API.

The main features of WebGL are the following:

  • GPU 3D acceleration
  • Native API with GLSL support
  • Works inside a canvas

Image for post
Image for post
Photo by Conor Luddy on Unsplash

During the development of one of my React projects I made a mistake using the useState hook by saving a third-party object in the component state. It took me some time to fix it because the error trace in the browser console was confusing.

The context of the problem

In this project I used the react-admin library, a web framework to build B2B applications. The library provides user interface components and data providers to communicate with backend APIs. Thanks to these data providers we don’t need to implement the API clients ourselves: we only need to code our API using a standard format and set…

Image for post
Image for post
Photo by Inês Pimentel on Unsplash

In this story, we will learn how to deploy a Flask application with Gunicorn and Docker. Also, we will discover how we can use HTTPS with free SSL/TLS Let’s Encrypt certificates.

Let’s go!

Coding our flask application

First of all, we will write a very simple flask application that we will deploy later:

$ pipenv install
$ env pipenv run flask run

Getting the SSL/TLS certificates

Security is essential when we build web applications. SSL/TLS certificates are a very important part of web security, allowing secure connections over HTTPS…

Image for post
Image for post
Photo by Simone Viani on Unsplash

In this story we’ll learn how to implement a JWT authentication in flask with the Flask-JWT library. All the code implemented is available at this github repository.

Starting the project

We’ll start the project from scratch, so the first step will be to initialize it and install some required dependencies using pipenv:

$ mkdir jwt-auth-test-project
$ cd jwt-auth-test-project
$ pipenv --three
$ pipenv install flask flask-jwt flask-sqlalchemy

Before continuing it’s recommended that we spawn a shell within the virtualenv running the following command:

$ pipenv shell

Image for post
Image for post
Photo by Florian Klauer on Unsplash

In this story we’ll learn how to use the Docker Engine API through the network in a secure way. The Engine API is an HTTP API served by the Docker Engine. It’s the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can also be done with the API.

Enabling the API

In order to use the Docker Engine API, a TCP socket must be enabled when the engine daemon starts. By default, a unix domain socket (or IPC socket) is created at /var/run/docker.sock. …

Image for post
Image for post
Photo by on Pexels

Currently I am managing two little servers and I need to keep some data in sync. Until now, I was performing this task using the rsync tool and a cron task. This approach is simple and functional, but there is a problem: the sync must be bidirectional if we need to keep two identical replicas and avoid integrity issues. Rsync does not support this.

There are several options to carry out this task, such as clustered file systems, but I have chosen a simple approach using Unison, a user-level tool that can be used to sync two replicas.

Introduction to Unison

Unison is…

Image for post
Image for post
Photo from pixabay

Most of our Java projects share a quite common persistence stack: a bunch of Spring Data JPA repositories which store information in a relational database, using Hibernate as JPA provider.

When it comes to handling and storing dates, the common standard for server applications is to handle and store all dates in UTC format, or at least in some kind of standard and deterministic format such as ISO 8601. Recently though, we had a bit of a struggle getting one of our applications to work with dates.

The problem

On one side, this application relied on JVM defaults for timezones, in this…

Martín Lamas

Software developer @trabe

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store