Skip to content

Instantly share code, notes, and snippets.

View brenorb's full-sized avatar

Breno brenorb

View GitHub Profile
@brenorb
brenorb / bricx.txt
Created May 7, 2019 13:30
PID controller for Lego bot
/* Techbricks.nl Line Follower
Based on a PID controller, using the NXT 1.0 light sensor
NXC firmware 1.28
www.techbricks.nl
last modified 03/03/2010 Breno version*/
/* Proportional gain, straight forward reaction of the controller
Larger values typically mean faster response since the larger the error,
the larger the proportional term compensation.
An excessively large proportional gain will lead to process instability and oscillation.*/
@brenorb
brenorb / poker.test.js
Created May 4, 2019 22:44
Javascript/Node.js TDD with jest. https://jestjs.io/
import { checkFiveCards, checkCard, checkHand, higherCard } from './poker';
// Should use 'export function' for functions in './poker' file
describe('Checar 5 cartas', () => {
test('checa mão com cinco cartas', () => {
expect(checkFiveCards('2H 3D 5S 9C KD')).toEqual(true);
});
test('checa mão com 4 cartas', () => {
expect(checkFiveCards('2H 3D 5S 9C')).toEqual(false);
@brenorb
brenorb / test_TDD_pytest.py
Last active May 4, 2019 22:46
Python TDD with pytest. https://pytest.org
import twittter_main
# Execute Pytest in the cmd to assert the test.
def test_post_sem_usuario_sem_msg():
assert twittter_main.post('->') == 'Comando invalido!'
def test_post_sem_msg():
assert twittter_main.post("Alice ->") == "Post sem mensagem!"
@brenorb
brenorb / DateSync.bat
Created January 8, 2019 12:44
Syncs computer date and time. Must execute as admin.
net start w32time
w32tm /resync /force
net stop w32time
@brenorb
brenorb / download.sh
Created January 8, 2019 12:36
Shell script to update code in a double click.
#!/bin/sh
#Updates codes
#Author: Breno Brito
#Updated in 13/04/2018
export dir=$PWD
echo Updating website
echo
cd $dir/website