This file contains 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 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 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 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 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) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
""" | |
Under Creative Commons License | |
https:#creativecommons.org/licenses/by-sa/4.0/ | |
Ported for Processing Python Mode py.processing.org <- for Processing IDE | |
by Alexandre Villares abav.lugaralgum.com, 9-Oct-2018 | |
Based upon code for p5js.org at https://jcponce.github.io/misc/lotusrosettes.html | |
by Juan Carlos Ponce Campuzano, 9-Oct-2018 | |
Based upon Dan Anderson's code | |
https:#www.openprocessing.org/sketch/519299 | |
""" |
This file contains 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 | |
from shapely.geometry import Polygon, MultiPolygon, GeometryCollection, LineString, Point | |
from shapely.ops import unary_union | |
MIN_GAP = 10 | |
MIN_LT = 5 # minimum line thickness | |
SVG_SUFIX = 'output.svg' | |
save_svg = False | |
line_thickness = 10 |
This file contains 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
# for Processing Python Mode | |
# https://abav.lugaralgum.com/como-instalar-o-processing-modo-python/index-EN.html | |
add_library('pdf') # equivale a importar a lib de PDF no Processing | |
mode_3D = True # modo 3D ou 2D (muda com tecla '3') | |
save_pdf = False # Avisa que vai exportar, tecla 's' | |
seed = 5465 # "semente" que trava os sorteios dos números aleatórios e do noise | |
s = 0.005 # noise scale |
This file contains 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
# based on https://www.jpytr.com/post/game_of_life/ | |
# previous version calculated neighbours twice at each step... it could be useful to color cells but I removed it. | |
import py5 | |
import numpy as np | |
from scipy.signal import convolve2d | |
board_img = None | |
def setup(): |