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 <algorithm> | |
// Source | |
// https://www.nottingham.ac.uk/~etzpc/nz/sirds/creation.html#Subject22 | |
static int round(int X) { | |
return (int)((X)+0.5); | |
} | |
static const int DPI = 72; | |
static float E = round(2.5 * DPI); |
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
find_package(Threads REQUIRED) | |
ExternalProject_Add( | |
googletest | |
GIT_REPOSITORY https://github.com/google/googletest.git | |
UPDATE_COMMAND "" | |
INSTALL_COMMAND "" | |
LOG_DOWNLOAD ON | |
LOG_CONFIGURE ON | |
LOG_BUILD ON) |
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 sys | |
import random | |
import time | |
from threading import * | |
class Producer(Thread): | |
def __init__(self, items, can_produce, can_consume): | |
Thread.__init__(self) | |
self.items = items | |
self.can_produce = can_produce |
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
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask_httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
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
// Reference: https://picoledelimao.github.io/blog/2017/01/28/eyeball-tracking-for-mouse-control-in-opencv/?fbclid=IwAR0zbPjZW5_NyXRtlkWM8oZ7BX4asTe2UOznHUTjE1ELm4uTvwzEcKHMbGs | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/objdetect/objdetect.hpp> | |
#include <ApplicationServices/ApplicationServices.h> | |
#include <unistd.h> | |
cv::Vec3f getEyeball(cv::Mat &eye, std::vector<cv::Vec3f> &circles) |
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
// | |
// main.cpp | |
// Threading_Consumer_Producer | |
// | |
// Created by James Folk on 1/5/19. | |
// Copyright © 2019 James Folk. All rights reserved. | |
// | |
// Thanks to: https://gist.github.com/iikuy/8115191 |
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
#/usr/bin/bash | |
cver=3.10.0 | |
wd=/tmp | |
wget -nc -P $wd https://cmake.org/files/v${cver:0:4}/cmake-$cver.tar.gz | |
cd $wd | |
tar -xf cmake-$cver.tar.gz | |
cd cmake-$cver | |
./configure |
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
execute pathogen#infect() | |
call pathogen#helptags() | |
map <C-n> :NERDTreeToggle<CR> | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l |
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
<?php | |
/** | |
* Checks if an email is a valid RFC 2822 email address | |
* | |
* Examples: | |
* <code> | |
* <?php | |
* validate_email('[email protected]'); // returns true | |
* validate_email('Felds Liscia <[email protected]>'); // returns false |
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
local function _xpcall(func, params) | |
assert((type(params) == 'table'), "input param must be a table") | |
status, err, ret = xpcall (func, debug.traceback, params) | |
assert(status, err) | |
assert((type(err) == 'table'), "return value must be a table") | |
return err | |
end |