Skip to content

Instantly share code, notes, and snippets.

View hualro's full-sized avatar

Hugo Alvarado hualro

  • http://www.heb.com
View GitHub Profile
function asEV(lux) {
return Math.log2(lux/2.5);
}
function asLux(ev) {
return Math.pow(2, ev) * 2.5;
}
function asLux(fc) {
return fc * 10.76;
@hualro
hualro / app.js
Last active August 29, 2015 14:16
list dir contents and return JSON with Node.js
/**
*
* Author: Hugo Alvarado
* Version 1.0
* March 01, 2015 - 7:53 PM
*/
var http = require('http');
var fs = require('fs');
var app = http.createServer(function(request, response) {
@hualro
hualro / aftermovie.sh
Created March 8, 2015 23:21
aftermovie.sh
#!/bin/bash
# Author: Hugo Alvarado
# Date: March 8, 2015
#This parameter is the full path to the movie created by Motion.
MOVIE=$1
echo "Uploading Movie: $MOVIE" >> /path/to/your/movie.log
/usr/bin/wput -B ftp://username:password@ftp.yourdomain $MOVIE 2> /path/to/your/error.log
if [ "$?" = "0" ]; then
@hualro
hualro / onmovie.sh
Last active August 29, 2015 14:16
onmovie.sh
#!/bin/bash
# Author: Hugo Alvarado
# Date: March 8, 2015
TODAY=$(date)
echo "Your log entry here: $TODAY" >> /path/to/your/movie.log
echo "Your text message here: $TODAY" | sudo /usr/bin/gammu sendsms TEXT 1112223344 2> /path/to/your/error.log
if [ "$?" = "0" ]; then