作者: remo

  • Prevent ‘Zone.Identifier’ Files from Appearing in WSL2

    When using Windows Subsystem for Linux 2, we access our Linux file system using Windows Explorer. When we copying and pasting files, might notice addition files like ‘xxx Zone.Identifier‘.

    The ‘Zone.Identifier‘ file is a Windows Attachment Manager feature that stores security information about files. However, since WSL2 uses an ext4 file system, Windows cannot store ADS natively. Instead, it creates a visible ‘Zone.Identifier‘ file in the same directory.

    1. Delete Existing Files

    If you already have ‘Zone.Identifier‘ files in your WSL2 directories, use one of the following methods to remove them.

    find ~/[Your Path] -name "*:Zone.Identifier" -delete
    Bash

    2. Disable Windows from Generating ‘Zone.Identifier

    If you frequently access WSL2 files from Windows and want to permanently stop Windows from attaching ‘Zone.Identifier’, you can disable this feature via Group Policy or Registry Editor.

    Press Win + R, type gpedit.msc, and hit Enter.

    Configuration → Administrative Templates → Windows Components → Attachment Manager
    用户配置 → 管理模板 → Windows 组件 → 附件管理器(In Chinese)

    Enable “Do not preserve zone information in file attachments

  • [Leetcode]4 Mar. 2025. Count Trailing Zeros in Factorial

    Description:

    Given an integer $n$ , return the number of trailing zeros in $n!$ (n factorial).

    Factorial is defined as:
    $$
    n! = n \times (n – 1) \times (n – 2) \times \dots \times 3 \times 2 \times 1
    $$

    Examples:

    Example 1:
    Input: n = 3
    Output: 0
    Explanation: 3! = 6, which has no trailing zeros.

    Example 2:
    Input: n = 5
    Output: 1
    Explanation: 5! = 120, which has one trailing zero.

    Example 3:
    Input: n = 0
    Output: 0

    Constraints:

    • $0 \leq n \leq 10^4$

    class Solution {
    public:
        int trailingZeroes(int n) {
            int count;
            while(n >= 5){
                n = n / 5;
                count += n;
            }
            return count;
        }
    };
    
    /*
    ## Counting 5 as a factor.
    
    We Need To Determine how many times "10" appears as a factor in the product.
    
    10 is formed by multiplying 2 & 5, we can only count 5 as a factor.
    
    eg:
    - 3! = 3*2*1 = 6 -> +0
    - 5! = 5*4*3*2*1 = 120 -> +1
    - 10! = 10*9*...*3*2*1 = 3628800 -> +2
    */
    C++

  • Typst就是个半成品。。

    Typst就是个半成品。。

  • 真三国无双起源 貂蝉mod

    真三国无双起源 貂蝉mod

    使用方法: 把文件解压放在根目录就可以了. 服装使用默认. 如果想换回初始角色, 删除dll即可.

  • Copy-Paste Between VMware Virtual Machine and Host (Shared Clipboard)

    To enable copy-paste between a VMware virtual machine and the host system, follow these steps:

    Install the necessary tools:

    sudo apt install open-vm-tools
    sudo apt install open-vm-tools-desktop
    Bash

    Go to: VMware > Virtual Machine > Settings > Options > Guest Isolation

    Enable the Copy and Paste feature.

    Then, Restart your system.

    sudo reboot
    Bash

  • wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。

    link to: https://github.com/microsoft/WSL/releases/tag/2.0.0

    Windows 11 24H2

    1. Open or create the wsl configuration file (located at %USERPROFILE%\.wslconfig ), and enter the following content:

    [experimental]
    autoMemoryReclaim=gradual | dropcache | disabled
    networkingMode=mirrored
    dnsTunneling=true
    firewall=true
    autoProxy=true
    Bash

    2. Open the command prompt and execute wsl --shutdown

  • pbrt-v4 build on windows 11 cmake generation requires target “zlibstatic” that is not in any export set. (English)

    link same issue: https://github.com/mmp/pbrt-v4/issues/467

    My Env:

    • Win11 24H2
    • AMD Ryzen 9 5900X 12-Core Processor
    • Microsoft Visual Studio Community 2022 17.12.3
    • VisualStudio.17.Release/17.12.3+35527.113
    • Microsoft .NET Framework 4.8.09032
    • Visual C++ 2022 00482-90000-00000-AA244
    • Microsoft Visual C++ 2022

    Log:

    1> [CMake] CMake Error: install(EXPORT “Ptex” …) includes target “Ptex_static” which requires target “zlibstatic” that is not in any export set.
    1> [CMake] — Generating done (0.2s)
    1> [CMake] CMake Generate step failed. Build files cannot be regenerated correctly.

    Place the following file to pbrt4 dir and double click to compile.

    Then cd ./build/pbrt4deploy -> ./pbrt

    Log:

    PS G:\pbrt\pbrt-v4\pbrt-v4\build\pbrt4deploy\bin> ./pbrt
    pbrt version 4 (built Jan 6 2025 at 21:39:19)
    Copyright (c)1998-2021 Matt Pharr, Wenzel Jakob, and Greg Humphreys.
    The source code to pbrt (but not the book contents) is covered by the Apache 2.0 License.
    See the file LICENSE.txt for the conditions of the license.

    Then maybe you will get the following Warnning:

    link to: https://www.janwalter.org/rnd/blog/rnd-pbrt-v4-002/

    Log:

    Found CUDA but PBRT_OPTIX7_PATH is not set. Disabling GPU compilation

    Make sure that the SDK Path is correct. (-DPBRT_OPTIX7_PATH)

  • 在WSL中使用本地Clash代理

    在WSL中使用本地Clash代理

    首先查看Clash的端口, 我这里是7890.

    本机PowerShell中, 输入 ipconfig ,

    找到最下面的 vEthernet (WSL (Hyper-V firewall)), 记住这里的IPv4地址. 我这里是 172.20.0.1 .

    接下来在WSL中, ~/.bashrc 里面添加如下代码:

    alias proxy='export all_proxy=http://172.20.0.1:7890'
    alias unproxy='unset all_proxy'

    保存, 然后执行下面的代码激活:

    source ~/.bashrc

zh_CNCN