This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import py5 | |
fator_escala = 3.78 * 50 / 189 | |
NOME = "caixa_flex-v1" # Precisa ser cortado 2x! só desenha "meia caixa" | |
W, H, P = 200, 120, 50 # dimensões | |
R = 30 # raio | |
XO, YO = 50, 50 # offset do desenho na página | |
def setup(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------------------------------------------------------- | |
# From Pytnon to Numpy | |
# Copyright (2017) Nicolas P. Rougier - BSD license | |
# More information at https://github.com/rougier/numpy-book | |
# ----------------------------------------------------------------------------- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.path import Path | |
from matplotlib.animation import FuncAnimation | |
from matplotlib.collections import PathCollection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An example/template for generating a mutiple page PDF using py5. | |
Imported mode style - You'll need to use the thonny-py5mode plug-in or the sketch_runner tool | |
CC0 / Public Domain dedication - by Alexandre B A Villares | |
""" | |
NUM_PAGES = 10 | |
s = 0.71 # scale factor 1 => 356 x 275 trying 252 x 195 | |
rs = 1 # starting random seed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
from pathlib import Path | |
import osmnx as ox | |
from download_from_gdrive import download_from_gdrive | |
# configure the place, network type, trip times, and travel speed | |
place = {"city": "São Paulo", "country": "Brazil"} | |
network_type = "walk" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using py5 imported mode (https://py5coding.org to learn more) | |
def setup(): | |
size(600, 600) # drawing size | |
output_canvas = create_graphics(width, height) | |
background(255, 0, 0) # you can turn this off, this won't be recorded! | |
begin_record(output_canvas) # starts recording | |
# output_canvas.clear() # clears pixels (not necessary in this case) | |
color_mode(HSB) # this needs to be inside the recording! | |
no_stroke() # same as with the color_mode, has to be brought here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO quando som termina, retomar não recomeça | |
# (mudar para próximo som autmaticamente?) | |
from pathlib import Path | |
import pygame | |
# Procura arquivos .mp3 na mesma pasta | |
folder = Path.cwd() # se quiser pode trocar por Path('/caminho/pasta/') | |
audio_files = [fp for fp in sorted(folder.iterdir()) | |
if fp.name.lower().endswith('.mp3')] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Make a PDF A3 zine combining 8 pages from a source PDF | |
WIP: I'd like to have an option for the 9th page (index=8) to be a poster in the backside or not. | |
------------------------------------------------------------------------------- | |
License: GNU GPL V3 | |
(c) 2023 Alexandre Villares | |
Based on https://github.com/pymupdf/PyMuPDF-Utilities/blob/master/examples/combine-pages/combine.py | |
(c) 2018 Jorj X. McKie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /home/villares/thonny-python-env/bin/python3 | |
""" | |
MP4 to GIF animation. Depends on moviepy and ffmpeg. | |
""" | |
import argparse | |
from moviepy.editor import * | |
parser = argparse.ArgumentParser(prog='Create a GIF animation from a MP4 file. Depends on moviepy and ffmpeg.') | |
parser.add_argument('-i', '--input', help='Input .mp4 file.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import py5 | |
from py5 import Py5Image | |
old_new = Py5Image.__new__ | |
def new_new(self, *args): | |
if args: | |
return old_new(self, *args) |