Skip to content

Instantly share code, notes, and snippets.

@celsowm
celsowm / HtmlToPdf.php
Created September 6, 2025 15:52
HtmlToPdf.php
<?php
declare(strict_types=1);
final class HtmlToPdf
{
private MiniPdfGlyph $pdf;
private CssParser $cssParser;
private array $cssRules = [];
private array $styleStack = []; // computed CSS stack for current element
<?php
declare(strict_types=1);
class CssParser
{
/**
* Parseia uma string CSS e retorna uma estrutura hierárquica de regras
*/
public function parse(string $css): array
@celsowm
celsowm / HtmlParser.php
Created September 6, 2025 15:51
HtmlParser.php
<?php
declare(strict_types=1);
class HtmlParser
{
private \DOMDocument $dom;
private array $errors = [];
public function __construct(string $html)
{
@celsowm
celsowm / MiniPdfGlyph.php
Last active September 6, 2025 15:08
MiniPdfGlyph.php
<?php
declare(strict_types=1);
final class MiniPdfColor
{
public function getFillOps(string|array|null $color): string // <-- MUDANÇA AQUI
{
$spec = (!is_array($color) || !isset($color['space'])) ? $this->normalize($color) : $color;
@celsowm
celsowm / prompts_pge.md
Last active August 28, 2025 00:01
prompts_pge.md

Ofício de pedido de informação

Com base na petição inicial fornecida, escreva um ofício formal eletrônico da Procuradoria Geral do Estado do Rio de Janeiro, endereçado ao CBMERJ. O ofício deve incluindo um resumo de 2 a 3 parágrafos dos principais pontos mencionados na petição e deve solicitar uma manifestação sobre a veracidade dos fatos da ação judicial, e deve destacar a necessidade de esclarecimentos urgentes sem itens específicos ou destaques extras. Não inclua perguntas extras. Não incluir fundamentação jurídica do autor. O texto deve terminar com uma frase de cortesia e ser assinado pelo Procurador do Estado. Empregue termos condicionais para evitar afirmar categoricamente os fatos narrados.

@celsowm
celsowm / ambiental.csv
Created August 21, 2025 02:30
ambiental.csv
ID_Unidade Nome_Unidade Cidade Ano Consumo_Energia_MWh Fonte_Energia_Renovavel_Percentual Consumo_Agua_m3 Residuos_Gerados_Ton Residuos_Reciclados_Ton Emissoes_Escopo1_tCO2e
UN001 Fabrica de Campinas Campinas 2023 15000 30 80000 1200 700 15000
UN002 Fabrica de Manaus Manaus 2023 22000 15 110000 1800 950 25000
UN003 Centro de Distribuicao de Recife Recife 2023 8000 45 30000 400 350 7000
UN004 Escritorio Central Sao Paulo 2023 5000 90 15000 150 140 2000
UN001 Fabrica de Campinas Campinas 2022 15500 25 85000 1250 600 16500
UN002 Fabrica de Manaus Manaus 2022 23000 10 118000 1900 800 27000
UN003 Centro de Distribuicao de Recife Recife 2022 8200 40 33000 420 340 7500
UN004 Escritorio Central Sao Paulo 2022 5100 85 16000 160 145 2200
@celsowm
celsowm / vendas.csv
Created August 21, 2025 02:28
vendas.csv
id_venda produto_vendido quantidade_vendida data_venda
1 Camiseta 2 2023-10-25
2 Tênis 1 2023-10-25
3 Boné 5 2023-10-26
4 Camiseta 3 2023-10-27
5 Calça Jeans 2 2023-10-27
@celsowm
celsowm / vllm_error.txt
Created August 9, 2025 00:07
vllm_error.txt
INFO 08-08 17:04:52 [__init__.py:241] Automatically detected platform cuda.
(APIServer pid=1) INFO 08-08 17:04:54 [api_server.py:1787] vLLM API server version 0.10.2.dev2+gf5635d62e.d20250807
(APIServer pid=1) INFO 08-08 17:04:54 [utils.py:326] non-default args: {'model': '/model', 'max_model_len': 32768, 'served_model_name': ['gpt-oss-20b']}
(APIServer pid=1) INFO 08-08 17:04:58 [config.py:726] Resolved architecture: GptOssForCausalLM
(APIServer pid=1) ERROR 08-08 17:04:58 [config.py:123] Error retrieving safetensors: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: '/model'., retrying 1 of 2
(APIServer pid=1) ERROR 08-08 17:05:00 [config.py:121] Error retrieving safetensors: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: '/model'.
(APIServer pid=1) INFO 08-08 17:05:00 [config.py:3628] Downcasting torch.float32 to torch.b
@celsowm
celsowm / index.htm
Last active July 30, 2025 02:30
AutocompleteTextarea
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autocomplete Aprimorado com Lazy Loading</title>
<style>
/* Estilos Gerais */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@celsowm
celsowm / main.c
Created July 26, 2025 03:47
red cube and jump jo engine
/*
* Cubo 3‑D com pulo correto – JoEngine
* Controles: D‑Pad move | Botão A pula
*/
#include <jo/jo.h>
#include <stdbool.h>
/* ---------- parâmetros ---------- */
#define CUBE_SIZE 32