Skip to content

Instantly share code, notes, and snippets.

View iuriguilherme's full-sized avatar

Iuri Guilherme iuriguilherme

View GitHub Profile
"""
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 / 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"
@iuriguilherme
iuriguilherme / git-dump.py
Created February 20, 2021 00:19
Dump all git repositories
## Dump all git repositories from selected users. In this example notabug.org and github.com are used
## Change the dictionary "repos" to your own data
## Needs https://gitpython.readthedocs.io/
## pip install GitPython
import git, logging, os
from git import Git, Repo, Remote, RemoteProgress
repos = {
'notabug': {
@iuriguilherme
iuriguilherme / move.sh
Created January 5, 2021 21:06
Move files safely across filesystems
#!/bin/bash
## This script will move safely all files and folders in the arguments list to the last argument. It uses rsync so it can be sent to remote servers.
rsync -avvhSP --remove-source-files "$@"
for DIR in "${@}"
do
## like `rmdir` but recursively for every argument (only removes empty directories)
find "${DIR}" -type d -empty -delete
done