Skip to content

Instantly share code, notes, and snippets.

View mmngreco's full-sized avatar
:octocat:
Viming...

mg20400 mmngreco

:octocat:
Viming...
View GitHub Profile
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "matplotlib",
# ]
# ///
from itertools import chain
import matplotlib.pyplot as plt
import matplotlib.patches as patches
#!python3
"""
PIPX-like tool for conda
Examples
--------
cx install black
cx install black -p 3.11
cx install git+https://github.com/psf/black
#!python3
"""
Examples
--------
$ pipx run https://gist.githubusercontent.com/mmngreco/2d3bc321405b1991277fd6001060df0d/raw/dot2ascii.py help
$ pipx run https://gist.githubusercontent.com/mmngreco/2d3bc321405b1991277fd6001060df0d/raw/dot2ascii.py "graph {a -- b -- c}"
$ echo "graph {rankdir=LR; a -- b -- c }" | pipx run https://gist.githubusercontent.com/mmngreco/2d3bc321405b1991277fd6001060df0d/raw/dot2ascii.py
"""
# /// script
# requires-python = ">=3.10"
@mmngreco
mmngreco / gaussian-borroso.py
Created September 12, 2023 09:43
Gaussian Blur (filter) example from scracth
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import convolve2d
def build_filter(size, sigma):
# Construir matriz gaussiana 3x3
x = np.arange(-size / 2 + 1, size / 2 + 1)
y = x[:, np.newaxis]
@mmngreco
mmngreco / emojis.txt
Last active August 19, 2023 10:07
Emojis list
😀😁😂🤣😃😄😅😆😉😊😋😎😍😘😗😙😚☺🙂🤗🤩🤔🤨😐😑😶🙄😏😣😥😮🤐😯😪😫😴😌😛😜😝🤤😒😓😔😕🙃🤑😲☹🙁😖😞😟😤😢😭😦😧😨😩🤯😬😰😱😳🤪😵😡😠🤬😷🤒🤕🤢🤮🤧😇🤠🤡🤥🤫🤭🧐🤓😈👿👹👺💀☠👻👽👾🤖💩
@mmngreco
mmngreco / find_all_links.js
Last active February 21, 2023 09:41
Find all links with csv in the string
@mmngreco
mmngreco / bq_mre_empty_table.sh
Created February 7, 2023 16:43
bq(issue): unexpected empty result fixed with left join
bq query --format=sparse --nouse_legacy_sql '
WITH temporal AS (
-- | x | y | z |
SELECT 1 AS x , "foo" AS y , true AS z UNION ALL
SELECT 2 AS x , "apple" AS y , false AS z UNION ALL
SELECT 3 AS x , "" AS y , true AS z
),
staging as (
SELECT 1 AS x , "boo" AS y , true AS z UNION ALL
SELECT 2 AS x , "apple" AS y , false AS z UNION ALL
def is_running_on_ipython():
try:
from IPython import get_ipython
except ImportError:
return False
if get_ipython() is None:
return False
return True
# Airflow resources
* [Ecosystem | Apache Airflow](https://airflow.apache.org/ecosystem/#learning-resources)
* [The Complete Hands-On Introduction to Apache Airflow | Udemy](https://www.udemy.com/course/the-complete-hands-on-course-to-master-apache-airflow/)
* [jghoman/awesome-apache-airflow: Curated list of resources about Apache Airflow](https://github.com/jghoman/awesome-apache-airflow)
* [Apache Airflow: Complete Hands-On Beginner to Advanced Class | Udemy](https://www.udemy.com/course/apache-airflow-course/)
* [Airflow Summit 2022 sessions | Airflow Summit](https://airflowsummit.org/sessions/2022/)
* [Data Engineering Zoomcamp - YouTube](https://www.youtube.com/playlist?list=PL3MmuxUbc_hJed7dXYoJw8DoCuVHhGEQb)
# log_issue.py
"""
We want logging the output of a heavy_task function when the log level is debug.
The problem appears when we use info level and the whole process is being
affected by our debug log statement.
main : reproduce the problem
main_lazy : has the solution.