Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗

Harold Harold2017

🤗
View GitHub Profile
View regex.cpp
// ------------------------------------------------------------------------
// Benchmark LGCG Time LTO Time Iterations LTCG Build LTO Build
// ------------------------------------------------------------------------
// regex_boost 317 ns 69.1 ns 2133333 00:02.720 00:08.70
// regex_ctre 248 ns 4.79 ns 2800000 05:08.755 00:04.78
// regex_hyperscan 96.7 ns n/a 7466667 00:52.487 n/a
// regex_re2 186 ns 3.97 ns 4072727 00:03.353 00:05.94
// regex_spirit 44.3 ns 0.644 ns 15448276 00:03.487 00:05.25
// regex_std 2371 ns 67.2 ns 280000 00:02.442 00:05.54
// regex_xpressive 552 ns 273 ns 1000000 00:05.369 00:11.52
@Harold2017
Harold2017 / ANSI-color-codes.h
Created May 14, 2022 — forked from RabaDabaDoba/ANSI-color-codes.h
The entire table of ANSI color codes working in C!
View ANSI-color-codes.h
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@Harold2017
Harold2017 / ctz_clz.cpp
Created May 4, 2022 — forked from pps83/ctz_clz.cpp
__builtin_ctz (ctzl, ctzll) and __builtin_clz (clzl, clzll) for Visual Studio
View ctz_clz.cpp
#ifdef _MSC_VER
#include <intrin.h>
static inline int __builtin_ctz(unsigned x) {
unsigned long ret;
_BitScanForward(&ret, x);
return (int)ret;
}
static inline int __builtin_ctzll(unsigned long long x) {
@Harold2017
Harold2017 / OpenCV_with_cuDNN_on_windows.md
Created Apr 23, 2022
build OpenCV with cuDNN on windows
View OpenCV_with_cuDNN_on_windows.md
@Harold2017
Harold2017 / eigen_error.md
Last active Mar 1, 2022
PCL seg fault on Linux due to Eigen3 aligned_free
View eigen_error.md
Processing camera 1 of 26.

Program received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0x55041) at malloc.c:3102
3102    malloc.c: No such file or directory.

(gdb) bt full
#0  __GI___libc_free (mem=0x55041) at malloc.c:3102
 ar_ptr = 
@Harold2017
Harold2017 / CMakeLists.txt
Last active Jan 6, 2022
cmake for MSVC on C++20 modules build
View CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(Cpp20)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(PREBUILT_MODULE_DIR ${CMAKE_BINARY_DIR}/modules)
set(STD_MODULES_DIR "D:/MSVC/VC/Tools/MSVC/14.29.30133/ifc/x64") # macro "$(VC_IFCPath)" in MSVC
@Harold2017
Harold2017 / compiletime-strings.hpp
Last active Dec 22, 2021 — forked from jgcoded/compiletime-strings.hpp
C++ Compile time conversion of a number to a string
View compiletime-strings.hpp
/*!
This file contains code to convert unsigned integers to strings
at compile-time, and then modify those strings include more
information.
One use case is to convert library MAJOR, MINOR, and PATCH
numbers into a custom string (see below).
Other types like signed integers and floats can be added
with template specializition on the converter struct.
@Harold2017
Harold2017 / cameraToWorld.cs
Created Nov 19, 2021 — forked from tarukosu/cameraToWorld.cs
HoloLens カメラ座標から世界座標への変換
View cameraToWorld.cs
void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
{
Matrix4x4 cameraToWorldMatrix;
photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix);
Matrix4x4 projectionMatrix;
photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix);
var imagePosZeroToOne = new Vector2(pixelPos.x / imageWidth, 1 - (pixelPos.y / imageHeight));
var imagePosProjected = (imagePosZeroToOne * 2) - new Vector2(1, 1); // -1 to 1 space
@Harold2017
Harold2017 / pcl crash on texture mesh.md
Last active Nov 17, 2021
Crash when use PCL texture mesh
View pcl crash on texture mesh.md

PCL release: PCL-1.12.0-AllInOne-msvc2019-win64.exe

Related issue: PointCloudLibrary/pcl#2147

Crash trace: ~TextureMesh() / Eigen::aligned_allocator

Reason: PCL pre-compiled binary is compiled with AVX enabled which caused incompatibility of EIGEN_IDEAL_MAX_ALIGN_BYTES

Solution: add_compile_options(/arch:AVX)

@Harold2017
Harold2017 / CMakeLists.txt
Last active Sep 23, 2021
cmake denpendency build
View CMakeLists.txt
# .
# bin
# source
# dependency
# include
# source
# example
# include
# source
# external