This file contains hidden or 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
def poly2fit_from_3points(xs,ys): | |
# p0,p1,p2 | |
# quadratic function: | |
# y=a*x*x + b*x + c | |
# | |
# [1] p0y=a*p0x*p0x + b*p0x + c | |
# [2] p1y=a*p1x*p1x + b*p1x + c | |
# [3] p2y=a*p2x*p2x + b*p2x + c | |
# [4] isolate c in [1]: c = p0y - a*p0x*p0x - b*p0x | |
# [5] insert [4]c in [2]: p1y = a*p1x*p1x + b*p1x + p0y - a*p0x*p0x - b*p0x |
This file contains hidden or 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
#pragma once | |
#include "message_filters/synchronizer.h" | |
#include "message_filters/connection.h" | |
#include "message_filters/null_types.h" | |
#include "message_filters/signal9.h" | |
#include <boost/tuple/tuple.hpp> | |
#include <boost/shared_ptr.hpp> | |
#include <boost/function.hpp> |
This file contains hidden or 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
\documentclass{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage{tikz} | |
\usepackage[T1]{fontenc} | |
%\usepackage{fontspec} | |
% http://www.texample.net/tikz/examples/diagram-chains/ | |
\usetikzlibrary{% | |
arrows,% | |
calc, | |
shapes, |
This file contains hidden or 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
# solution for 9gag.com/gag/a1oXmYw | |
def match(c1,c2): | |
intersection = set(c1).intersection(set(c2)) | |
match_result = [] | |
for digit in intersection: | |
idxs1 = [k for k,d in enumerate(c1) if digit==d] | |
idxs2 = [k for k,d in enumerate(c2) if digit==d] | |
for i in idxs1: | |
for k in idxs2: |
This file contains hidden or 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
// Example program | |
#include <iostream> | |
#include <string> | |
#include <functional> | |
struct PipedBuffer | |
{ | |
int bufSize; | |
}; |
This file contains hidden or 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
// Example program | |
#include <iostream> | |
#include <string> | |
#include <ostream> | |
template<typename T> | |
class Maybe | |
{ | |
public: |
This file contains hidden or 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
template<typename T> | |
class Maybe | |
{ | |
public: | |
static Maybe Just(const T& just) | |
{ | |
return Maybe(just); | |
} | |
static Maybe Just() |
This file contains hidden or 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
#!/bin/sh | |
# iterate over all packages | |
for package in */ ; do | |
# go to stow package and remove all existing target files | |
cd $package > /dev/null | |
find . -type f -print0 | xargs -0 -i rm $(pwd)/../../{} | |
cd - > /dev/null | |
done |
This file contains hidden or 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 "catch/catch.hpp" | |
// The matcher class | |
class MatMatcher : public Catch::MatcherBase<cv::Mat> | |
{ | |
public: | |
MatMatcher(cv::Mat mat) | |
: m_mat(mat) |
This file contains hidden or 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 <memory> | |
#include <iostream> | |
#include "common/measureTime.h" | |
using namespace common; | |
int main(int argc, char* argv[]) | |
{ | |
int n = 100000000; |