Skip to content

Instantly share code, notes, and snippets.

View iuriguilherme's full-sized avatar

Iuri Guilherme iuriguilherme

View GitHub Profile
@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
@iuriguilherme
iuriguilherme / coloridacci.py
Last active November 27, 2022 23:05
Fibonacci Word Fractal Colorized
"""
Fibonacci Word Fractal Colorized
Public Domain Fibonacci Day (November 23) 2022
Copy pasted and adapted from these sources:
https://rosettacode.org/wiki/Fibonacci_word/fractal#Python
https://python-forum.io/thread-25822.html
https://github.com/francofgp/dragon-curve
https://stackoverflow.com/questions/35629520/
https://stackoverflow.com/questions/73388248/
@iuriguilherme
iuriguilherme / config.py
Created July 18, 2022 20:15
Colocar main.py e config.py no mesmo diretório
"""Arquivo de configuração"""
attr: str = "Original"
def func(n: int) -> int:
"""Multiplica um número natural por 3"""
return n * 3
## https://mcsp.wartburg.edu/zelle/python/graphics.py
from graphics import *
import random
import time
# configurations
WIDTH = 1000
GRID_HEIGHT = WIDTH
HEIGHT = 470
@iuriguilherme
iuriguilherme / index.html
Last active June 9, 2022 02:11
Pyscript showcase
<!DOCTYPE html>
<html lang = "en">
<head>
<!--
This is mandatory for latin characters, because there's just no standard
in web browsers, and probably there'll never be
-->
<meta charset = "utf-8" />
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
@iuriguilherme
iuriguilherme / hackerEvolution.py
Last active February 1, 2026 22:10
Hacker Evolution interactive trace time calculator
"""
Hacker Evolution trace time calculator
Also for Hacker Evolution: Untold
Based on research from https://steamcommunity.com/sharedfiles/filedetails/?id=121869669
"""
## Defaults
firewall = 0 # no firewall
cpu = 1 # 1Ghz CPU
modem = 1 # 1 mbps modem
@iuriguilherme
iuriguilherme / app.py
Created March 27, 2022 05:26
Web form with telegram bot
## This code makes a web form to send messages to telegram users
## pip install aiogram quart flask-wtf
## QUART_APP=app:app quart run
import logging
logger = logging.getLogger(__name__)
import asyncio, secrets
from aiogram import (
Bot,
@iuriguilherme
iuriguilherme / filesystem_watch.py
Created March 22, 2022 14:51
Monitor files being accessed recursively
#!/bin/env python
import datetime, glob, os, sys
try:
## Default to pwd
root = './'
## For python files in the current folder (and subfolders recursively) this would be `filesystem_watch.py './' '/*.py'`
pattern = ''
#!/bin/bash
## Backup incremental do banco de dados do wordpress
## Precisa de mysqldump e rdiff-backup
## Pronto pra rodar com crontab
## Mantém arquivos temporários com alta compressão em /tmp/backups
## Usa arquivo de configuração do wordpress para pegar os dados do mysql opcionalmente
NOW="$(date +%s)"
SITE="wordpress"