Skip to content

Instantly share code, notes, and snippets.

View jorgecarleitao's full-sized avatar

Jorge Leitao jorgecarleitao

  • Munin Data ApS
  • Lisboa, Portugal
View GitHub Profile
party account year value
BE Ativo 2023 2238470.47
BE Ativo 2024 2379743.36
BE Fundo Patrimonial 2023 57376.73
BE Fundo Patrimonial 2024 1142933.0
BE Passivo 2023 95012.26
BE Passivo 2024 114129.02
CDS Ativo 2023 650918.41
CDS Ativo 2024 698393.61
CDS Fundo Patrimonial 2023 -367172.75

Acceptance criteria

Send an email to https://www.mail-tester.com/ and https://www.mailgenius.com/ and it yields a score of 10.0/10.0

Assumptions

  1. You control the DNS of your email domain
  2. You have some control about the email server / provider
  3. You can modify the rDNS of your email server or provider
@jorgecarleitao
jorgecarleitao / postgres_test_context.rs
Created July 18, 2025 18:01
Rust Test Context to manage a postgres instance via docker
#![forbid(unsafe_code)]
/*
This code:
* provides a Test Context that creates a postgres DB via docker the first time it is used, that is shared across multiple tests
* removes the docker container at the end
* ensures that you can run `cargo test` (i.e. tests run in parallel)
In a gist, it does so by ensuring that we (almost always) call Drop on the (lazy globally shared) instance.
This likely fails on aborts, leaving the container running.
*/
@jorgecarleitao
jorgecarleitao / set_plot_settings.py
Created July 4, 2017 09:13
A minimal change of settings parameters for quality images with matplotlib
import matplotlib.pyplot as plt
def set_plot_settings(font_size=18):
# a font that is very close to LaTeX.
plt.rcParams['mathtext.fontset'] = 'stix'
plt.rcParams['font.family'] = 'STIXGeneral'
# ticks with the same width as axis, and consistent with font size (below)
plt.rcParams['axes.linewidth'] = 1
plt.rcParams['xtick.major.width'] = 1
@jorgecarleitao
jorgecarleitao / cache.py
Created February 17, 2017 15:33
A decorator of functions that stores a dictionary *args->result in a pickle and returns cached versions after first call
import os
import pickle
def cache(file_name):
"""
A decorator to cache the result of the function into a file. The result
must be a dictionary. The result storage is in pickle
"""
def cache_function(function):
@jorgecarleitao
jorgecarleitao / install_sphinx.sh
Created March 21, 2015 09:29
Installs Sphinx search on the machine. Useful for travis CI.
# usage: `bash -c "$(curl -fsSL <gist_url>)" <version>
VERSION=$0
wget http://sphinxsearch.com/files/sphinx-$VERSION-release.tar.gz
tar -xf sphinx-$VERSION-release.tar.gz
cd sphinx-$VERSION-release
./configure --with-pgsql
make
make install
@jorgecarleitao
jorgecarleitao / pt_health_entities.dat
Created February 27, 2015 16:17
DB of portuguese public entities related to public health
# name, Fiscal number
Gabinete do Ministro da Saúde;600052303
Gabinete do Secretario de Estado Adjunto do Ministro da Saúde;600071006
Gabinete do Secretario de Estado da Saúde;600052290
Secretaria-Geral do Ministério da Saúde;600080684
Direcção-Geral da Saúde;600037100
Instituto da Droga e da Toxicodependência;506452654
Inspecção-Geral das Actividades Saúde;600018857
Autoridade para os Serviços de Sangue e da Transplantação;600082695
Alto Comissariado da Saúde;600082709
@jorgecarleitao
jorgecarleitao / nginx_installer.sh
Created January 14, 2015 18:10
Installs nginx in a local directory (e.g. for webfaction)
# prepare
VERSION=$1
DIRECTORY=$2
# download
curl -O http://nginx.org/download/nginx-$VERSION.tar.gz
# extract
tar -xzf nginx-$VERSION.tar.gz
@jorgecarleitao
jorgecarleitao / xapian_installer.sh
Last active May 23, 2025 13:25
Install Xapian in current Python virtualenv
#!/usr/bin/env bash
# first argument of the script is Xapian version (e.g. 1.2.19)
VERSION=$1
# prepare
mkdir $VIRTUAL_ENV/packages && cd $VIRTUAL_ENV/packages
CORE=xapian-core-$VERSION
BINDINGS=xapian-bindings-$VERSION
# Exact copy of original, https://gist.github.com/adamgit/3786883,
# but removed comments.
# OS related
.DS_Store
*.swp
*.lock
profile
# Xcode related