Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
@GoToLoop
GoToLoop / CanvasResizeWatcher.java
Last active March 26, 2019 17:57
Canvas Resize Watcher
/**
* Canvas Resize Watcher (v1.0)
* GoToLoop (2018/May/04)
* Developed on P3 (v3.3.5)
*
* https://Discourse.Processing.org/t/event-called-when-canvas-is-resized/6643/8
* https://Gist.GitHub.com/GoToLoop/1d1eb18f468a7d5758469707276b6ea1
*/
package gotoloop.listener;
@fmasanori
fmasanori / booyermoore.py
Last active September 14, 2018 12:36
BooyerMoore
def boyermoore(p, t):
m = len(p)
n = len(t)
if m > n: return -1
pulo = [m for k in range(256)]
for k in range(m - 1):
pulo[ord(p[k])] = m - k - 1
pulo = tuple(pulo)
k = m - 1
while k < n:
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@reichaves
reichaves / code.py
Created April 10, 2018 00:36
Experimento com CircuitPython no Python Lab do Garoa Hacker Clube em 20180409
# biblioteca responsável por cada um dos componentes da Adafruit
import board
# biblioteca responsável pela entrada e saída do LED
import digitalio
# biblioteca responsável pelos leds NeoPixel
import neopixel
# bibliote responsável pelos touchs
import touchio
import time
@mgritter
mgritter / enumeratemazes.py
Created March 6, 2018 22:53
Enumeration of spanning subgraphs of the NxN grid
# Problem:
# How many possible mazes are there on an NxN grid? Where a maze is a
# collection of links between grid nodes such that each node has 1-4 links
# and has a path to every other node.
# -- @relsqui, https://twitter.com/relsqui/status/970555868390465536
#
# This counting approach implements a method similar to that described in
# "Spanning Trees in Grid Graphs", Paul Raff, https://arxiv.org/pdf/0809.2551.pdf
#
# The key idea is to create a transition matrix counting the number of
@manoloide
manoloide / rectShadows.pde
Created January 9, 2018 07:48
Rect Shadows Particles
ArrayList<Rect> rects;
float mx, my, mm, time;
void setup() {
size(720, 720, P2D);
generate();
}
void draw() {
// gif by dave @beesandbombs
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@Felipe-UnB
Felipe-UnB / grab_pdfs.py
Last active March 3, 2021 18:11 — forked from elssar/grab_pdfs.py
Download all the pdf files linked in a given webpage.
def get_pdf(base_url, base_dir):
#!/usr/bin/env python
"""
Download all the pdfs linked on a given webpage
Usage -
python grab_pdfs.py url <path/to/directory>
url is required
path is optional. Path needs to be absolute
will save in the current directory if no path is given
@feromes
feromes / Mapeamento sonoro e softwares livres.pdf
Last active November 2, 2017 13:52
Levantamento de softwares livres e sistemas colaborativos para mapeamento e estudo sonoro
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cayusmatias
cayusmatias / valida_nit_nb.py
Last active April 10, 2024 13:24
Função Python para validar número de benefício previdenciário NB, bem como NIT e PIS
import re
def valida_nit_nb(valor):
"""
Valida um número de NIT/NB (Número de Identificação do Trabalhador).
Parâmetros:
- valor (str|int): Número do NIT/NB a ser validado.
Retorna: