Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>HTML5 Rain</title>
<script type="text/javascript">
// this is an example for a rain function, to draw rain
// in a jRPG Top-Down type of game.
var canvas = null;
@ericoporto
ericoporto / ywcc_ptbr.py
Created July 28, 2015 00:39
Yahoo Weather API Condition Codes in Brazilian Portuguese (Códigos do Yahoo Weather em Português - Brasil)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Erico Vieira 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
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@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 / server-http.py
Last active November 1, 2019 01:45 — forked from bradmontgomery/dummy-web-server.py
A minimal http server and client pair. It's intended to show how to communicate between a server and a client in Python.
#!/usr/bin/env python
"""
Very simple HTTP server and client pair in python.
Server based on: https://gist.github.com/bradmontgomery/2219997
Usage::
./server-http.py start [<port>]
Send a message (on a second terminal) ::
./server-http.py notify "hello world!"
@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 / openweather.ino
Last active January 10, 2023 20:26
An Arduino + Ethernet shield example on how to get data from Open WeatherMap
/*
Web Client to consume Open WeatherMap web service
This sketch connects to a website (http://api.openweathermap.org)
using an Arduino Ethernet shield and get data from site.
Circuit:
* Arduino MEGA 2560 R3 Board
* Ethernet shield attached to pins 10, 11, 12, 13
@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 / 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 / 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 / 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`