Skip to content

Instantly share code, notes, and snippets.

View villares's full-sized avatar
💥

Alexandre B A Villares villares

💥
View GitHub Profile
"""
* Listing files in directories and subdirectories
* inspired by an example by Daniel Shiffman.
*
* 1) List the names of files in a directory
* 2) List the names along with metadata (size, lastModified)
* of files in a directory
* 3) List the names along with metadata (size, lastModified)
* of files in a directory and all subdirectories (using recursion)
"""
@fmasanori
fmasanori / super salários USP.py
Created July 4, 2017 23:27
Super Salários USP
"""
Autores:
Tiago Henrique da Cruz Pereira
João Felipe de Moraes Borges
"""
import threading
import time
import os
from urllib.request import urlopen
@GoToLoop
GoToLoop / CircleMutualAttraction.pyde
Last active March 30, 2018 04:05 — forked from Speykious/CircleMutualAttraction
This is an example for the library Fisica for Processing in Python.
"""
CircleMutualAttraction (v2.3.8)
by Speykious (2017-Jun-27)
mod GoToLoop (2017-Jun-29)
https://Forum.Processing.org/two/discussion/23226/
new-python-example-for-the-fisica-library#Item_2
https://Gist.GitHub.com/GoToLoop/1861619991354ed7d063026658270689
"""
@dkilmer
dkilmer / veg_gen.pde
Created June 1, 2017 00:43
Creates random 32x32 tiles that can be connected together to make a pattern
/*
* Generates 32x32 tiles that can be connected with conduits on one or
* more sides. The basic process is:
*
* 1. Draw a bunch of random boxes with color X, none of which touch the outer perimeter.
* 2. draw some conduits from the edges -- each conduit is two color-X lines going toward
* the center until they hit a color-X pixel
* 3. flood fill from the four corners of the perimeter with color Y.
* 4. erase all X-color pixels that don't have an adjacent Y-color pixel in the four
* cardinal directions.
@biazzotto
biazzotto / export_guetzli.py
Last active July 30, 2018 17:53
GIMP Plugin that allows exporting as JPEG using the Google Guetzli
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gimpfu import *
from os import remove, name
from os.path import basename
from tempfile import NamedTemporaryFile
from subprocess import check_output, CalledProcessError, STDOUT
# Export with Google Guetzli Perceptual JPEG encoder
@mjvo
mjvo / Input2p5js.ino
Last active March 7, 2019 12:13
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
@yorikvanhavre
yorikvanhavre / mdview.php
Created March 3, 2016 15:45
This script generates a nice HTML rendering of a Markdown file that is hosted and shared on an owncloud server, using strapdownjs.com.
<?php
// mdview.php by Yorik van Havre, GPL license
// This script generates a nice HTML rendering of a Markdown file that is hosted and
// shared on an owncloud server, using strapdownjs.com.
// To use it, simply place this file somewhere on your web space, and call it with the
// following arguments: http://path/to/mdview.php?file=XXXXXXXX&theme=spacelab
// the XXXXXXX is the share code from the link you obtain when sharing a file in owncloud.
// theme is optional, and can be one of the themes described on strapdownjs.com. If not
// provided, the spacelab theme is used (with a bit of changes I did in the <style> tag below)
@atduskgreg
atduskgreg / PWindow.pde
Last active November 15, 2023 13:29
Example of creating a Processing sketch with multiple windows (works in Processing 3.0)
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
void settings() {
size(500, 200);
}
@searls
searls / github-wiki-override-test-double-style.css
Last active May 11, 2021 16:33
Some CSS that will make Github Wiki content full-screen friendly (useful when presenting). Override with your browser or an extension like greasemonkey or Stylish to apply to the wikis you want.
/* and now with 100% more branding */
body { border: 10px solid #82FA32; min-height: 720px; }
.container { width: inherit; }
.header { display: none; }
.gh-header { padding: 30px 0px 30px 0px; background-color: black; color: white; }
.gh-header-actions { float: inherit; text-align: center; }
.btn-primary { border-color: #000; background-image: linear-gradient(#333, #000); }
.gh-header-actions .btn { float: inherit; }
.gh-header-title { padding-top: 20px; text-align: center; font-size: 4.2em; margin-right: 0px; font-weight: 100; }
.pagehead { display: none; }
@drgarcia1986
drgarcia1986 / schools_async.py
Created June 29, 2015 21:59
Escolas, em funcionamento, sem água, energia e esgoto, mostrando alguns detalhes (versão asyncio) (baseado em https://gist.github.com/fmasanori/4d6b7ea38a28681a513a)
import asyncio
import json
import aiohttp
SCHOOL_URL_FMT = 'http://educacao.dadosabertosbr.com/api/escola/{}'
SEARCH_SCHOOL_URL = (
'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?'
'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&'