Skip to content

Instantly share code, notes, and snippets.

View scalone's full-sized avatar

Thiago Scalone scalone

  • CloudWalk
  • São Paulo / SP
View GitHub Profile
require 'file1'
require 'app1'
require 'file2'
require 'app2'
require 'app3'
require 'app4'
require 'app5'
require 'file3'
##
# Array ISO Test
assert('Array', '15.2.12') do
assert_equal(Class, Array.class)
end
assert('Array inclueded modules', '15.2.12.3') do
assert_true(Array.include?(Enumerable))
end
#ifdef NDEBUG
#define debug(M, ...)
#else
#define debug(M, ...) fprintf(stderr, "DEBUG %s:%d: " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#endif
#define clean_errno() (errno == 0 ? "None" : strerror(errno))
#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
require 'artoo'
connection :raspi, :adaptor => :raspi
device :led, :driver => :led, :pin => 11
work do
every 1.second do
led.toggle
end
end
require 'artoo'
connection :arduino, adaptor: :firmata, port: '/dev/ttyACM0'
device :led, driver: :led, pin: 13
device :button, driver: :button, pin: 2, interval: 0.01
work do
puts "Press the button connected on pin #{ button.pin }..."
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '/dev/rfcomm0' #linux
device :sphero, :driver => :sphero
connection :pebble, :adaptor => :pebble
device :watch, :driver => :pebble, :name => 'pebble'
api :host => '0.0.0.0', :port => '8080'
name 'pebble'
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '/dev/rfcomm0' #linux
device :sphero, :driver => :sphero
connection :pebble, :adaptor => :pebble
device :watch, :driver => :pebble, :name => 'pebble'
api :host => '0.0.0.0', :port => '8080'
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void XorBuffer(char * buffer1, char * buffer2, int len, char * dest)
{
int i;
for(i = 0; i < len; i++)
{
dest[i] = buffer1[i] ^ buffer2[i];
module VersionFlat043
BLOCK = Proc.new do
class IO
def self.a; puts "Device Included Class a"; end
def b; puts "Device Included Instance b"; end
end
end
def self.flat klass
klass.class_eval &BLOCK
end
package main
import (
"fmt"
"encoding/hex"
)
func main() {
sample1 := "\xbd\xb2\x3d\xbc\x20\xe2\x8c\x98"
str := "30bdb23dbc20e28c98"