Skip to content

Instantly share code, notes, and snippets.

View alvesoaj's full-sized avatar

AJ Alves alvesoaj

View GitHub Profile
# rand generate 6 numbers in range of 1 to 60, and print ordered
(1..60).sort_by{ rand }[1..6].sort
@alvesoaj
alvesoaj / temp-fuzzy.ino
Created November 19, 2012 13:57
Temperature example with Fuzzy avaliation
#include <FuzzyRule.h>
#include <FuzzyComposition.h>
#include <Fuzzy.h>
#include <FuzzyRuleConsequent.h>
#include <FuzzyOutput.h>
#include <FuzzyInput.h>
#include <FuzzyIO.h>
#include <FuzzySet.h>
#include <FuzzyRuleAntecedent.h>
@alvesoaj
alvesoaj / zerokol.com
Created July 6, 2018 20:50
Simple NGINX setup to serve a static site
# redirect www to @
server {
server_name www.zerokol.com;
rewrite ^(.*) http://zerokol.com$1 permanent;
}
server {
listen 80;
server_name zerokol.com;
server_tokens off;
@alvesoaj
alvesoaj / reed-switch-test.ino
Last active August 9, 2018 01:33
Conecting a Reed Switch with Arduino
/*
* AJ Alves (aj.alves@zerokol.com)
*/
const int REED_SWITCH_PIN = 3; // Reed Switch Pin
void setup() {
Serial.begin(9600); // Init serial 9600
pinMode(REED_SWITCH_PIN, INPUT); // Set pin as INPUT
}
@alvesoaj
alvesoaj / test_nrf24l01_nodemcu_receiver.ino
Created August 12, 2018 14:42
To test NodeMCU as a receiver, conected with nRF24L01
/*
* AJ Alves (aj.alves@zerokol.com)
*/
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
// Instantiate RF24 class with CE and CSN values
RF24 radio(2, 15);
/*
Definição da classe Pessoa: Pessoa.h
*/
#ifndef PESSOA_H
#define PESSOA_H
#include "string"
using std::string;
class Pessoa
/*
Implementação da classe Pessoa: Pessoa.cpp
*/
#include "Pessoa.h"
Pessoa::Pessoa(){};
void Pessoa::setNome(string nome)
{
// Arquivo de testes: pessoa-teste.cpp
#include "Pessoa.h"
#include "gtest/gtest.h"
#include "string"
using std::string;
TEST(Pessoa, testarMetodosParaNome)
{
string nome = "AJ O. Alves";
/*
Definition on Person class: Person.h
*/
#ifndef PERSON_H
#define PERSON_H
#include "string"
using std::string;
class Person
/*
Implementation of Person class: Person.cpp
*/
#include "Person.h"
Person::Person(){};
void Person::setName(string name){
this->name = name;