Moved to:
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
""" | |
Alexandre B A Villares | |
árvore recursiva - Circuito SESC de arte 2018 - v2022_08_06 | |
http://abav.lugaralgum.com/lousa-magica | |
Para executar é necessário: | |
py5 (Usando Thonny IDE com o thonny-py5mode ative o *imported mode*) | |
PyFirmata | |
""" |
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
""" | |
Alexandre B A Villares | |
Lousa mágica - desenho com potenciômetros v2022_08_04 | |
http://abav.lugaralgum.com/lousa-magica | |
Para executar é necessário: | |
py5 (Usando Thonny IDE com o thonny-py5mode ative o *imported mode*) | |
PyFirmata | |
""" |
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 | |
import pymunk | |
MINIMUM_DIST = 10 | |
current_poly = [] # (x, y) tuples while mouse dragging | |
wall_start = None | |
drawing_dict = {} | |
save_filename = 'data.pickle' | |
mass_scale = 0.1 | |
em_andamento = True |
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 pymunk | |
CT_DEFAULT = 0 | |
CT_SPECIAL = 1 | |
CT_WALL = 2 | |
MINIMUM_DIST = 50 | |
current_poly = [] # (x, y) tuples while mouse dragging | |
wall_start = None | |
drawing_dict = {} |
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
# https://docs.opencv.org/4.x/d4/dee/tutorial_optical_flow.html | |
import py5 | |
import numpy as np | |
import cv2 # opencv-python | |
cap = None | |
py5_img = None | |
prvs_frame = None | |
reduced_size = 600, 400 |
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 https://open-meteo.com/en/docs#latitude=-23.5475&longitude=-46.6361&hourly=temperature_2m,rain | |
import openmeteo_requests # pip install openmeteo-requests | |
import requests_cache # install requests-cache | |
import pandas as pd # install pandas | |
from retry_requests import retry # install retry-requests | |
# Setup the Open-Meteo API client with cache and retry on error | |
cache_session = requests_cache.CachedSession('.cache', expire_after = 3600) |
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
""" | |
This is quick adaptation from my py5 imported mode sketch at: | |
https://abav.lugaralgum.com/sketch-a-day/#sketch_2024_07_09 | |
Use arrows to play - up to rotate, space bar to restart. | |
What changed: py5pjs didn't have random_choice, so I had to import it, and | |
in pyp5js the arrow key constants are different ARROW_LEFT and not LEFT, etc. | |
""" |
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
""" | |
Usage: | |
from my_hackmd import API | |
api = API(your_access_token) # get one at https://hackmd.io/settings#api (please don't publish it in your repo!) | |
user_notes = api.get_note_list() | |
new_note_data = api.create_note( | |
title="My Ha", | |
content="# Ha\nhahaha", |
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 taichi as ti | |
import taichi.math as tm | |
import py5 | |
#ti.init(arch=ti.gpu) | |
ti.init() | |
@ti.func | |
def complex_sqr(z): # complex square of a 2D vector | |
return tm.vec2(z[0] * z[0] - z[1] * z[1], 2 * z[0] * z[1]) |
NewerOlder