Skip to content

Instantly share code, notes, and snippets.

View antonyalkmim's full-sized avatar

Antony Alkmim antonyalkmim

View GitHub Profile
/*
* main.cpp
*
* Created on: 16/05/2016
* Author: puc
*/
#include <avr/io.h>
#include <util/delay.h>
#include "serial.hpp"
@antonyalkmim
antonyalkmim / mongo-autostart-osx.md
Created April 29, 2016 01:20 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@antonyalkmim
antonyalkmim / metodo.newton.js
Last active April 5, 2016 13:16
Método de aproximação Newton para encontrar raízes de equações
var calculateX = function(xInit){
var x = xInit;
var err = Math.pow(10,-5);
var xAux = x;
var i = 0;
do{
xAux = x;
var f = (Math.pow(x,4) + 2*Math.pow(x,3) - 13*Math.pow(x,2) - 14*x + 24).toFixed(5);
var F = (4*Math.pow(x,3) + 6*Math.pow(x,2) - 26*x - 14).toFixed(5);
@antonyalkmim
antonyalkmim / index.js
Last active July 24, 2018 18:18
Textfield masks on Appcelerator Titanium Android. Solution to stop infinite loops when changing value of a textfield inside your change listener on Appcelerator Titanium Android.
var changed = false;
$.texfield.addEventListener("change", function(e){
if(OS_IOS || (OS_ANDROID && !changed)){
e.source.value = "My Mask"; //Masker.toPatter();
}
changed = !changed;
//Set cursor at the end
var len = event.source.value.length;
$.textfield.setSelection(len, len);
@antonyalkmim
antonyalkmim / main.cpp
Last active April 7, 2016 23:07
Semaforo com contador ArduinoUNO
#include <avr/io.h>
#include <util/delay.h>
void display(int num){
switch(num){
case 9:
PORTC = (1 << 4);
PORTB &= ~(1 << 5);