Skip to content

Instantly share code, notes, and snippets.

@mgaitan
mgaitan / README.md
Last active February 8, 2024 14:19
La Mandibula de Zago

Oscar Zago es el presidente del bloque de Diputados de La Libertad Avanza.

Al menos durante declaraciones a periodísticas, parece tener problemas mandibulares. ¡Ayudale a dejarla en su lugar!

Este es un juego sin fines de lucro que no juzga las libertades de los individuos para consumir sustancias o votar leyes de acuerdo a sus creencias.

BEGIN:VCALENDAR
BEGIN:VEVENT
SUMMARY:La Calma 1
DTSTART;TZID=America/Buenos_Aires:20240108T000000
DTEND;TZID=America/Buenos_Aires:20240108T000000
DTSTAMP:20231129T173523Z
END:VEVENT
BEGIN:VEVENT
SUMMARY:La Calma 1
DTSTART;TZID=America/Buenos_Aires:20240109T000000
@mgaitan
mgaitan / git-split-commit
Created November 9, 2023 14:36
Replaces a target commit with multiple smaller commits
#!/usr/bin/env python3
"""
Replaces a target commit with multiple smaller commits and then reapplies
the subsequent commits on top of it. The original commit is split by each changed file, and then subsequent
commits are cherry-picked on top of the new split commits.
It's useful to fine-grain a `git bisect` to find a problematic change.
Usage:
@mgaitan
mgaitan / check-python-upgrade.py
Created November 2, 2023 13:08
Checks the compatibility of Python packages listed in a requirements.txt file with a specified version of Python
"""
This script checks the compatibility of Python packages listed in a requirements.txt file with a
specified version of Python. It queries the PyPI API to fetch the latest versions of the packages,
their release dates, and the minimum required versions that are compatible with the given Python version.
The script can output the results in either Markdown format printed to stdout or CSV format written
to a specified file. It accepts a requirements.txt file generated via pip-compile that includes
package versions and hashes.
Usage:
@mgaitan
mgaitan / dockerfile2mermaid.py
Last active September 26, 2023 13:22
Convert Docker multi-stage build files into a Mermaid flowchart representation.
#!/usr/bin/env python3
"""
dockerfile2mermaid
This module provides a utility to convert Docker multi-stage build files into a Mermaid flowchart representation.
Features:
- Extracts all build stages from a Dockerfile.
- Highlights the default build target.
- Represents external images with dashed borders.
@mgaitan
mgaitan / mercadolibre-precios-de-mis-compras.user.js
Last active January 8, 2024 14:07
UserScript Mercado Libre comparar precios de mis compras
// ==UserScript==
// @name MercadoLibre: Comparar precios de mis compras
// @namespace mercadolibre-precios-de-mis-compras
// @version 1.5.1
// @description In the MercadoLibre purchases list, display the price when the product was purchased and the current price.
// @author Martín Gaítan and ChatGPT
// @match https://myaccount.mercadolibre.com.ar/my_purchases/list*
// @grant GM_xmlhttpRequest
// @connect mercadolibre.com.ar
// @connect mercadoshops.com.ar
from pathlib import Path
import pytest
def pytest_addoption(parser):
parser.addoption("--skip-list-file", default=".skip_tests", help="skip listed tests")
def pytest_collection_modifyitems(config, items):
skip_list = Path(config.getoption("--skip-list-file"))
@mgaitan
mgaitan / flexible_dict.py
Created January 17, 2023 13:53
A dict that accepts "similar" keys. Useful to accept argument shortcuts or ignore typos in CLI app, for example
from difflib import get_close_matches
class FlexibleDict(dict):
"""A dict that allow 'similar' keys"""
def __missing__(self, key):
try:
key = get_close_matches(key, self.keys(), n=1, cutoff=0.5)[0]
except IndexError:
raise KeyError(key)
return self[key]
@mgaitan
mgaitan / gist:98f2af1790e4b837faf96cef51071d70
Created November 20, 2022 18:24
World Cup FIFA Qatar 2020 Memes
Memes
@mgaitan
mgaitan / frases_truco.ipynb
Created August 12, 2022 21:26
Listando las frases del Truco Arbiser para DOS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.