Skip to content

Instantly share code, notes, and snippets.

View varlen's full-sized avatar

Varlen Pavani Neto varlen

View GitHub Profile
@varlen
varlen / oneKeyMidiController.ino
Last active August 29, 2015 14:21
Arduino sketch for (really) minimalist MIDI controller
//One Key MIDI Piano
//This is a test for Serial MIDI output through Arduino USB port
//Used Hairless Midi as Serial->MIDI bridge and one push button on pin 53 of Arduino Mega 2560
//Connect GND|<------{|Button|}------>| Pin 53
//Plays a G#2 which is mapped to cowbell on the drums of GarageBand
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
@varlen
varlen / fotos.ps1
Created December 2, 2015 04:55
Quick and dirty hack to rename a batch of files on Windows using PowerShell.
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
}
}
$Title = "Renomear Fotos Automaticamente";
@varlen
varlen / iHate3Dmovies.js
Last active December 4, 2015 01:15
Use este snippet para esconder as sessões 3D no site da Ingresso.com.
// 2015-12-01 - Varlen Pavani Neto
// Use este snippet para esconder as sessões 3D do site da Ingresso.com
// Esconder todas as sessões 3D
var $hateful3dSessions = $('.tipo-sessao.3D').parents('li.place-hours-it');
$hateful3dSessions.hide();
// Esconder os cinemas que só tiverem sessões 3D
var $allTheaterSessions = $hateful3dSessions.parent();
$allTheaterSessions.each( function( ) {
@varlen
varlen / mailTimer.js
Created December 8, 2015 11:12
Write the email then inject this JavaScript on the page to schedule an email submission.
// No Gmail, o ID do botao sempre muda quando a pagina é atualizada
// Mudar o id na linha abaixo
btnElementID = '';
btn = document.getElementById(btnElementID);
intervalID = window.setInterval( function checkTime() {
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Date
var send_on = new Date( 2015,11,8,6,0 );
var now = new Date();
if ( now.getTime() > send_on.getTime() ) {
console.info( 'Mandei!' ); // Sent
@varlen
varlen / duas_entradas_analogicas.ino
Created December 12, 2016 13:42
Disciplina Antenas 2016-2
int analogPin1 = 1; // 1a. entrada analógica
int analogPin2 = 2; // 2a. entrada analógica
int primeira_vez = 1;
int i = 1; // contador do while que vai calcular a média dos valores de entrada
int k1 = 0; // contador do número de picos que serão encontrados
int sinal_original_um[99];
int sinal_original_dois[99];
int time1[99];
int time2[99];
int contador_de_medidas;
@varlen
varlen / teste_passo_a_passo.ino
Created April 30, 2017 17:14
Código de teste para o motor de passo, girando em um único sentido
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5);
int stepCount = 0; // number of steps the motor has taken
@varlen
varlen / teste_vai_e_volta.ino
Created April 30, 2017 17:15
Teste para motor de passo, girando 50 passos num sentido depois 50 no sentido contrário
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5);
int stepCount = 0; // number of steps the motor has taken
@varlen
varlen / form.php
Last active August 28, 2017 13:07
Exemplos para o Minicurso de Desenvolvimento Web
<?php
/**
* Formulário simples utilizando método POST
*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Minha Página</title>
@varlen
varlen / midi_mapper.py
Created February 20, 2020 03:11
MIDI file mapper using Python
from mido import MidiFile, MidiFile, MidiTrack
# Abrindo o arquivo de origem
input_midi = MidiFile('./Murundu.mid')
# Criando o arquivo de destino e a nova faixa MIDI
output_midi = MidiFile()
# Mantendo o tempo (BPM) entre os arquivos
output_midi.ticks_per_beat = input_midi.ticks_per_beat
@varlen
varlen / tagger.py
Created September 6, 2020 16:10
Adiciona tags ID3 a partir do nome do arquivo
import glob, os, eyed3
#Lendo o diretorio atual
caminho = os.getcwd()
#Gerando a lista de arquivos mp3
playlist = glob.glob(caminho + "\\*.mp3")
print(str(len(playlist)) + " musicas encontradas.")
print(playlist)