Skip to content

Instantly share code, notes, and snippets.

View RDCH106's full-sized avatar
Partially offline. No time...

Rubén de Celis Hernández RDCH106

Partially offline. No time...
View GitHub Profile
@RDCH106
RDCH106 / execution_time.cpp
Last active August 29, 2015 14:23
Execution Time
#include <iostream>
#include <ctime>
unsigned t0, t1;
t0=clock()
// Code to execute
t1 = clock();
double time = (double(t1-t0)/CLOCKS_PER_SEC);
@RDCH106
RDCH106 / calculateSimilarPolygon.cpp
Created November 18, 2015 09:37
Calculate the similar polygon that it is concentric to the original polygon, using a scaling factor
#include "opencv2/opencv.hpp"
#include <vector>
using namespace cv;
using namespace std;
vector<Point> calculateSimilarPolygon(vector<Point>&pListPoints, Point center, float factor){
vector<Point> spolygon;
float v1, v2;
int x, y;
@RDCH106
RDCH106 / OpenCV_loadImages.cpp
Last active January 20, 2016 13:10
Load numerated images from a folder using OpenCV
void OpenCV_loadImages( const std::string &folder, const std::string &tag, const std::string format, std::vector<cv::Mat> &images ){
images.clear();
std::string fileName;
int index = 1;
while( true ){
fileName = folder + "/" + tag + std::to_string( (long long) index) + "." + format;
cv::Mat newImage = cv::imread( fileName );
if( newImage.empty() ) break;
images.push_back( newImage );
@RDCH106
RDCH106 / OpenCV_Display_2_Images_in_1_Window.cpp
Last active January 20, 2016 13:12
Display 2 Images in 1 Window with OpenCV
#include "opencv2/opencv.hpp"
int display(){
//cv::VideoCapture cap1(0); // open the default camera
cv::VideoCapture cap1(0); // open the first camera
cv::VideoCapture cap2(1); // open the second camera
if(!cap1.isOpened()) // check if we succeeded
return -1;
@RDCH106
RDCH106 / banner_code_snippet.html
Created February 3, 2016 22:56
Banner Code Snippet
<!-- Javascript Code -->
<script>
function copyToClipboard(object) {
object.focus();
object.select();
document.execCommand('copy');
alert("Copiado al Portapapeles");
}
</script>
@RDCH106
RDCH106 / test_call-VS-start.bat
Last active February 8, 2016 08:59
Windows .BAT script for testing differences between CALL and START
@ECHO OFF
ECHO Execution using CALL
ECHO -------------------------------------------
ECHO Main execution running...
ECHO Calling to ping...
call ping google.es
ECHO.
ECHO Continue main execution
@RDCH106
RDCH106 / motd
Created April 20, 2016 09:36
MOTD example with ASCII Art
_ __________ _,
_.-(_)._ ." ". .--""--. _.-{__}-._
.'________'. | .--------. | .' '. .:-'`____`'-:.
[____________] /` |________| `\ / .'``'. \ /_.-"`_ _`"-._\
/ / .\/. \ \| / / .\/. \ \ || .'/.\/.\'. | /` / .\/. \ `\
| \__/\__/ |\_/ \__/\__/ \_/| : |_/\_| ; | | \__/\__/ |
\ / \ / \ '.\ /.' / .-\ /-.
/'._ -- _.'\ /'._ -- _.'\ /'. `'--'` .'\/ '._-.__--__.-_.' \
/_ `""""` _\/_ `""""` _\ /_ `-./\.-' _\'. `""""""""` .'`\
(__/ '| \ _)_| |_)_/ \__)| ' | |
@RDCH106
RDCH106 / win10colors.cmd
Created October 4, 2016 10:23 — forked from mlocati/win10colors.cmd
ANSI Colors in standard Windows 10 shell
@echo off
cls
echo  STYLES 
echo ^<ESC^>[0m Reset
echo ^<ESC^>[1m Bold
echo ^<ESC^>[4m Underline
echo ^<ESC^>[7m Inverse
echo.
echo  NORMAL FOREGROUND COLORS 
echo ^<ESC^>[30m Black (black)
@RDCH106
RDCH106 / codacy-python-default-conf.json
Created November 16, 2016 14:22
Default review criteria for a Python project in Codacy
{
"patterns" : [{
"patternId" : "Custom_Scala_NonFatal",
"enabled" : true
}, {
"patternId" : "CSSLint_shorthand",
"enabled" : true
}, {
"patternId" : "CSSLint_errors",
"enabled" : true
@RDCH106
RDCH106 / Factory_pattern.cpp
Last active March 14, 2017 15:24
In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method.
#include <iostream>
#include <memory>
#include <string>
struct Base
{
virtual ~Base() = default;
};
struct Derived : public Base