Skip to content

Instantly share code, notes, and snippets.

// Idea from this tweet
// All credit to ttps://
[...document.querySelectorAll("*")].map(e=> = "RGBA(0,0,0,0)")
# Alias to show git log with nice format.
# then you can:
# $ git lg | lg1
# $ git lg2
# To show the log
# based on:
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
jomoespe / .bash_profile
Last active December 2, 2020 07:49
Put Git branch in the prompt
# Put the Git branch in the prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
export PS1='\[\033[1;34m\]\w\[\033[1;95m\]$(parse_git_branch)\[\033[0m\]$ '
jomoespe / Makefile
Created January 7, 2020 15:06
Ckeck executable dependencies in a Makefile
# Check if all executables needed are in the PATH before execite any rule/task.
EXECUTABLES = rm mkdir cp mvn java go # List of executables
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH. Check for build requirements")))
# This must be at the begining of the file, so ASAP make parses the file will fail if some of
# dependencies does not exist
jomoespe / go.mod
Created December 12, 2019 08:42
Format and colorize Go console output
go 1.13
require v0.0.0-20191116043053-66b7ad493a23
jomoespe / Dockerfile
Created November 26, 2019 22:55
Non-privileged Docker image from scratch
# Non-privileged containers based on the scratch image
FROM ubuntu AS base
RUN useradd -u 10001 user
RUN mkdir /home/user
FROM scratch
COPY --from=base /etc/passwd /etc/passwd
COPY --from=base /home/user /home/user
jomoespe / Fail-fast shellscript
Last active August 16, 2019 19:10
Fail-fast bash library example

Fail-fast the execution of a bash library script

This is an example of bash library usage. The library fail-fast if you try to use directly from CLI.

The library contains the shebang and execution permissions only for the examples. Not needed in production code (the shebaang and the permissions).


jomoespe / mergeParquet.scala
Created February 14, 2019 07:28
Snippet of Spark job to merge parquet files, also removing duplicates
val partitions = 5; // this value depends on data and volumes. Will be different in every case.
val df =“URI://path/to/parquet/files/")
val df_output = spark
.sql("SELECT DISTINCT * FROM df") // this removes duplicates. If it's not needed, simply remove this line
jomoespe / html-flex-basic-template.html
Created September 4, 2017 21:04
A simple example of flex layout
<style type="text/css">
* {
margin: 0;
padding: 0;
font-size: 10px;
div {
display: flex;
flex-direction: row;
jomoespe / html-grid-basic-template.html
Last active September 19, 2018 10:39
A basic HTML template structured with grid layout
<style type="text/css">
* {
margin: 0;
padding: 0;
html {
font-size: 62.5%;
box-sizing: border-box;