Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
@luis-c465
luis-c465 / convert.py
Created March 21, 2024 14:00
Replaces exponential form of numbers in an svg with their decimal format, `3e-5` => `0.00003`
import decimal
import re
INPUT_FILE = "input.svg"
OUTPUT_FILE = "output.svg"
DECIMAL_DIGITS = 10
REGEX = r"[0-9.]+e-\d+"
# https://regex101.com/r/9SaiS7/1
@mdipierro
mdipierro / example.py
Created January 23, 2024 06:54
Python script that makes its own nix-shell
#! /usr/bin/bash
"""":
# if Nix not installed, install it, then rerun this script with nix-shell
[ -f /etc/nix/nix.conf ] || curl -L https://nixos.org/nix/install | sh -s -- --daemon
exec nix-shell --command "python $0 $@" \
-p python311 \
-p python3Packages.numpy
# add any package you want above and they will be added to the shell
exit 1
""" #"
@turicas
turicas / Transcrição de textos em Português com whisper (OpenAI).ipynb
Last active March 27, 2024 22:12
Transcrição de textos em Português com whisper (OpenAI)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@esnosy
esnosy / blender_pyqt6.py
Last active January 8, 2023 20:31
How to use PyQt6 in Blender
# tip: you can run Blender using an alternative Python environment to get access to PyQt6
# for example I created a conda environment with PyQt6 installed, then executed blender with these args:
# ~/Downloads/blender-3.4.1-linux-x64/blender --env-system-python /home/iyad/miniconda3/envs/pyqt6/
from PyQt6.QtWidgets import QApplication, QLabel
import bpy
# Process Qt event loop using a Blender timer
# note we do not use app.exec() at the end of the script, it will block Blender
def event_loop_timer():
@jsbueno
jsbueno / tkasync.py
Last active September 7, 2021 03:10
asyncio tkinter
"""
Sample file to enable tkinter to run with co-routine and asyncio code
with no need for extra threads or blocking the UI
(this will likely be upgraded to a full package at some point in time)
"""

Twitter abuses all media file uploads, each type in its own way. If we want to upload a good looking animation loop from some low-color, high-detail generative art, we have to game their system's mechanisms.

  • don't upload a video file, they will re-encode it into absolute 💩

  • create a GIF, which they will auto-convert into a video file 😱

  • The frames of the GIF will be resized to an even-sized width using an extremely naive algorithm. Your GIF should be an even size (1000, 2000,

@yorikvanhavre
yorikvanhavre / FreeCAD-como-instalar.md
Created April 27, 2021 11:41
Hello World com o FreeCAD

O que é e como instalar o FreeCAD

O FreeCAD é um aplicativo de modelagem 3D paramétrico. Diferentemente de aplicativos de modelagem mais "livre" como o Blender, o FreeCAD oferece uma modelagem mais lenta, mas mais precisa e baseada em sólidos e curvas NURBS. O sistema paramétrico permite também criar vários tipos de relações entre objetos. Assim como o Blender, o FreeCAD é altamente extensível e fácil de programar em Python.

Como instalar

O FreeCAD é bem fácil de instalar, basta baixar o pacote de instalação correspondente a sua plataforma a partir da página oficial.

Linux

@ruda
ruda / oblique.txt
Last active October 20, 2021 23:11
Estratégias Oblíquas do Rudá (2021)
1. Das partes mais genéricas ao mais específico, de cima para baixo (Top-Down).
2. Das partes mais específicas, para o todo, de baixo para cima (Bottom-Up).
3. O que o personagem Sheldon Cooper faria em seu lugar?
4. Se as opções laterais estão bloqueadas,a saída por ser ir para cima ou para baixo.
5. Técnicas como "Padrões de Projetos" não são tão importantes quanto o resultado final.
6. Refaça com parcimônia e sabedoria.
7. Não corra contra o fluxo, siga o seu fluxo.
8. O Donal Knuth começou a série de volumes sobre computação (TAOCP) imaginando que seria apenas um livro.
9. Experimente fazer um protótipo, antes de pensar demais sobre o problema.
10. Pense antes no problema, antes de sair implementando de forma expontânea.
@volfegan
volfegan / ASCII_bicycleRace.pde
Created September 2, 2020 02:21
ASCII art Animation for a night bicycle race, birds, moon, stars
//common variables
float i, t=0, w=1280, h=720;
//stars
float[] x = new float[(int)h/2];
float[] y = new float[(int)h/2];
//moon
float g=sqrt(5)/2+.5, a, r;
char[]c={'', '', '', '', '', '', '', ''};
//birds & bikes
float k=0, m, n;
function iFrameFix(aId, divId) {
const $a = document.getElementById(aId);
const $div = document.getElementById(divId);
const renderIframe = (img = {}) => {
const w = img.naturalWidth || 100;
const h = img.naturalHeight || 100;
$div.innerHTML = `<iframe src="${a.href}" frameborder=0 width="${w}" height="${h}"></iframe>`;
};
if ($a !== null && $div !== null) {
let img = div.querySelector("img");