This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Salt and Pepper noise to OpenCV image, vectorized approach. | |
# https://stackoverflow.com/questions/22937589/how-to-add-noise-gaussian-salt-and-pepper-etc-to-image-in-python-with-opencv | |
# Forked and fixed from https://gist.github.com/lucaswiman/1e877a164a69f78694f845eab45c381a | |
# Fixed: replaced 'image' with 'output' | |
import numpy as np | |
import cv2 | |
def sp_noise(image, prob): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
// separa cada conjunto de bits do byte de status | |
struct MotorStatusBits | |
{ | |
unsigned motorIndex : 4; | |
unsigned currentPosition : 3; | |
unsigned isMoving : 1; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def main(): | |
while True: | |
inputStr = input('Type a number: ') | |
if inputStr == '': | |
break | |
inputNumber = int(inputStr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The code below was used to print the letters of each item on | |
an ordered list. So index 0 becomes 'a', 1 becomes 'b', and | |
so on. | |
It also use multiple letters when the list length is greater | |
than 26, so index 26 becomes 'aa', index 27 becomes 'ab', | |
and so on. | |
Author: Gutierrez PS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************ | |
* Convenções de codificação para Arduino | |
* Autor: Gutierrez PS | |
* | |
* Outros padrões mais completos: | |
* http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines | |
* http://geosoft.no/development/cppstyle.html | |
* http://www.possibility.com/Cpp/CppCodingStandard.html | |
************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************** | |
Arduino EEPROM Test | |
by Gutierrez PS 2017 | |
http://github.com/gutierrezps | |
Based on John Boxall's idea of testing the lifespan | |
of Arduino's internal EEPROM: | |
http://tronixstuff.com/2011/05/11/discovering-arduinos-internal-eeprom-lifespan/ | |
EEPROM is tested by writing a certain value to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean parseIpAddress(String ip) throws IllegalArgumentException { // IPv4, format x.x.x.x | |
StringTokenizer tok = new StringTokenizer(ip, "."); | |
if (tok.countTokens() != 4) { | |
throw new IllegalArgumentException("IP address must be in the format 'xxx.xxx.xxx.xxx'"); | |
} | |
int i = 0; | |
while (tok.hasMoreTokens()) { | |
String strVal = tok.nextToken(); |