Skip to content

Instantly share code, notes, and snippets.

Matthieu Garrigues matt-42

Block or report user

Report or block matt-42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cvmat_bench.cc
#include <opencv2/opencv.hpp>
#include <chrono>
class timer
{
public:
void start() { start_ = std::chrono::high_resolution_clock::now(); }
void end() { end_ = std::chrono::high_resolution_clock::now(); }
View array_view.cc
#include <iostream>
#include <iod/array_view.hh>
#include "symbols.hh"
#include <cassert>
int main()
{
using namespace iod;
using namespace s;
View aos_view_trailer.cc
#include <iostream>
#include <iod/aos_view.hh>
#include "symbols.hh"
#include <cassert>
// aos_view allows to view several arrays as a unique array of structures.
// Any class with a size() method and operator[](int i) is supported.
// The view only hold references to the arrays so no deep array copy is involved.
@matt-42
matt-42 / kitti_pyrlk_opencv.cc
Last active Sep 22, 2016
Kitti optical flow 2012 : calcOpticalFlowPyrLK
View kitti_pyrlk_opencv.cc
std::vector<cv::Point2f> pts;
std::vector<cv::Point2f> next_pts;
std::vector<unsigned char> status;
cv::Mat err;
int winsize = 11;
int nscales = 4;
for (auto p : i1_gl.domain())
pts.push_back(cv::Point2f(p[1], p[0]));
calcOpticalFlowPyrLK(to_opencv(i1_gl), to_opencv(i2_gl), pts, next_pts, status, err,
@matt-42
matt-42 / file_recusion.sh
Created Sep 14, 2016
Recursively traverse a filesystem
View file_recusion.sh
#! /bin/sh
rec() {
for f in `ls $2`; do
echo $1 $f
if [ -d "$2/$f" ]; then
rec $1-- "$2/$f"
fi
@matt-42
matt-42 / iod_option_parser.cc
Last active Sep 9, 2016
Prototype of the iod option parser
View iod_option_parser.cc
#include "iod/parse_options.hh"
#include "symbols.hh"
using namespace s;
int main(int argc, char* argv[])
{
auto options = iod::parse_options(argc, argv,
_size | _s = int(20),
@matt-42
matt-42 / android_openmp_bench.cpp
Created Jun 24, 2016
Minimal Android OpenMP Benchmark
View android_openmp_bench.cpp
// Results one OnePlus two (snapdragon 810 - 8 cores ARMv8):
// with optimization -fopenmp -Ofast -mcpu=cortex-a57.cortex-a53
// Serial time: 19.480000 ms
// OpenMP time: 10.000000 ms
{
const int S = 10e6;
auto A = new int[S];
auto B = new int[S];
@matt-42
matt-42 / iod_reflection.cc
Last active Jun 13, 2016
c++ reflection with iod
View iod_reflection.cc
foreach(o) | [] (const auto& m)
{
std::cout << m.symbol().name() << ":"
<< m.value() << std::end;
};
@matt-42
matt-42 / json_nested.cc
Created Apr 14, 2016
iod json parsing of nested objects
View json_nested.cc
#include <iostream>
#include <iod/json.hh>
// Run iod_generate_symbols test.cc symbols.hh
#include "symbols.hh"
int main()
{
std::string str = R"({"name": "x", "position": { "x": 10, "y": 11, "z": 12}})";
using namespace s;
@matt-42
matt-42 / gist:10ee54fc51cf2264dec0
Created Oct 6, 2015
silicon: manual connection instantiation.
View gist:10ee54fc51cf2264dec0
auto factory = sqlite_connection_factory("database.db");
auto c = factory.instantiate();
You can’t perform that action at this time.