Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pthom's full-sized avatar

Pascal Thomet pthom

View GitHub Profile
@pthom
pthom / index.html
Created April 11, 2015 06:29
Test webkit Table // source http://jsbin.com/xuboxo
<!DOCTYPE HTML>
<html>
<head>
<meta name="description" content="Test webkit Table">
<link rel="stylesheet" href="http://cdn.webix.com/edge/webix.css" type="text/css">
<script src="http://cdn.webix.com/edge/webix.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
/* place for UI configuration */
@pthom
pthom / lambda_named_params.cpp
Last active August 26, 2017 18:27
Variations around named function parameters in C++ using lambdas
// This code explores some variations around the lambda proposition in the following article by Marco Arena
// https://marcoarena.wordpress.com/2014/12/16/bring-named-parameters-in-modern-cpp/
#include <iostream>
#include <string>
//Version 1 (without macros)
// Will be called like this :
//
#pragma once
#include <pybind11/numpy.h>
#include <opencv2/core/core.hpp>
#include <stdexcept>
#include <iostream>
// Adapted from
// https://github.com/pybind/pybind11/issues/538#issuecomment-273981569
namespace pybind11 { namespace detail {
@pthom
pthom / cpp_repl_type.cpp
Last active February 15, 2019 21:26
REPL in C++: display readable types and variable contents.
// REPL in C++: display readable types and
// variable contents.
// This demo uses cling, a fully compliant C++14 REPL,
// It also uses based on CleanType (a C++ type introspection
// library)
#include <cleantype/cleantype.hpp>
@pthom
pthom / instructions.md
Last active May 13, 2020 23:19
vcpkg / opencv4: instructions to test the build on android

These instructions were tested on a vanilla linux installation.

  1. Download Android ndk
mkdir ~/Android
cd ~/Android
wget https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip
unzip android-ndk-r21b-linux-x86_64.zip
# edit the path below if needed
#include <future>
class MyThreadedCameraCalibComputer
{
public:
struct GuiCalibInfo
{
cv::Mat mImage;
std::string result;
std::string userInstruction;
#include <atomic>
#include <future>
#include <iostream>
class AsyncRaiiExample
{
public:
AsyncRaiiExample() : mStopRequired(false)
{
@pthom
pthom / literate_programming.md
Last active August 1, 2020 21:15
literate_programming_editor

I sometimes dream of a source code editor that would allow inline diagrams and nicele rendered documentation and or equations. This could apply to any language that has support for multiline comments.

For example, a code like this, (where md stands for markdown)

/*md
Square value of *any* type
@pthom
pthom / CLion_Ninja.md
Last active December 21, 2020 07:50 — forked from nevkontakte/CLion_Ninja.md
Ninja support for CLion IDE

Ninja support for CLion IDE

This script enables Ninja-powered builds in CLion IDE by wrapping around CMake, which it uses. See my blog post for details.

Disclaimer

This script is provided AS IS with no guarantees given or responsibilities taken by the author. This script relies on undocumented features of CLion IDE and may lead to instability of build and/or IDE. Use it on your own risk under WTFPL terms.

@pthom
pthom / test.py
Created September 29, 2022 10:03
def lambda_apriori_ratio_from_interval(value: float, interval: Interval) -> float:
"""
Returns 1 for a value at the center of the interval
Return 1.3 for a value at the border of the interval
i.e the values at the border are multiplied by 1.3
(and are thus less likely to be a minimum)
"""
# x is between -0.5 and 0.5 (0 is the interval center)
x = math_utils.unlerp(interval.Min, interval.Max, value) - 0.5