Skip to content

Instantly share code, notes, and snippets.

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

max asdf8601

:octocat:
Viming...
View GitHub Profile
# 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.
@asdf8601
asdf8601 / Makefile
Last active November 18, 2022 17:44
lookatme
.PHONY: html
html:
@# pandoc -t revealjs -s -o slides.html slides.md -V revealjs-url=https://unpkg.com/[email protected]/
pandoc -t slidy -s -o slides.html slides.md
pdf:
pandoc slides.md --pdf-engine=xelatex -t beamer -o slides.pdf
show:
#!/usr/bin/env bash
# Requierements:
# - glab: https://github.com/profclems/glab#installation
# - sed
# - bash
for m in {sprint:{39..47}}
do
milestone="$(echo $m | tr -d '{}')"
"""My snippet."""
import pandas as pd
def is_unicode(s: str) -> bool:
"""Check if a string is unicode.
Parameters
----------
s : str
@asdf8601
asdf8601 / gist:c89f0d109bba65de097217c46d2f2fb1
Created November 13, 2021 13:52
pandas-distinct: another alternative
# alt 0
left
right
outer_join = left.merge(right, how='outer', indicator=True)
outer_join
# wrong:
outer_join[(outer_join._merge != 'both')].drop('_merge', axis=1)
# alt 1 lets use reindex to include the index
left_reindex = left.reset_index()
@asdf8601
asdf8601 / .vimspector.json
Created November 8, 2021 18:41
vimspector config
{
"configurations": {
"Pytest: Launch": {
"adapter": "debugpy",
"configuration": {
"name": "Pytest",
"type": "python",
"request": "launch",
"cwd": "${workspaceRoot}",
"python": "python",
"""
This requires to have the library (pkg) pre-installed.
Usage:
$ python ./py2mermaid.py --pkg pandas
$ python ./py2mermaid.py --pkg pandas --base-module pandas.core
$ python ./docs/diagrams/py2mermaid.py --pkg pandas --base-module pandas.core
$ python ./docs/diagrams/py2mermaid.py --pkg pandas --base-module pandas.core --raw | sed "s/\w\.\(\w\)/\U\1/g"
Note: based on https://gist.github.com/Zulko/e0910cac1b27bcc3a1e6585eaee60121
@asdf8601
asdf8601 / py2mermaid.py
Last active July 2, 2024 14:59
[mermaid] classDiagram builder from python code
r"""
This requires to have the library (pkg) pre-installed.
Usage:
$ python ./py2mermaid.py --pkg pandas
$ python ./py2mermaid.py --pkg pandas --base-module pandas.core
$ python ./docs/diagrams/py2mermaid.py --pkg pandas --base-module pandas.core
$ python ./docs/diagrams/py2mermaid.py --pkg pandas --base-module pandas.core --raw | sed "s/\w\.\(\w\)/\U\1/g"
Note: based on https://gist.github.com/Zulko/e0910cac1b27bcc3a1e6585eaee60121
# class Parent(object):
# def __init__(self):
# print("parent")
# super().__init__()
# class Right(Parent):
# def __init__(self):
# print("right")
# super().__init__()