Skip to content

Instantly share code, notes, and snippets.

View thiagoferreiraw's full-sized avatar

Thiago Ferreira thiagoferreiraw

View GitHub Profile
@thiagoferreiraw
thiagoferreiraw / relatorio_detalhado_orcamentos_pybr2025.md
Created August 28, 2025 14:43
Relatório Detalhado dos Orçamentos Python Brasil 2025 - Análise Completa PDFs (28 ago 2025)

📊 RELATÓRIO DETALHADO DOS ORÇAMENTOS - PYTHON BRASIL 2025

28 de agosto de 2025 - ANÁLISE COMPLETA DOS PDFs E IMAGENS

🎯 RESUMO EXECUTIVO

Orçamentos Completos Analisados: 3 categorias principais • Valor Total Estimado: R$ 150.000 - R$ 280.000 • Economia Potencial Identificada: R$ 30.000+ (escolhas inteligentes) • Status: Pronto para tomada de decisão

@thiagoferreiraw
thiagoferreiraw / relatorio_orcamentos_pybr2025.md
Created August 28, 2025 14:30
Relatório de Status dos Orçamentos - Python Brasil 2025 (28 ago 2025)

📊 RELATÓRIO DE STATUS DOS ORÇAMENTOS - PYTHON BRASIL 2025

28 de agosto de 2025

🎯 VISÃO GERAL

Issues de Orçamentos Ativas: 16 • Issues com Orçamentos Recebidos: 7 (44%) • Issues com Progresso Ativo: 12 (75%) • Issues Órfãs (sem responsável): 7 (44%) • Dias até evento: 55 dias

@thiagoferreiraw
thiagoferreiraw / create_promotional_image_pure_python.py
Created November 25, 2021 19:34
create_promotional_image_pure_python.py
def create_promotional_image():
with open("promo.png", "wb+") as output_file:
create_png_from_svg_template(
"coupon/test.svg",
{"_WIDTH": 400, "_HEIGHT": 200, "_PROMO_CODE": "ABCD1234"},
output_file,
)
@thiagoferreiraw
thiagoferreiraw / tests.py
Created November 25, 2021 19:22
united tests
import cairosvg
@mock.patch("cairosvg.svg2png", wraps=cairosvg.svg2png)
def test_create_png_from_svg_template(self, spy_svg2png):
with BytesIO() as output_file:
image.create_png_from_svg_template(
"utils/tests/svg_template.svg",
{"_WIDTH": 159, "_HEIGHT": 161, "_TEXT": "Hello World!"},
output_file,
)
@thiagoferreiraw
thiagoferreiraw / create_promotional_image.py
Last active November 25, 2021 19:16
create_promotional_image
import io
from .models import Coupon
from .utils import create_png_from_svg_template
def create_promotional_image(coupon_id):
coupon = Coupon.objects.get(id=coupon_id)
with io.BytesIO() as output_file:
create_png_from_svg_template(
"coupon/templates/promotional-template.svg",
@thiagoferreiraw
thiagoferreiraw / create_png_from_svg_template.py
Last active November 25, 2021 19:12
create_png_from_svg_template
import cairosvg
def create_png_from_svg_template(svg_path, replace_keys_dict, output_file):
"""
Create a png from a svg template, replacing keys in the svg with custom values.
Args:
svg_path (str): Path to the svg file
replace_keys_dict (dict): Keys to search/replace in the svg, e. g. {"code": 1}
output_file (file-like obj or str): file-like object or path
@thiagoferreiraw
thiagoferreiraw / locust.py
Created November 4, 2021 12:27
Python Locust
import lorem
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 3)
@task(5)
def index(self):
self.client.get("/tasks/")
@thiagoferreiraw
thiagoferreiraw / git-diff-apply.sh
Created September 9, 2021 19:45
Git Diff + git apply
# Escolha sua branch de origem, de onde os commits serão revertidos
git checkout main
# Usando o git log, encontre o hash do commit do ponto que você deseja retornar para.
git checkout f21306c
# Agora vamos fazer uma comparação entre a posição atual do histórico e a main.
# Nesse ponto precisamos confirmar se as mudanças exibidas aqui estão corretas ;)
# Se não estiverem, você provavelmente está no ponto errado do histórico (veja o git log)
git diff main
@thiagoferreiraw
thiagoferreiraw / git-revert.sh
Created September 9, 2021 19:36
Giit Revert
# Escolha sua branch de origem, de onde os commits serão revertidos
git checkout main
# Use o commando git revert com a opção "-n" pra gerar um único commit
# Os ids abaixo podem ser encontrados usando o `git log`
git revert -n f21306c..e330c04 # OLD_COMMIT..RECENT_COMMIT
# Nesse ponto, você já pode usar os comandos de status e diff pra conferir se a alteração está correta:
git status # mostra os nomes dos arquivos alterados
git diff # mostra as mudanças efetivas
@thiagoferreiraw
thiagoferreiraw / 1-views.py
Last active September 1, 2021 13:23
Medium - Metabase + Django - 3
class EmbeddedReportResource(PaginatorMixin, APIResource):
preparer = EMBEDDED_REPORT_LIST_PREPARER
paginate = True
page_size = 40
@property
def base_query(self):
return (
EmbeddedReport.objects.filter(active=True)
.select_related("engine")