Skip to content

Instantly share code, notes, and snippets.

View iuriguilherme's full-sized avatar

Iuri Guilherme iuriguilherme

View GitHub Profile
@iuriguilherme
iuriguilherme / the9877654321.py
Last active January 26, 2024 21:15
The 987654321 / 123456789 thing
"""The 987654321 / 123456789 thing"""
import mpmath
import sys
offset = 1e0
limit = 1e1
last = 8
if len(sys.argv) > 1:
@iuriguilherme
iuriguilherme / app.py
Created October 27, 2023 01:20
Multiple forms Quart WTF
@app.route("/test", methods = ['GET', 'POST'])
async def test(*args, **kwargs) -> str:
"""Tests"""
try:
if 'error' in kwargs:
raise Exception(kwargs.get('error'))
print(f"request.form: {await request.form}")
print(f"forms: {[f for f in (await request.form)]}")
print("form-zero" in (await request.form))
user_login_form: QuartForm = UserLoginForm(
@iuriguilherme
iuriguilherme / tzprofiles.txt
Created February 2, 2023 04:22
Proof for tzprofiles.com
I am attesting that this GitHub handle iuriguilherme is linked to the Tezos account tz1TfaiDyZ6YqPVXUXsxBV2oAYE5VanEnvLp for tzprofiles
sig:edsigtv6Gyyfy2iSHBkMELYeYGVJ1BUaxFXGFmk3GNMdaXYoDeZmFAm4YqT7fvzxKCbUrTJi7HBTMQdV1TMysE7FutvfqczvRhm
@iuriguilherme
iuriguilherme / contrasts.py
Last active February 2, 2023 00:20
Finds the best contrast for each color on the 8bit RGB scope
"""Find contrast ratio for colors
TODO: Use scrollbars for color list
pip install numpy"""
import ast
import csv
import functools
import inspect
@iuriguilherme
iuriguilherme / colorchooser.py
Last active February 28, 2024 21:24
Tk color, RGB and HEXCODE converter
"""https://stackoverflow.com/questions/57651030/take-hex-code-rgb-and-d\
isplay-the-color-in-tkinter"""
import tkinter as tk
from tkinter import *
color_list = [
('black', (0, 0, 0)),
('blue', (0, 0, 255)),
('red', (255, 0, 0)),
@iuriguilherme
iuriguilherme / minimalspiral.py
Last active January 25, 2023 19:46
Spiral Minimal Example to break TurtleScreen
"""
Spiral Minimal Example v3
"""
import tkinter
import turtle
i = 1
## YMMV
## j = 2 will raise `ZeroDivisionError: float division by zero` because screen scale is zero
@iuriguilherme
iuriguilherme / spiral.py
Last active January 26, 2023 18:43
Fibonacci Spiral
"""
This was supposed to be a Moiré Fibonacci Spiral for Genuary 23
https://genuary.art/prompts#jan23
However, I couldn't figure out how to pair up a Moiré pattern and a
Fibonacci pattern. So this is just Fibonacci Spirals :P
It has been published as Genuary 18 "Definitely not a grid"
This is made with a 1366x768 screen size
@iuriguilherme
iuriguilherme / cpf.html
Created December 28, 2022 14:01
Verificador de CPF válido em Javascript
/*
* Validador e gerador de CPF em javascript
* Domínio Público 2016
* Faça péssimo uso
*/
// http://run.plnkr.co/plunks/93FPpacuIcXqqKMecLdk/
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
@iuriguilherme
iuriguilherme / marcadagua.py
Last active December 21, 2022 23:46
Marca d'água em PDF
"""https://t.me/pythonbr/288981
Marca d'água em PDF
pip install pypdf2 requests reportlab"""
import io
import requests
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.colors import Color
from PyPDF2 import PdfReader, PdfWriter
"""
Finding the solution for x ^ (x + 1) = (x + 1) ^ x
python main.py m start stop step dps
pip install matplotlib mpmath numpy sympy
Supposed truth values:
2.271823903
2.293053068