Skip to content

Instantly share code, notes, and snippets.


Érico Vieira Porto ericoporto

View GitHub Profile
ericoporto / buttonmakerifttt.ino
Last active Aug 28, 2015 — forked from outofmbufs/iftttmaker.ino
A button to the Internet! Code to a button in an Arduino trigger an IFTTT/Maker event. Moved to here:
View buttonmakerifttt.ino
// This code makes a button connect on pin 2 of the Ethernet Shield
// connected to an Arduino trigger a event named button_pressed on
// the IFTTT Maker Channel. Based on the Neil Webber analog read code.
// The MIT License
// Copyright (c) 2015 Erico Porto
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
ericoporto / twocam_distance.pde
Created Aug 2, 2015
This script uses 2 webcams, calculate difference per frame in each, get the position of the biggest difference and then calculate distance from the camera. Made with Processing IDE.
View twocam_distance.pde
// First example on image processing
// Finds the square with bigger difference from the latter
// Do it for both cams
// Guess that it's in the same object
// Tell the distance from the object
// Prototype to be further rewritten in OpenCV
// This code uses snippets form this great german website:
// Aktivität in Bildbereichen feststellen in Processing
ericoporto /
Last active Aug 29, 2015
This is a unfinished text game I helped a random dude make in stackoverflow. It has nice ideas for text game implementation.
# one nice dude in the internet asked me for help to make this code work
# I leave this code here as a reminder of that nice dude. The content here
# belongs to nice dude, and not me.
import sys, traceback
import json
userQuited = False
def _quit(dummy):
ericoporto / pseudogame.pde
Last active Aug 29, 2015
This is my first pseudo game for Processing.
View pseudogame.pde
// A simple 'game' for Processing (tested with Processing 2.2.1)
// use ARROW KEYS to move
// this will be the pointers I'm going to use to sweep my map,
// and it's limit.
int xi, yi;
int i = 0;
int sceneHeight = 10;
int sceneWidth = 20;
// This is the "hero" coordinate
ericoporto / randmytext.js
Last active Sep 17, 2015
simple way to generate a random phrase from easy to type sentence
View randmytext.js
// An easy way to generate random text from easy to type text
// Use "word word [possibility1|possibilities stuff|another stuff thing] stuff"
//to make a string with possibilities.
// Example:
//> var t = "A [greekish|futuristic|antique] world with a [dinossaur|ninja] flying"
//> console.log(randtext(t))
//A antique world with a dinossaur flying
ericoporto /
Last active Oct 28, 2015
Really simple bash script to rename all files in current directory to lower case. Ex: File-Name.mD becomes .
#lower case all files in running directory
for file in *
lowercase=`echo $file | tr '[A-Z]' '[a-z]'`
mv "$file" "$lowercase"
ericoporto /
Last active Oct 31, 2015
Script to configure Transmission on Raspberry Pi to only run when I'm not home - afternoon - or when I'm sleeping.
# Run this script WITHOUT Sudo.
# This script assumes you have installed transmission-daemon
# on your Raspberry Pi (or whatever where you are running it...)
# Running it will use cron to pause and unpause all your torrents
# at specific times.
# Right now you, no torrents will be downloaded from 5 am to 9 am and
# also no torrents will be downloaded from 5 pm to 11 pm.
ericoporto /
Created Nov 1, 2015
Turn a pin from Raspberry on at a time for a duration period.
# call using ./pinsched <time> <duration> <pin number>
# example: ./pinsched 14:00 2hours 5
endtime=`date +%H:%M -d " $timeat today + $duration"`
ericoporto / md2docx.bat
Last active Feb 19, 2016
Drag and drop markdown to docx converter, for use with Windows. Example:
View md2docx.bat
REM Drag and drop markdown to docx converter
REM ========================================
REM This script requires PANDOC to be installed.
REM Usage
REM -----
REM In Windows Explorer, drag a .md file on top of this script.
REM You can also call this script using:
REM md2docx.bat
ericoporto / maketimelapse
Created Mar 3, 2016
Just so I can remember the command line I used to get no green artifacts
View maketimelapse
ffmpeg -start_number 1 -i IMG%04d.png -vf "scale=1920:1080" -b:v 8000k video.mp4
You can’t perform that action at this time.