Guozhenyi's Blog
website·Indexed 32 days ago
https://www.guozhenyi.comA personal blog featuring technical tutorials and life experiences. Technical content includes guides on MySQL 8.0 installation on Kylin V10, Git configuration, Linux server management (SSH password-free login, user groups), Node.js installation, VS Code C/C++ environment setup, and acme.sh SSL certificate automation. Also contains personal entries on automotive maintenance for BYD F3, travel, and general reflections.
What's inside Guozhenyi
- tmux is a terminal multiplexer that allows a user to decouple a terminal session from the window. This ensures that processes continue to run even after an SSH connection is closed. The hierarchy of tmux components is: Server → Session → Window → Panel.
Compare encrypted DNS protocols: DoH, DoT, and DoQ
Encrypted DNS protocols protect user privacy and prevent DNS hijacking by encrypting the request between the client and the resolver.
- DoH (DNS over HTTPS): Transmits DNS queries via the HTTPS protocol, leveraging standard web encryption to ensure privacy and security.
- DoT (DNS over TLS): Uses the Transport Layer Security (TLS) protocol to encrypt queries, typically operating on port 853 for end-to-end encryption.
- DoQ (DNS over QUIC): A modern approach using the QUIC protocol (based on UDP). It reduces connection establishment time and improves performance and encryption efficiency compared to TCP-based methods.
Perform a basic start-up in a manual transmission car
To start and move a manual transmission vehicle from a standstill on a flat road, follow these preparation and execution steps:
Preparation:
- Fasten the seatbelt.
- Adjust the seat so there is approximately one fist of distance between the knee and the dashboard.
- Adjust rearview mirrors.
- If the engine is off, depress the clutch (and optionally the brake), shift to neutral, and start the engine.
Execution:
- Depress the clutch fully.
- Shift into 1st gear.
- Release the handbrake.
- Activate the left turn signal.
- Slowly release the clutch. When the clutch is released to about two-thirds, the car will begin to move forward.
- Hold the clutch steady and continue releasing slowly while adding a small amount of throttle (accelerator) to ensure a smooth start and prevent stalling.
- Fully release the clutch as the engine speed increases.
Configure password-free SSH login for Linux servers from Windows
To facilitate file uploads from a Windows system to a Linux server, you can configure password-free SSH login by generating a key pair and uploading the public key to the server.# Generate an SSH key pair using Git Bash ssh-keygen -t rsa -C "admin@mail.com" # Use ssh-copy-id to upload the public key to the server ssh-copy-id <user>@<server-ip>Force traditional hibernation (S4) to bypass Modern Standby (S0) issues
If firmware or driver updates do not resolve overheating during lock screen, you can bypass Modern Standby (S0) by forcing the system into traditional hibernation (S4). This prevents the S0 activity loop and protects the battery from heat damage.# Create a shortcut with the following target to force hibernation instead of Win+L rundll32.exe powrprof.dll,SetSuspendState 0,1,0Flash a third-party MIUI 11 ROM via TWRP
Once TWRP is installed, follow these steps to flash a custom ROM (e.g., Android P-based MIUI 11):
- Transfer the ROM zip files to the phone's internal storage root directory.
- Perform a 'Wipe' (Double Wipe): In TWRP, select 'Wipe' and slide the bar to confirm the wipe of data and cache.
- Install Base ROM: Select 'Install', locate the required base ROM (e.g., Havoc-OS), and confirm installation.
- Second Wipe: Perform another 'Wipe' after the base ROM installation.
- Install Main ROM: Select 'Install' and flash the MIUI 11 Android P zip package.
- Install Patches: Flash any required fix/patch files provided by the ROM author.
- Reboot: Go to 'Reboot' > 'System'.
Install and use pnpm package manager
Install the pnpm package manager globally using npm. pnpm provides a more efficient alternative to npm for managing dependencies.# Install pnpm globally npm install -g pnpm # Common pnpm commands pnpm add vue # Install a package pnpm add -D vite # Install a development dependency pnpm remove vue # Remove a package pnpm run dev # Run a script defined in package.jsonConfigure Vite for Element Plus automatic on-demand imports
Configurevite.config.tsorvite.config.jsusingAutoImportandComponentsplugins with theElementPlusResolver. This setup ensures that both Vue components and Element Plus API functions are imported automatically without manual import statements.import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import { fileURLToPath, URL } from 'node:url' export default defineConfig({ plugins: [ vue(), AutoImport({ imports: ['vue', 'vue-router', 'pinia'], resolvers: [ElementPlusResolver()], dts: 'src/auto-imports.d.ts', eslintrc: { enabled: false }, }), Components({ resolvers: [ElementPlusResolver()], dts: 'src/components.d.ts', dirs: ['src/components'], extensions: ['vue'], }), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { host: '0.0.0.0', port: 5173, }, })Clone a remote Git repository
To copy a remote repository (e.g., from GitHub) to your local machine, use thegit clonecommand followed by the repository URL. This creates a local directory containing the full source code and version history.# Example: Clone a repository into a specific directory cd /d/code git clone https://github.com/tufu9441/maupassant-hexo.gitInstall PHP 7.2 on Ubuntu 20.04 using Ondřej Surý PPA
Since Ubuntu 20.04 defaults to PHP 7.4, you must use the Personal Package Archive (PPA) provided by Ondřej Surý to install PHP 7.2. This involves adding the PPA repository, updating the package list, and installing the PHP 7.2 core and common extensions.# Add the PHP PPA sudo add-apt-repository ppa:ondrej/php # Update package lists sudo apt update # Install PHP 7.2 and common extensions sudo apt install php7.2 php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-bcmath php7.2-gdManually integrate Algolia DocSearch into a website
To manually add Algolia DocSearch, you need to add a container element, include the CSS stylesheet, and initialize the search with a JavaScript snippet using your specificappId,apiKey, andindexNameprovided by Algolia.<!-- 1. Add the search container --> <div id="docsearch"></div> <!-- 2. Include the CSS (Example using unpkg CDN) --> <link rel="stylesheet" href="https://unpkg.com/@docsearch/css@3.9.0/dist/style.css" /> <!-- 3. Initialize the JS (Example using unpkg CDN) --> <script src="https://unpkg.com/@docsearch/js@3.9.0/dist/umd/index.js"></script> <script> docsearch({ appId: "YOUR_APP_ID", apiKey: "YOUR_API_KEY", indexName: "YOUR_INDEX_NAME", insights: true, container: "#docsearch", debug: false }); </script><!-- Optional: CSS to position the search box --> <style> #docsearch { position: absolute; right: 0; top: 0; } </style>
Import a custom Debian distribution into WSL
Use thewsl --importcommand to install a specific Debian version from a rootfs tarball. You must specify a distribution name, the target installation directory, and the path to the rootfs file. It is recommended to use--version 2to ensure the distribution runs on WSL2.# Example command structure: # wsl --import <DistroName> <InstallLocation> <RootfsPath> --version 2 # Example for Debian 11: wsl --import Debian11 C:\wsl\debian11 .\debian11-rootfs.tar --version 2