Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
@villares
villares / svgtoshapes.py
Created April 27, 2023 18:10 — forked from un1tz3r0/svgtoshapes.py
shapely svg import
''' Read and parse SVG files returning a shapely GeometryCollection containing the paths and primitives found.
Transforms are applied and all shapes are returned in the SVG root elements coordinate space. Primitives (rect,
circle and ellipse) are converted to equivalent paths, and only shape outlines are rendered, stroke properties
have no affect and are discarded.
Curved paths (arc and bezier commands and rounded rect, ellipse and circle elements) are linearized using a
naive approach that attempts to create enough segments to reduce maximum distance to the curve to below a
certain threshold, although this is probably not very efficient and most likely implemented in a fairly
broken way.'''
@villares
villares / symmetry.py
Created June 27, 2019 13:27 — forked from berinhard/symmetry.py
Pythonic Symmetry
# Author: Berin
# Sketches repo: https://github.com/berinhard/sketches
from collections import namedtuple
from abc import ABCMeta, abstractmethod
WHITE = color(235, 235, 235)
BLACK = color(27, 27, 27)
BLUE = color(55,189,182)
def setup():
@villares
villares / processing_gcode_generator.pde
Last active May 8, 2023 22:53 — forked from berinhard/processing_gcode_generator.pde
Simple processing Sketch to generate .gcode files for all SVGs in a directory
/*
This sketch is an adaptation from Sighack's Gcode Export
Blog post: https://sighack.com/post/processing-boilerplate-with-gcode-export
Depends on http://www.ricardmarxer.com/geomerative/
TODO:
[ ] Select directory dialog
[ ] Check file extension
@villares
villares / Input2p5js.ino
Created March 7, 2019 12:13 — forked from mjvo/Input2p5js.ino
Serial Input to P5.js - Arduino and p5js code
void setup() {
Serial.begin(9600); // initialize serial communications @ 9600
}
void loop() {
int potentiometer = analogRead(A0); // read the input pin
int mappedPot = map(potentiometer, 0, 1023, 0, 255); // remap the pot value to fit in 1 byte
//Serial.write(mappedPot); // write mappedPot value to the serial port (1 byte)
Serial.println(potentiometer); // *or* use println to print out raw potentiometer value with newline as data separator
delay(1); // slight delay to stabilize the ADC
@villares
villares / clock.py
Created June 28, 2017 19:19 — forked from fmasanori/clock.py
Clock GUI
import tkinter
from time import strftime
#by Luciano Ramalho
clock = tkinter.Label()
clock.pack()
clock['font'] = 'Helvetica 120 bold'
clock['text'] = strftime('%H:%M:%S')
@villares
villares / QEduAvancada.py
Created May 23, 2017 12:56 — forked from fmasanori/QEduAvancada.py
QEdu Exemplo de Busca Avançada: escolas, em funcionamento, sem energia, água e esgoto
import urllib.request
import json
url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on'
resp = urllib.request.urlopen(url).read()
resp = json.loads(resp.decode('utf-8'))
print ('Número de Escolas em funcionamento sem energia, água e esgoto:', resp[0])
for x in resp[1]:
print (x['nome'], x['cod'])
print (x['cidade'], x['estado'], x['regiao'])
print ()
@villares
villares / QEduAvancada.py
Created May 23, 2017 12:56 — forked from fmasanori/QEduAvancada.py
QEdu Exemplo de Busca Avançada: escolas, em funcionamento, sem energia, água e esgoto
import urllib.request
import json
url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on'
resp = urllib.request.urlopen(url).read()
resp = json.loads(resp.decode('utf-8'))
print ('Número de Escolas em funcionamento sem energia, água e esgoto:', resp[0])
for x in resp[1]:
print (x['nome'], x['cod'])
print (x['cidade'], x['estado'], x['regiao'])
print ()