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
/** | |
* 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; |
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
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: |
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
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); |
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
# 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 |
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
# 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 |
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
ArrayList<Rect> rects; | |
float mx, my, mm, time; | |
void setup() { | |
size(720, 720, P2D); | |
generate(); | |
} | |
void draw() { |
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
// 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) { |
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
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 |
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
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: |