Skip to content

Instantly share code, notes, and snippets.

@jesugmz
jesugmz / display-raw-images-from-google-drive.md
Last active December 25, 2025 01:30
Display raw images from Google Drive

Display raw images from Google Drive

https://drive.google.com/uc?export=view&id={fileId} where file ID is the unique hash Google Drive gives when the shared link is created.

@jesugmz
jesugmz / 60-jetbrains.conf
Last active December 4, 2025 20:41
Avoid the message 'External file changes sync may be slow: The current inotify(7) watch limit is too low.' from JetBrains products
#
# Avoid the message 'External file changes sync may be slow: The current inotify(7) watch limit is too low.' from JetBrains products.
#
# 1. Create the file /etc/sysctl.d/60-jetbrains.conf and paste this code
# 2. Restart the sysctl service: sudo sysctl -p --system
# 3. Restart the IDE
#
# More info:
# https://youtrack.jetbrains.com/articles/SUPPORT-A-1715/Inotify-Watches-Limit-Linux
@jesugmz
jesugmz / multi-cloud-docker-swarm.md
Last active November 23, 2025 21:27
Create a simple multi cloud Docker cluster using Docker Swarm, Docker Machine and the three top cloud providers nowadays - Google Compute Engine, Microsoft Azure and AWS

Simple multi cloud Docker cluster using Docker Swarm

This guide explains how to create a simple multi cloud Docker cluster using Docker Swarm, Docker Machine and the three top cloud providers nowadays - Google Compute Engine, Microsoft Azure and AWS.

Prerequisites

This guide assumes you have a Linux host with Docker CE installed. If you are using Docker for Mac or Docker for Windows you can avoid the Docker Machine set up since it comes included.

Install Docker Machine

@jesugmz
jesugmz / Python-docstring-restructuredtext-style.rst
Last active August 13, 2025 21:57
Python docstring reStructuredText style

Python docstring reStructuredText style

Python Signatures

Signatures of functions, methods and class constructors can be given like they would be written in Python.

@jesugmz
jesugmz / Dockerfile
Last active July 9, 2025 19:42
Example how to build Docker multi-stage image using official PHP and Composer images
ARG PHP_VERSION=7.2-fpm-stretch
ARG COMPOSER_VERSION=latest
# builder stage
FROM php:$PHP_VERSION AS builder
ARG AMQP_VERSION=1.9.3
ARG PHPREDIS_VERSION=4.1.1
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
@jesugmz
jesugmz / git-tag-regex-validation-using-makefile .md
Last active June 26, 2025 14:39
Git tag regex validation using Makefile

Git tag regex validation using Makefile

This is a portion of a Makefile where I select a Git tag, validate its name using regular expresion and build a Docker image with it as tag.

# it is evaluated when is used (recursively expanded variable)
# https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC59
git_tag = $(shell git describe --abbrev=0 --tags)
# Semantic versioning format https://semver.org/
tag_regex := ^v([0-9]{1,}\.){2}[0-9]{1,}$
@jesugmz
jesugmz / flush-docker-data.sh
Last active April 16, 2025 11:21
Delete the whole Docker data created by the user. TAKE CARE!!!
#!/bin/bash
#
# Delete the whole data created by the user. TAKE CARE!!!
#
# kill all running containers
docker kill $(docker ps -q)
# delete all containers
@jesugmz
jesugmz / edit-go-version-and-update-modules.md
Last active March 10, 2025 12:37
Edit go version and update modules

Edit go version in go.mod

go mod edit -go=<GO_VERSION>

Example:

go mod edit -go=1.24
@jesugmz
jesugmz / Configure-SSH-with-multiple-git-accounts.md
Last active July 17, 2024 10:11
Configure SSH with multiple git accounts

Configure SSH with multiple git accounts

Scenario: same git provider, for this example GitHub (this trick is provider agnostic, has been tested with GitLab as well), and we want to have SSH configured for two different users (or more): jesugmz and myseconduser.

Step 1

Configure SSH config in order to get an alias with different configuration as follow:

$ cat ~/.ssh/config