Sometimes you would like to hook the glibc functions with your own implementations so that you can hack the output or monitor some metrics. Here's a simple guideline on how to do it with LD_PRELOAD on linux.
Bazel is a fast building system open sourced by Google. It has go support but it does not have a detailed instruction on how to integrate CGO with the bazel build system. Building everything from scratch with
cc_library and manually written
go_library is do-able. However, we do prefer the amazing gazelle and sometimes it is hard to use prebuilt libraries with CGO build without digging up in the source code in the
Assume we would like to change a user's username, uid and gid into some random number.
Sometimes we need to limit the fan speed in Dell PowerEdge server series maybe for the noise. The followings are the ipmi raw commands to setup the manual fan control which are very much undocumented.
ipmitool raw command
|Enable manual fan control
ipmitool raw 0x30 0x30 0x01 0x00
|Disable manual fan control
ipmitool raw 0x30 0x30 0x01 0x01
|Set manual fan speed step
ipmitool raw 0x30 0x30 0x02 0xff 0x??
I'm using Dell r720xd and setting
0x26 effectively limits the fan speed to around 8000 RPM. It is a somewhat safe value before you slowly set down the value to limit further down the fan speed.
Running GUI applications inside docker might be useful when sandbox mechanism is needed or debugging complex and tricky container networking related issues.
Generally there are 3 major ideas when trying to run GUI applications in docker, which are:
- Penetrate in the host X11 sockets (most straight forward but not fully secure)
- Expose SSH connection and use
- Run VNC server inside the container and use VNC client to access the GUI application inside
There are always plenty to do before a machine is shutdown and after a machine is startup. With systemd adopted by most linux distributions, it is possible to automate these tasks in parallel.
We can write various shell scripts to automate the tasks and specify them with different systemd units.
PDF do preserve the original information especially image when exported. The feature makes it very attractive for archive but it might be too large to spread.
We can use
ghostscript command to compress (actually rewrite) a PDF file with a lot of images embedded.
Splitting the template declaration and implementation is not easy in C++ because the actual templates code is generated at compile time. However, it is still possible to split them out if you do know the types that you would like to generate as the role of a library.
Sometimes we do want to have some process killed to save the overall other works left not saved on Linux.