Problem: The icon is too small in the Polybar.
Solution: Use separate icon font for Polybar. Refer to Nerd Fonts Icon Problem in Polybar.
Install the icon-only font Symbols Nerd Font
$ wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.zip
$ x NerdFontsSymbolsOnly.zip && cd NerdFontsSymbolsOnly
$ mv SymbolsNerdFontMono-Regular.ttf SymbolsNerdFont-Regular.ttf ~/.local/share/fonts/
$ fc-cache -fvSet it in the Polybar configuration file.
# ~/.config/polybar/config.ini
font-0 = monospace;2
font-1 = "Symbols Nerd Font Mono:size=16"Problem: The parser of Neovim are conflict with that of nvim-treesitter plugin
Solution: :TSUpdate to install all the missing parser. And also change the lazy configuration:
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
...
}Need: Looking up dictionary with Rofi.
Solution: With Rofi dmenu mode, we can easily add scripts that can be found by rofi.
Add a query scripts with kd
#!/bin/bash
# Get Queries
query_word=$(rofi -dmenu -p "dict")
# Execute
termite -r pop-up -e "kd $query_word"And move it into one of the paths shown by:
$ G_MESSAGES_DEBUG=Modes.Run rofi -show run -no-configAnd then try rofi
$ rofi -combi-modi run,window,drun -show combi -modi combi -dpi 1Context: Needed to run a daily script to update my coding journal without manual intervention.
Need: Schedule regular journal updates via a user-level systemd service (no root required).
Solution: Created a systemd timer and service for my user:
# ~/.config/systemd/user/daily-jobs.service
[Unit]
Description=Daily Jobs Runner
After=network.target
[Service]
Type=oneshot
ExecStart=/home/cyc/Projects/daily-jobs/bin/run-all-jobs.sh
WorkingDirectory=/home/cyc/Projects/daily-jobs
StandardOutput=journal # Logs to user journal
StandardError=journal
[Install]
WantedBy=timers.target # ~/.config/systemd/user/daily-jobs.timer
[Unit]
Description=Run Daily Jobs at 12:00 PM
[Timer]
OnCalendar=12:00:00 # Triggers daily at noon
Persistent=true # Run if missed during downtime
[Install]
WantedBy=timers.target Activation:
systemctl --user enable --now daily-jobs.timer # Start and enable Result:
- Script now runs daily at 12:00 PM (verify with
journalctl --user -u daily-jobs). - Logs appear in the user journal (
--user-unit=daily-jobs).
Resources:
#systemd #automation #linux
Need: Automatically mount a network share (//192.168.1.3/Team_Folder) only after a VPN connection establishes. Systemd dependencies and credential security were key requirements.
Solution:
-
Credential File Setup:
sudo mkdir /etc/credentials sudo tee /etc/credentials/tank-cifs.cred <<EOF username=<name> password=<password> EOF sudo chmod 600 /etc/credentials/tank-cifs.cred
-
Systemd Mount Unit:
# /etc/systemd/system/mnt-tank.mount [Unit] Description=Mount Team_Folder Requires=tank-openvpn.service After=tank-openvpn.service network-online.target [Mount] What=//192.168.1.3/Team_Folder Where=/mnt/tank Type=cifs Options=vers=3.0,credentials=/etc/credentials/tank-cifs.cred,uid=1000,gid=1000
Result:
- Successfully mounts after VPN establishes (
systemctl status mnt-tank.mountshows active) - Verified with
mount | grep /mnt/tankand file access tests
Notes:
- Requires
network-online.targetfor reliable startup _netdevmount option is not needed since OpenVPN startup after the network is ready
Resources:
#linux #systemd #vpn #cifs #automount
Context: In a Git - based project, there were multiple commits made with an incorrect author. To ensure proper attribution, it was necessary to change the author of these commits to Chen Yichi <trswnca@yeah.net>.
Problem/Need: Change the author information of six specific commits in the Git repository to Chen Yichi <trswnca@yeah.net>.
Solution/Approach:
- Start an interactive rebase:
git rebase -i 2028312c0e4325e5eccbc72f12fe47adbce2df98^The ^ is used to include the specified commit in the rebase range.
- Edit the rebase file:
Open the file in the text editor that appears after the above command. Change each line starting with
picktoedit. For example:
edit 2028312c0e4325e5eccbc72f12fe47adbce2df98 fix: embedding provider for dataloader is missing
edit cd9975f7e7e7a5df7cf7b9d7c564f89cd169d993 feat: Add langchain mode and introduce python - dotenv
#... and so on for all relevant commits
Save and close the file.
- Modify the author information for each commit:
When the rebase pauses at each
editcommit, run the following command to change the author without editing the commit message:
git commit --amend --author="Chen Yichi <trswnca@yeah.net>" --no - edit- Continue the rebase: After modifying the author of a commit, run the following command to move on to the next commit:
git rebase --continue- Force - push the changes to the remote repository:
git push -f origin masterResult: The author information of the specified six commits in the local and remote Git repository should now show as Chen Yichi <trswnca@yeah.net>. Verification can be done by running git log in the local repository and checking the author information of the relevant commits. Also, visit the remote repository on the hosting platform (e.g., GitHub) and check the commit history there.
#git #coding #author
Context: Cursor’s AI models are region-locked, requiring a proxy for access in unsupported regions.
Problem/Need:
- While a system-wide TUN proxy works, it’s not an elegant solution.
- Attempting to use
proxychainscaused crashes (zygote_host_impl_linux.ccerrors) and network timeouts. - Needed a native proxy solution to avoid Electron compatibility issues.
Solution/Approach:
Configure Cursor’s proxy in user settings.json (Ctrl + Shift + P and choose Preferences: Open User Settings (JSON)):
"http.proxy": "http://127.0.0.1:20171",
"cursor.general.disableHttp2": true#proxy #electron #cursor #linux #debugging
Context: Managing HTTPS certificates for multiple domains via Certbot, previously done manually. The system lacked default renewal tasks.
Problem/Need: Automate certificate renewal monthly via cron while preserving custom Nginx paths (/usr/local/nginx/conf), ensuring zero downtime.
Solution/Approach:
- Create cron job (run as root):
sudo crontab -e
- Monthly renewal + safety checks:
Key arguments:
# Primary: Renew on 1st monthly, quiet mode, reload Nginx 15 3 1 * * /usr/bin/certbot renew --quiet --nginx-server-root /usr/local/nginx/conf --deploy-hook "/usr/local/nginx/sbin/nginx -s reload" # Fallback: Force renewal on 15th if cert expires in ≤30 days 0 4 15 * * /usr/bin/bash -c '/usr/bin/certbot certificates | grep "VALID: 30" && /usr/bin/certbot renew --force-renewal --nginx-server-root /usr/local/nginx/conf --deploy-hook "/usr/local/nginx/sbin/nginx -s reload"'
--nginx-server-root: Custom Nginx config path--deploy-hook: Reload Nginx without downtime
Result:
- Certificates auto-renew monthly.
- Verification:
sudo certbot certificates # Check "Expiry Date" sudo tail -f /var/log/letsencrypt/letsencrypt.log # Monitor renewals
Resources:
- Certbot Renewal Docs
- crontab.guru (schedule helper)
#ssl #nginx #automation #cron #letsencrypt
Context: Automating system activation bypassing manual processes using a third-party script in an elevated PowerShell environment.
Problem/Need: Simplify activation of Windows 10 and Office by executing remote scripts to handle productId keys and licensing workflows.
Solution/Approach:
# Run PowerShell as Administrator
$irm https://get.activated.win | iex Note: irm (Invoke-RestMethod) downloads the script, and iex (Invoke-Expression) executes it.
Resources:
#tags #windows10 #msoffice #powershell #activation #scripting
Context: Extracted a ZIP file (【学生版本】研究生.zip) in a Linux terminal (zsh), but file/directory names displayed as garbled Cyrillic text (б╛╤з╔·░ц▒╛б┐...) instead of Chinese characters.
Problem/Need: Restore correct filenames when unzipping archives created in Windows (GBK encoding) on UTF-8 systems.
Solution/Approach:
- Specify encoding during extraction:
unzip -O GBK "【学生版本】研究生.zip"- If already extracted, fix garbled names recursively using
convmv:
sudo apt install convmv # Install tool
convmv -f GBK -t UTF-8 --notest -r *Result: Filenames restored to correct Chinese characters. Verified via ls showing readable names.
Notes:
- Always wrap filenames with spaces/symbols in quotes:
"file (1).zip" unar -e GBKis a robust alternative for multi-encoding archives
Resources:
Convmv documentation
ZIP encoding issues
#linux #encoding #filesystem #zsh
Context: Setting up OpenTabletDriver daemon auto-launch on a systemd-based Linux system where the service failed to start automatically due to unmet display server conditions.
Problem/Need: The opentabletdriver.service failed to start because it required DISPLAY or WAYLAND_DISPLAY environment variables that weren't available when the systemd user service initialized.
Solution/Approach: Created a systemd service override to explicitly set environment variables and remove restrictive conditions:
# Create override directory and config
mkdir -p ~/.config/systemd/user/opentabletdriver.service.d/
cat <<EOF > ~/.config/systemd/user/opentabletdriver.service.d/override.conf
[Unit]
# Remove failing condition checks
ConditionEnvironment=
[Service]
# Explicitly set default X11 display (Wayland requires 'WAYLAND_DISPLAY=wayland-0')
Environment="DISPLAY=${DISPLAY:-:0}"
EOF
# Apply changes
systemctl --user daemon-reload
systemctl --user enable --now opentabletdriver.serviceResult: Service starts successfully after login (systemctl --user status opentabletdriver.service shows active/running). Verified tablet functionality responds immediately upon login.
Notes:
- Wayland users must replace
DISPLAYwithWAYLAND_DISPLAY=wayland-0
Resources:
Original service file
Systemd environment variables
#linux #systemd #opentabletdriver #autostart
Context: Working with python-build-standalone project on Manjaro Linux, attempting to build Python for x86_64-unknown-linux-musl target. The Docker build process was failing during package installation phase in Debian-based containers.
Problem/Need:
- Docker build failing with "Unable to locate package" errors for essential build tools
- Outdated Debian Jessie snapshot repositories from March 2023 were no longer accessible
- Multiple packages (bzip2, ca-certificates, curl, gcc, make, etc.) could not be installed in Docker containers
Solution/Approach:
-
Updated Debian base image and repositories:
In
cpython-unix/base.Dockerfile:
# Changed from outdated Jessie with snapshots:
FROM debian@sha256:32ad5050caffb2c7e969dac873bce2c370015c2256ff984b70c1c08b3a2816a0
# To current Debian 11:
FROM debian:11-slimSimplified repository configuration by removing complex snapshot URLs and using standard Debian repos.
-
Fixed package compatibility:
In
cpython-unix/build.Dockerfile:
# Changed incompatible package name:
perl # Not available in newer Debian
perl-base # Available replacement- Cleared Docker cache and rebuilt:
docker system prune -f
./build-linux.py --target x86_64-unknown-linux-muslResult:
- Python host compilation proceeds normally with all required build tools installed
- Extension modules compile successfully, confirming all dependencies are available
- Build process now progresses through Python 3.11 compilation as expected
Notes:
- Debian Jessie snapshot repositories are unreliable; using current stable releases is more maintainable
- Package names may differ between Debian versions (perl vs perl-base)
- Docker build cache can persist problematic layers, requiring explicit cleanup
Resources:
- Docker proxy configuration documentation
- Debian package archive documentation
- python-build-standalone project
#docker #debian #package-management #build-systems #proxy-troubleshooting
Context: Linux Bluetooth service was active, but paired Sony WH-1000XM4 headphones wouldn't automatically connect on boot.
Problem/Need: Device showed "Paired: yes" but "Trusted: no" in bluetoothctl, causing a "paired but not connected" state that required manual reconnection.
Solution/Approach:
- Verify Bluetooth service status:
sudo systemctl status bluetooth.service # Confirmed service was active/running- Use
bluetoothctlto mark the device as trusted:
bluetoothctl
[WH-1000XM4]> info 88:C9:E8:E9:44:90 # Checked "Trusted: no"
[WH-1000XM4]> trust 88:C9:E8:E9:44:90 # Set device to trusted
[CHG] Device 88:C9:E8:E9:44:90 Trusted: yes # Success confirmation- Restart the Bluetooth service to apply changes:
sudo systemctl restart bluetooth # Required after trust modificationResult: Device now shows Trusted: yes in bluetoothctl info output. Verified by rebooting and confirming automatic connection (no manual connect command needed).
Notes:
trustis mandatory for auto-connect even if paired; Linux won't automatically connect without this flag.systemctl restart bluetoothis required after trust-state changes.- TODOs: Monitor
/var/log/syslogif authentication errors persist.
Resources:
man bluetoothd: bluetoothd(8) docs
#linux #bluetooth #bluetoothctl #auto-connect