Skip to content

Instantly share code, notes, and snippets.

View Harold2017's full-sized avatar
😃

Harold Harold2017

😃
View GitHub Profile
@Harold2017
Harold2017 / eigen_error.md
Last active March 1, 2022 05:21
PCL seg fault on Linux due to Eigen3 aligned_free
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 = <optimized out>
@Harold2017
Harold2017 / CMakeLists.txt
Last active January 6, 2022 05:27
cmake for MSVC on C++20 modules build
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 December 22, 2021 09:46 — forked from jgcoded/compiletime-strings.hpp
C++ Compile time conversion of a number to a string
/*!
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 November 19, 2021 02:37 — forked from tarukosu/cameraToWorld.cs
HoloLens カメラ座標から世界座標への変換
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 November 17, 2021 03:08
Crash when use PCL texture mesh

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 September 23, 2021 07:24
cmake denpendency build
# .
# bin
# source
# dependency
# include
# source
# example
# include
# source
# external
@Harold2017
Harold2017 / repair_broken_pdf.md
Created August 23, 2021 08:02
repair broken pdf

use QPDF

brew install qpdf
qpdf --decrypt broken.pdf recovery.pdf
@Harold2017
Harold2017 / git-commit-log-stats.md
Created July 13, 2021 05:40 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@Harold2017
Harold2017 / print_csdn.js
Last active April 24, 2021 10:36
print csdn blog
(function(){
$("#side").remove();
    $("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();
    $(".nav_top_2011, #header, #navigator").remove();
    $(".csdn-side-toolbar,.template-box,.reward-user-box").remove();
    $(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box,#dmp_ad_58").remove();
    $("aside").remove();
    $(".tool-box").remove();
    $("main").css('display','content');
    $("main").css('float','left');
@Harold2017
Harold2017 / circ_shift.h
Created April 12, 2021 02:10 — forked from tesch1/circ_shift.h
Eigen circShift and fftshift and ifftshift
// circ_shift.h
// https://stackoverflow.com/questions/46077242/eigen-modifyable-custom-expression/46301503#46301503
// this file implements circShift, fftshift, and ifftshift for Eigen vectors/matrices.
//
#pragma once
#include <Eigen/Core>
template <bool B> using bool_constant = std::integral_constant<bool, B>;