Skip to content

Instantly share code, notes, and snippets.

@supplient
supplient / lam2fp.cpp
Last active June 14, 2023 09:55
C++ lambda expression => C-style function pointer
// Source: https://stackoverflow.com/a/48368508/17132546
// Entry template
// extract the lambda's operaor() function signature
template <class F, class T=F>
struct lambda_traits: lambda_traits<decltype(&std::remove_reference<F>::type::operator()), F>
{};
// For mutable lambda, See https://en.cppreference.com/w/cpp/language/lambda
// mutable lambda's operator() is not const,
@rotu
rotu / CMakeLists.txt
Last active May 2, 2024 23:20
CLion top level ROS2 Workspace CMakeLists
cmake_minimum_required(VERSION 3.14)
project("ROS2 Master")
# usually I put this in a separate file include("/opt/ros/_common/Colcon.cmake")
function(colcon_add_subdirectories)
cmake_parse_arguments(PARSE_ARGV 0 "ARG" "" "BUILD_BASE;BASE_PATHS" "")
message("search criteria: ${ARGV}")
execute_process(COMMAND colcon list
@miguelmota
miguelmota / uint8_to_hex.cpp
Last active April 5, 2024 12:07
C++ uint8_t to hex string
#include <sstream>
#include <iostream>
#include <iomanip>
std::string uint8_to_hex_string(const uint8_t *v, const size_t s) {
std::stringstream ss;
ss << std::hex << std::setfill('0');
for (int i = 0; i < s; i++) {
@windoze
windoze / rx-asio.hpp
Created December 19, 2015 14:06
Boost.ASIO scheduler for RxCPP
#include "rxcpp/rx-scheduler.hpp"
// TODO: C++17 Networking TS
#ifdef WITHOUT_BOOST
// Standalone ASIO
#include <asio.hpp>
namespace asio_ns=::asio
namespace system_ns=::std
#else
// Boost.ASIO
@genedna
genedna / gentoo-install-manual.md
Last active March 26, 2024 10:19
Gentoo 安装手册

Gentoo 安装手册

第一步:下载安装介质

GentooMinimal Install CD 每周都会自动构建一个版本,服务器一般使用最新的 x86_64 版本。 国内的镜像下载地址是:

第二步:启动机器,设置网络环境和开启 SSH 服务