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
/** | |
* Java Generics, Wildcards and Bounded Wildcards. | |
* | |
* ...Can be confusing. Here's a small explanation + examples. | |
*/ | |
import java.util.LinkedList; | |
import java.util.List; | |
/** |
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 | |
define('AWS_KEY','YOUR_AWS_KEY_HERE'); | |
define('AWS_SECRET','YOUR_AWS_SECRET_HERE'); | |
require_once('AWSSDKforPHP/sdk.class.php'); | |
require_once('AWSSDKforPHP/extensions/s3streamwrapper.class.php'); | |
$s3 = new AmazonS3(array( | |
'key' => AWS_KEY, |
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 "opencv2/opencv.hpp" | |
#include "opencv2/highgui/highgui.hpp" | |
using namespace cv; | |
int main(int argc, char** argv) { | |
//create a gui window: | |
namedWindow("Output",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
% Extract the eigen-faces of a set of face images. | |
start_index = 1; | |
end_index = 10; | |
base_name = ''; | |
extension = '.jpg'; | |
in_dir = 'in'; | |
out_dir = 'ef'; | |
images = []; |
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
#define PERSON_LABEL = 10 //some arbitrary label | |
//LBPH face recognizer parameters: | |
#define RADIUS 1 | |
#define NEIGHBORS 8 | |
#define GRID_X 8 | |
#define GRID_Y 8 | |
#define THRESHOLD 130.0 | |
//create a LBPH face recognizer model: |
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
class CsvWriter { | |
public: | |
CsvWriter(const string &csvPath); | |
virtual ~CsvWriter(); | |
void nextLine(); | |
void addEntry(const string &s); | |
private: | |
ofstream _fs; | |
bool _isFirstEntry; | |
}; |
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
from subprocess import Popen, PIPE | |
from time import sleep | |
# run the shell as a subprocess: | |
p = Popen(['python', 'shell.py'], | |
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False) | |
# issue command: | |
p.stdin.write('command\n') | |
# let the shell output the result: | |
sleep(0.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 sublime, sublime_plugin, re | |
class CountWordsInSelectionCommand(sublime_plugin.EventListener): | |
def on_selection_modified(self, view): | |
''' | |
listen to event 'on_selection_modified' and count words in all selected | |
regions when invoked. | |
''' |
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
// generate a series of even numbers, | |
// but be able to to reverse the order of iteration | |
function * generateEvens(start) { | |
var dir = 1; // up | |
if (start % 2 !== 0) start++; | |
while (true) { | |
var tmp = yield start; | |
if (tmp === 'up') dir = 1; | |
if (tmp === 'down') dir = -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
#!/usr/bin/env bash | |
#https://gist.github.com/EyalAr/67791f51fce51ed55594 | |
COLLECTIONS=() | |
HOST="127.0.0.1" | |
PORT="27017" | |
DB= | |
if [ -n "$1" -a "$1" = "--help" ] |
OlderNewer