Skip to content

Instantly share code, notes, and snippets.

View gzxu's full-sized avatar

徐广钊 XU Guang-zhao gzxu

  • NVIDIA
  • Shanghai
View GitHub Profile
@gzxu
gzxu / 00-ADDRESS-VSCODE-NLS-MISSING-ERROR.md
Last active April 16, 2026 10:10
Address "Error: Uncaught Error: !!! NLS MISSING" when starting VS Code in serve-web mode via the CLI

Background

See microsoft/vscode#299425 for additional context. The issue typically presents with the following symptoms:

  1. The page becomes blank after VS Code Server is downloaded and started.
  2. The browser developer console (F12) shows errors such as workbench.js:405 Uncaught Error: !!! NLS MISSING:.

Solution

  1. Open the browser developer tools (F12) and refresh the VS Code web page. You should see two requests for nls.messages.js. The second request should target the localized file, for example: https://www.vscode-unpkg.net/nls/560a9dba96f961efea7b1612916f89e5d5d4d679/1.116.0/zh-cn/nls.messages.js.
@gzxu
gzxu / my-unciv-tool.py
Last active April 12, 2026 06:18
Tool for Unciv
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
from typing import Any
JsonDict = dict[str, Any]
@gzxu
gzxu / Makefile
Created September 17, 2021 14:30
Call trampoline for GCC/Clang, similar to Microsoft C++ import libraries, permitting loading failures for shared objects without immediately aborting the program
.PHONY: clean
.DEFAULT: main
main: main.o trampoline_curl.o
gcc $^ -ldl -o $@
main.o: main.c trampoline_curl.h
gcc -c -O3 -fPIC $< -o $@
trampoline_curl.o: trampoline_curl.c trampoline_curl.h
@gzxu
gzxu / README.md
Last active May 24, 2024 19:57
Run rsync server on Android Termux

Usually we will use this command

rsync --dry-run -a --mkpath --no-o --no-g --no-p -P -c SRC/ DST/

Remove --dry-run to actually copy the files rather than merely comparing

Remove -c to make it faster by comparing mod-time and size rather than checksum

@gzxu
gzxu / sedutil-pbkdf2.sh
Last active June 26, 2024 22:30
Unlock an SED-supporting SSD with sedutil Hardware Encryption
device=sdb
serial="$(ls -la /dev/disk/by-id | grep "/$device\$" | sed 's/ /\n/g' | grep ata | sed 's/_/\n/g' | tail -n1)"
read -r -s password
hashed=$(SERIAL="$serial" PASSWORD="$password" python3 -c 'import hashlib, base64, os; print(base64.b64encode(hashlib.pbkdf2_hmac("sha1", os.environ["PASSWORD"].encode(), os.environ["SERIAL"].ljust(20, " ").encode(), 75000, 32)).decode())' | base64 -d)
sudo sedutil-cli -n --listLockingRanges "$hashed" /dev/$device
@gzxu
gzxu / init-linux.sh
Created September 18, 2020 13:09
Init a new Linux installation
# Base
cat /etc/apt/sources.list
sudo sed -i 's/archive.ubuntu.com/mirrors.xtom.com.hk/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/mirrors.xtom.com.hk/g' /etc/apt/sources.list
sudo sed -i 's|http://|https://|g' /etc/apt/sources.list
cat /etc/apt/sources.list
sudo apt update && sudo apt upgrade
# XRDP and KDE
sudo apt install xrdp xorg-
@gzxu
gzxu / QuickXorHash.rs
Last active June 15, 2022 07:41
Implementing the QuickXorHash Algorithm used by the Microsoft Graph API on OneDrive for Business
use std::env;
use std::fs;
// extern crate base64;
// From the specification
// https://docs.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash
// According to the spec, the block is "big-endian"
type Block = [u8; 20]; // Intrinsically with Copy trait
@gzxu
gzxu / 01_siso33ss.lib
Last active June 25, 2018 16:13
3×3 SISO State Space in LTspice
.subckt siso33ss U Y
G11 0 X1 X1 0 {a11}
G12 0 X1 X2 0 {a12}
G13 0 X1 X3 0 {a13}
G21 0 X2 X1 0 {a21}
G22 0 X2 X2 0 {a22}
G23 0 X2 X3 0 {a23}
G31 0 X3 X1 0 {a31}
G32 0 X3 X2 0 {a32}
G33 0 X3 X3 0 {a33}