This one is superb - https://designed-to-scale.vercel.app/
HKDevTips
A place for all technical hints
Monday, November 23, 2026
Tuesday, November 17, 2026
tail -f replacement
2 nice "tail -f" replacement:
- lnav
- tspin
Friday, October 23, 2026
Upgrade nodejs in conda (from v18 to v26)
If your conda env is nodejs v18, doing a conda install nodejs=26 is likely to create a lot of conflict.
Consider remove those conflicting packages and install the nodejs v26:
- conda create env -n testing-dev --clone your-current-env
- conda remove nodejs libgcc-ng
- conda install -c conda-forge nodejs=26
Thursday, January 22, 2026
CSP on Apache
To add CSP to root if sort of funny. The following will NOT work for most cases !!
<LocationMatch "^/$">
Header set Content-Security-Policy "unsafe-inline"
</LocationMatch>
Case 1: The root (/) is associated with DocumentRoot
In this case, because you used the DocumentRoot, the 'Header set' behavior is not applied. You need to match the final resulting document, e.g.
<LocationMatch "^/index.html$">
Header set Content-Security-Policy "unsafe-inline"
</LocationMatch>
Case 2: The root (/) is redirected via Rewrite rule
In this case, because it is a HTTP 301 response, the 'Header set' behavior is not applied (It only applies to HTTP 200 response by default). You need to use 'Header always set':
<LocationMatch "^/$">
Header always set Content-Security-Policy "unsafe-inline"
</LocationMatch>
Thursday, October 10, 2024
Parse b3dm file content
from py3dtiles.tileset.content import B3dm, read_binary_tile_content
b3dm = read_binary_tile_content(filename)
print(f"\nb3dm_header.magic_value:\n{b3dm_header.magic_value}")
print(f"\nb3dm_header.version:\n{b3dm_header.version}")
for image in b3dm.body.gltf.images:
print(image)
Tuesday, September 10, 2024
Access windows localhost from wsl
To access window's localhost from wsl, you can set networkingMode=mirrored in .wslconfig
Reference:
https://learn.microsoft.com/en-us/windows/wsl/wsl-config#configuration-settings-for-wslconfig
Thursday, August 29, 2024
Start new tab with the current directory in windows WSL
Use the following alias:
alias nt='wt.exe -w 0 wsl'
It means starting a new terminal (tab) in the same window (-w 0) , and run a command wsl with it.
Thursday, June 27, 2024
Node.js certificate issues
When you encountered certificate issues when using node.js, there are some workaround that can be tried:
1) Add custom CA certs
$ export NODE_EXTRA_CA_CERTS=[your CA certificate file path]
2) Disable certificate checking
NODE_TLS_REJECT_UNAUTHORIZED
Keep current log file when using logrotate
When using logrotate in Linux, you might encounter a situation where your log file gone when the log rotated. One of the flag that you may need to notice is the copytruncate flag. It did not remove the current log file, instead it copy the log file and then truncate it:
File name: /etc/logrotate.d/your-application
/var/log/your-application/output.log {
copytruncate
rotate 5
daily
compress
delaycompress
notifempty
missingok
}
Thursday, May 23, 2024
Quasar failed to proxy pass via https
When failed to proxy pass with https in Quasar framework, it is very likely that the target-host HTTPS are configured incorrectly. As a workaround, you can modify the quasar.conf.js with secure:false as following:
"/context/path1/": {
target: "https://target-host/path1/",
secure: false,
changeOrigin: true,
pathRewrite: {
"^/context/path1/": "",
},
},
Learning System Design with Cute Animation
This one is superb - https://designed-to-scale.vercel.app/
-
When Office2003 couldn't find file SKU011.CAB: regedit -> [HKEY_LOCAL_MACHINE] -> [SOFTWARE] -> [Microsoft] -> [Office] -...
-
The resolution can be changed by editing the BlueStack's registry: HKLM\SOFTWARE\BlueStacks\Guests\Android\FrameBuffer\0\Height and ...
-
Suppose you got a file in Big5 containing some HKSCS characters (e.g. 深水埗, 赤鱲角, etc). When your environment (Ref: Charset.defaultCharset( ) ...