Skip to content

Instantly share code, notes, and snippets.

@qh-huang
qh-huang / c_cpp_useful_code_pieces.h
Last active October 8, 2018 06:58
Commonly Used Code Pieces
// thread sleep in C++11
void ThreadSleep(int duration_ms) {
std::cout << "Thread Sleeping..." << std::endl;
auto start = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for(std::chrono::milliseconds(duration_ms));
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double, std::milli> elapsed = end - start;
cout << << "Thread Awake. Sleeping for " << elapsed.count() << " ms." << std::cout;
}
Q: How to get rid of git submodules untracked status?
A: move into the submodule's directory, then
git reset --hard
Eigen::Quaternion<float> q;
Eigen::AngleAxis<float> aaZ(pcl::deg2rad(rz), Eigen::Vector3f::UnitZ());
Eigen::AngleAxis<float> aaY(pcl::deg2rad(ry), Eigen::Vector3f::UnitY());
Eigen::AngleAxis<float> aaX(pcl::deg2rad(rx), Eigen::Vector3f::UnitX());
q = aaZ * aaY * aaX;
@qh-huang
qh-huang / jni_commonly_used_code.cpp
Last active October 20, 2023 08:54
JNI useful code pieces
// ==================== pull from Facebook/rockdb@github ====================
class ListJni {
public:
// Get the java class id of java.util.List.
static jclass getListClass(JNIEnv* env) {
jclass jclazz = env->FindClass("java/util/List");
assert(jclazz != nullptr);
return jclazz;
}
#include <stdio.h>
#include <string.h>
void swap(char* a, char* b)
{
*a ^= *b;
*b ^= *a;
*a ^= *b;
}

FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.


Effective Engineer - Notes

What's an Effective Engineer?

改編自 Effective Engineer (https://gist.github.com/rondy/af1dee1d28c02e9a225ae55da2674a6f)

原文已經是文摘了,取自 Effective Engineer (http://www.effectiveengineer.com/)

有鑒於 1)它是英文 以及 2)文章太長,實在不利傳播,所以一直想要翻譯+濃縮這篇,分享給台灣的工程師(我認為不只工程師,所有知識工作者都適用

翻譯的同時,也加入自己的理解,所以可能和原文有出入,有疑義可參考原文。 (由於筆者是軟體工程師,所以舉例的部分都會偏向科技業和軟體工程)

  • 目標讀者

@qh-huang
qh-huang / cloudSettings
Last active November 11, 2019 11:16
Visual Studio Code Settings Sync Gist_20191111
{"lastUpload":"2019-11-11T11:14:00.196Z","extensionVersion":"v3.4.3"}
@qh-huang
qh-huang / include
Last active October 3, 2018 06:27
QtCreator settings
# xenial (ubuntu 16.04)
/usr/include/c++/5
/usr/include/c++/5.4.0
/usr/include/eigen3
/usr/include/pcl-1.7
/usr/local/include/ceres
/opt/ros/kinetic/include
# bionic (ubuntu 18.04)
/usr/include/c++/7
@qh-huang
qh-huang / ubuntu
Last active October 3, 2018 05:15
OS install
# General
sudo apt-get update
sudo apt-get install -y \
git gitk gitweb lighttpd \
cmake \
curl \
openssh-server \
vim \
tmux \
tree \