Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@ericoporto
ericoporto / buttonmakerifttt.ino
Last active August 28, 2015 16:14 — 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: https://github.com/ericoporto/IFTTTButton
// 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
ericoporto / twocam_distance.pde
Created August 2, 2015 14:40
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.
// 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:
// http://www.creativecoding.org/lesson/topics/video/video-in-processing
// Aktivität in Bildbereichen feststellen in Processing
import processing.video.*;
@ericoporto
ericoporto / nicedudetg.py
Last active August 29, 2015 14:28
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
ericoporto / pseudogame.pde
Last active August 29, 2015 14:28
This is my first pseudo game for Processing.
// 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
ericoporto / randmytext.js
Last active September 17, 2015 00:54
simple way to generate a random phrase from easy to type sentence
// 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
ericoporto / lowercasefiles.sh
Last active October 28, 2015 20:55
Really simple bash script to rename all files in current directory to lower case. Ex: File-Name.mD becomes file-name.md .
#!/bin/bash
#lower case all files in running directory
for file in *
do
lowercase=`echo $file | tr '[A-Z]' '[a-z]'`
mv "$file" "$lowercase"
done
@ericoporto
ericoporto / transmission_workday.sh
Last active October 31, 2015 12:28
Script to configure Transmission on Raspberry Pi to only run when I'm not home - afternoon - or when I'm sleeping.
#!/bin/bash
# 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.
THISFOLDER=`pwd`
@ericoporto
ericoporto / pinsched.sh
Created November 1, 2015 17:23
Turn a pin from Raspberry on at a time for a duration period.
#!/bin/bash
# call using ./pinsched <time> <duration> <pin number>
# example: ./pinsched 14:00 2hours 5
timeat="$1"
duration="$2"
ledpim="$3"
endtime=`date +%H:%M -d " $timeat today + $duration"`
@ericoporto
ericoporto / md2docx.bat
Last active February 19, 2016 20:04
Drag and drop markdown to docx converter, for use with Windows. Example: http://i.imgur.com/sDjj5ty.gif
@ECHO OFF
REM Drag and drop markdown to docx converter
REM ========================================
REM This script requires PANDOC to be installed.
REM
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 filename.md
@ericoporto
ericoporto / maketimelapse
Created March 3, 2016 18:36
Just so I can remember the command line I used to get no green artifacts
ffmpeg -start_number 1 -i IMG%04d.png -vf "scale=1920:1080" -b:v 8000k video.mp4