Siyuan's Blog

Read(); Think(); Try(); Repeat();

Obtaining wildcard certificates from Let's Encrypt

In 2017, I wrote a post on how to set up Let’s Encrypt certificates together with NGINX. Back then, Let’s Encrypt hadn’t added support for wildcard certificates. Althought it’s not a big issue, it does mean you have to generate a new certificate each time you want to add a new subdomain to the certificate. Earlier this year, Let’s Encrypt finally added support for wildcard certificates. Therefore, I recently changed to a wildcard certificate.

A few use of macros in C/C++

If you’ve written C/C++ code, you must know and probably have used macros. You may have defined handy macros to compute min and max. However, there are more ways macros can be used in C/C++ projects. I will try to describe a few which I frequently use in this post. Header guard The most frequent use of macro for me is definitely acting as the header guard. In C/C++ code, you cannot redefine the same function or variable twice.

Passing reference with std::ref in C++

When you first learn C++, you probably know about reference. It allows you to pass parameter as if you are passing by value while having a similar effect as passing a pointer. Sometimes, however, this may not work as you expect. In this post, I will discuss how to pass a reference when the normal way doesn’t work. Passing parameters to std::thread and std::bind If you have used std::thread or std::bind, you probably noticed that even if you pass a reference as parameter, it still creates a copy instead.

Manual network configuration in a Kickstart install

In a previous post, I described how to automatically install a CentOS system with the help of Kickstart. In that post, I provided a link to the Kickstart file I used back then. It is truly automatic, including the network configurations. However, sometimes we may want to manually configure certain things, e.g. the network, while performing an “automated” installation. In this post, I use network as an example to demonstrate how to configure things manually during a Kickstart installation.

CUDA as a language in CMake

If you have ever created or built a CUDA CMake project in the past, you have probably heard about the FindCUDA CMake module. Prior to CMake 3.8, it has been providing this module to support compiling CUDA code and linking with CUDA libraries. This approach is not perfect though. Unlike other libraries, CUDA provides not only some libraries but a compiler as well. To let CMake use nvcc to compile something, the FindCUDA module provides macros like cuda_add_executable (similar to add_executable).