Skip to content

Instantly share code, notes, and snippets.

@eduardodx
eduardodx / ruby_shuffle_files.rb
Created June 26, 2011 13:38
Ruby Shuffle Files
# encoding: utf-8
# Ruby script to shuffle files, pass the folder name as the first argument (necessary),
# and -f after folder name if you want to really sort them
# example: ruby ruby_shuffle_files.rb my_folder -f
folder = ARGV[0] + "/"
loop_times = (ARGV[1] != nil && ARGV[1] == "-f") ? 3 : 1
qtd_files = 0
@eduardodx
eduardodx / fibonacci_sequence.js
Created July 26, 2011 04:10
Fibonacci Sequence
function fibonacci(n) {
if( n == 0 || n == 1 ){
return n;
} else {
return fibonacci(n-1) + fibonacci(n-2);
}
}
@eduardodx
eduardodx / arduino_simon_says.pde
Created November 9, 2011 23:01
Arduino - Simon Says
/**
* Arduino - Simon Says
* ELTN.4M - Douglas Antunes, Eduardo Souza, Joao Gabriel e Mateus Mahado
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int rounds = 50;
@eduardodx
eduardodx / led_serial_0_255.pde
Created November 22, 2011 23:28
Led_Serial_0_255
char letra[4]={'a','b','c','d'};
int brilho [4]={0,80,160,255};
int stateLed=10;
int infoLed=9;
int info;
int flag = 0;
int resMaster = 0;
String number;
@eduardodx
eduardodx / arduino_relogio_despertador.pde
Created December 1, 2011 11:23
Arduino Relogio Despertador
#include <Wire.h>
int state;
byte SW0 = 3;
byte SW1 = 2;
byte SW2 = 1;
byte minutes;
byte hours;
@eduardodx
eduardodx / gist:1618807
Created January 16, 2012 02:59 — forked from stammy/gist:1610222
some startups on tumblr (that should probably move off tumblr)
http://tumblr.everlane.com/
http://blog.hipmunk.com/
http://blog.shoplrapp.com/
http://blog.mailgun.net/
http://blog.grooveshark.com/
http://blog.path.com/
http://blog.instagram.com/
http://blog.oink.com/
http://blog.shelby.tv/
http://blog.roamz.com/
@eduardodx
eduardodx / arduino_i2c_slave.ino
Created January 26, 2012 23:19
Arduino - I2C Slave
#include <LiquidCrystal.h>
#include <Wire.h>
int x, y, resposta = 0;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup() {
lcd.begin(16, 2);
lcd.home();
Wire.begin(2);// Inicia a comunicação I2c, e este arduino possui endereço 2
@eduardodx
eduardodx / arduino_i2c_master.ino
Created January 26, 2012 23:21
Arduino - I2C Master
#include <LiquidCrystal.h>
#include <Wire.h>
int x, y, resposta = 0;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup() {
lcd.begin(16, 2);
lcd.home();
Wire.begin();// Inicia a comunicação I2C, o Master não precisa de endereço
@eduardodx
eduardodx / ard_elevador_master.ino
Created January 27, 2012 18:37
Arduino - Elevador - Master
#include <Wire.h>
int botoesEstado[4], portasEstado[5], movimentacaoEstado[3], andar = 0;
int chamadasExternas[4], chamadasInternas[4], reqAbrir, reqFechar, emergencia = 0;
int listaPrincipal[4], listaEspera[4] = {0};
void setup () {
Wire.begin(); // Define como Master
@eduardodx
eduardodx / test.ino
Created January 27, 2012 19:37
Test
void setup() {
Wire.begin( 2 );
Wire.onRequest( requestEvent );
Wire.onReceive( receiveEvent );
}
void requestEvent(){