Baiwei's Blog
website·Indexed 31 days ago
https://blog.baiwei.site/archives/A personal technical blog featuring guides on Python programming, data structures (hash tables, arrays, linked lists, binary trees, stacks, and queues), and NAS home lab setups. Content includes tutorials on Docker, Hexo automation, GitHub Actions, Cloudflare Tunnel, and software installations like Parallels Desktop 18 and rclone.
What's inside Baiwei's Blog
- The GIL ensures that only one thread executes Python bytecode at a time. This means multi-threading is effective for I/O-bound tasks but provides little to no advantage for CPU-bound tasks, and may even slow them down due to resource contention.
Install Ubuntu 22 on macOS using Parallels Desktop 18
There are two primary methods to install Ubuntu 22 in Parallels Desktop 18 on macOS. For MacBook users with ARM architecture, it is critical to use the ARM version of the operating system to avoid compatibility issues.Method 1: Use the built-in system image selection within the Parallels Desktop 18 interface for automatic download and installation. Method 2: Manually download the ARM ISO image from the official Ubuntu server (https://cn.ubuntu.com/download/server/arm) and perform a local installation.
Build an automated Hexo publishing system on Synology NAS with Docker
Set up a high-efficiency Hexo blog system on a Synology NAS using Docker. This architecture supports automatic updates triggered by Git, process management via PM2, and external access through Cloudflare Tunnel.
System Architecture:
- Environment: Node.js 18, Git, Webhook, and PM2.
- Network: Host mode (shares host IP for local proxy access).
- Automation Flow: Local Push $\rightarrow$ GitHub Webhook $\rightarrow$ NAS Webhook listener $\rightarrow$ execute
deploy.sh$\rightarrow$ PM2 restarts Hexo. - External Access: Cloudflare Tunnel for domain mapping and SSL encryption.
Prerequisites:
- Install 'Git Server' from the Synology Package Center.
git --versionArchitect an automated Hexo deployment system on Synology NAS
The system uses a containerized environment (Node.js 18, Git, Webhook, PM2) running in Host network mode to share the NAS IP. The automation flow is: Local Push $\rightarrow$ GitHub Webhook $\rightarrow$ NAS Webhook listener $\rightarrow$ Execution ofdeploy.sh$\rightarrow$ PM2 restart of Hexo. External access and SSL are handled via Cloudflare Tunnel.Understand Deque applications
A double-ended queue (deque) combines the logic of both stacks (LIFO) and queues (FIFO). Consequently, it can be used to implement any application scenario that requires either a stack or a queue, while offering greater flexibility by allowing operations at both ends.Install rclone on Linux
Install rclone using the official installation script. After installation, verify the version to ensure it is working correctly.sudo -v ; curl https://rclone.org/install.sh | sudo bash # Verify installation rclone versionAutomate Hexo deployment with a shell script and Webhook
Create adeploy.shscript to pull the latest code, install dependencies, generate the static site, and restart the Hexo server via PM2. Define the trigger inhooks.jsonto execute this script when a valid GitHub Webhook request is received.#!/bin/bash export PATH=$PATH:/usr/local/bin:/usr/local/lib/node_modules/npm/bin cd /blog # 1. Update code and dependencies git pull origin master npm install # 2. Build npx hexo g # 3. PM2 Process Management (Port 15345) if pm2 list | grep -q "hexo-blog"; then pm2 restart "hexo-blog" else pm2 start "npx hexo s -p 15345" --name "hexo-blog" fi[ { "id": "redeploy-blog", "execute-command": "/blog/deploy.sh", "command-working-directory": "/blog", "response-message": "Deployment started...", "trigger-rule": { "match": { "type": "payload-hash-sha256", "secret": "your_secure_token", "parameter": { "source": "header", "name": "X-Hub-Signature-256" } } } } ]Prepare Synology NAS environment for Hexo Docker deployment
Before deploying the Docker containers, install the Git Server from the Synology 'Package Center' and clone the blog repository to a local directory on the NAS.# Verify Git installation git --version # Clone repository cd /volume1/docker git clone https://github.com/your-username/repo-name.git my-blog cd my-blogInstall and configure ClashX on macOS
ClashX is a macOS GUI for the Clash core, a rule-based cross-platform network proxy written in Go. It supports protocols including Vmess, Shadowsocks, Shell, and SOCKS5.
Follow these steps to set up ClashX:
- Download and install the
.dmgfile from the official releases page. - Copy your Clash subscription URL from your provider.
- Launch the application (if macOS warns about an 'unknown developer', allow the app to open in System Settings).
- Add your subscription: Click the ClashX icon in the menu bar $\rightarrow$ Config $\rightarrow$ Managed Configuration $\rightarrow$ Manage, then add your subscription URL.
- Select the generated configuration file.
- Enable the proxy: Click the ClashX menu bar icon, set the 'Outbound Mode' to 'Rule' (规则判断), select a preferred line in the 'Proxy' or 'Global' strategy group, and click 'Set as System Proxy'.
# Download link for ClashX releases https://github.com/yichengchen/clashX/releases- Download and install the
Configure GitHub Webhooks and Cloudflare Tunnel for Hexo
To enable remote triggers and public access, configure a GitHub Webhook and Cloudflare Tunnel mappings. The Webhook should point to the tunnel's hook URL, and the tunnel should map the blog and hook domains to the internal ports 15345 and 9000 respectively.GitHub Webhook: - Payload URL: https://webhook.yourdomain.com/hooks/redeploy-blog - Content type: application/json - Secret: [Same as hooks.json] Cloudflare Tunnel Mappings: - blog.yourdomain.com -> http://127.0.0.1:15345 - webhook.yourdomain.com -> http://127.0.0.1:9000Optimize Universal Studios Japan (USJ) visit
To maximize a visit to USJ, arrive at least 1.5 hours before the official opening (often 09:00), as the park frequently opens as early as 08:00. Use the official app immediately upon entry to secure a 'Timed Entry' ticket (整理券) for Super Nintendo World. To reduce wait times, utilize 'Single Rider' lanes for high-demand attractions including Donkey Kong's Crazy Mine Cart, Mario Kart, and Harry Potter and the Forbidden Journey. For the Flying Dinosaur, the Single Rider lane is highly recommended for a better experience. Avoid peak lunch hours (12:00) by eating later, such as at the Monster Hunter: Wilds collaboration restaurant (Wudwud Feast).Hardware requirements for Xpenology installation
To successfully set up a Black Synology (Xpenology) system, the following hardware components are essential:
- USB Flash Drive: Required to act as the bootloader for the system.
- NAS-Grade Hard Drives: While standard drives (e.g., Seagate Blue) work, NAS-specific drives (e.g., Seagate IronWolf) are recommended for 24/7 operation.
- ITX Motherboard: A small form factor board with sufficient SATA ports for the desired drive count.