作者: xiaoxing

  • ubuntu24.04安装 各个版本的python

    sudo add-apt-repository ppa:deadsnakes/ppa
    
    sudo apt update
    
    sudo apt install python3.9 python3.9-venv python3.9-dev
    
    sudo apt install python3.11 python3.11-venv python3.11-dev
    
    python3.9 --version
    
    python3.11 --version
    
    python3.12 --version

    国内无法安装可以使用

    --------------------------------------------------------
    方案一:使用 uv(推荐,最快)
    
    如果你的目的是创建 Python 3.9/3.11 虚拟环境,推荐使用 uv。
    
    安装:
    
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    然后:
    source $HOME/.local/bin/env
    
    uv python install 3.9
    uv python install 3.11
    
    不过,这也需要能够访问国外网络。如果服务器没有代理,就不适合。
    创建虚拟环境
    uv venv --python 3.9 .venv
    uv venv --python 3.11 .venv
    
    进入虚拟环境重新安装一下pip  否则可能没有pip包
    python -m ensurepip --upgrade
    
    如果太慢  换一下源
    
    mkdir -p ~/.pip
    
    cat > ~/.pip/pip.conf <<EOF
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    trusted-host = pypi.tuna.tsinghua.edu.cn
    timeout = 60
    EOF
    
    cat > ~/.pip/pip.conf <<EOF
    [global]
    index-url = https://mirrors.aliyun.com/pypi/simple/
    trusted-host = mirrors.aliyun.com
    timeout = 60
    EOF
    
    
    --------------------------------------------------------
    
    
    方案二:源码编译(推荐给服务器)
    
    直接下载源码(国内镜像):
    
    例如华为云:
    
    wget https://mirrors.huaweicloud.com/python/3.9.23/Python-3.9.23.tgz
    
    或者 3.11:
    
    wget https://mirrors.huaweicloud.com/python/3.11.13/Python-3.11.13.tgz
    
    然后:
    
    tar xf Python-3.9.23.tgz
    cd Python-3.9.23
    
    ./configure --enable-optimizations
    make -j$(nproc)
    sudo make altinstall
    
    安装完成后:
    
    python3.9 --version

  • ubuntu 设置密钥登录

    1. 在本地生成密钥对

    在本地电脑上执行(Windows/Mac/Linux 都可以):

    ssh-keygen -t ed25519 -C "1111222@qq.com"

    按提示操作:

    • 保存位置:直接回车(默认 ~/.ssh/id_ed25519)
    • 密码:可以设置密码增加安全性,或直接回车留空
    • Enter file in which to save the key (C:\Users\Administrator/.ssh/id_ed25519):
    • Enter passphrase (empty for no passphrase):
    • Enter same passphrase again:

    旧系统兼容性:如果服务器不支持 ed25519,改用 RSA:

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

    2. 将公钥复制到服务器

    先查看本地公钥内容:

    在 C:\Users\Administrator\.ssh\id_ed25519.pub

    登录服务器,将公钥追加到授权文件:

    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    #很短的一行的公钥信息 包含邮箱的  私钥证书一样的用于本地连接用 可以设置密码
    echo "粘贴你的公钥内容" >> ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys

    3. 配置 SSH 服务(增强安全性)

    sudo vim /etc/ssh/sshd_config
    # 禁用密码登录(确认能用密钥登录后再设置!)
    PasswordAuthentication no
    
    # 禁用 root 密码登录(如需允许 root 密钥登录,设为 prohibit-password)
    PermitRootLogin prohibit-password
    
    # 禁用空密码
    PermitEmptyPasswords no
    
    # 启用公钥认证
    PubkeyAuthentication yes

    注意:保存后,一定要先验证配置是否正确(非常重要!):

    sudo sshd -t

    如果没有错误输出,重启 SSH 服务:

    ubuntu
    sudo systemctl restart ssh
    
    
    centos
    sudo systemctl restart sshd   

    4 客户端 FinalShell 登录 选择私钥 位置

    C:\Users\Administrator.ssh\id_ed25519

  • mysql安全的添加索引

    ALTER TABLE app_member_ext
    ADD INDEX idx_uid (uid),
    ALGORITHM=INPLACE, LOCK=NONE;

    对于InnoDB引擎的普通索引:

    • ALGORITHM=INPLACE:不会全表复制,只修改元数据和填充索引页
    • LOCK=NONE:允许并发读写,不会阻塞DML操作
    • 结论:可以在线执行,不会导致业务中断

    注意. 主键索引不支持

    如何安全的重命名 表

    RENAME TABLE
    table1 TO table1_backup_20260509,
    table1_copy1 TO table1;
    
    假设有  table1_copy1  完全复制 table1  结构和数据
    先将  table1  改为  table1_backup_20260509
    然后将  table1_copy1  重命名为 table1   完成。
    
    原子性:MySQL 会锁住字典,确保在重命名期间不会有新的查询进来。当语句执行完毕,所有后续的查询都会指向新的表(即原来的 copy1)。
    
    回滚简单:如果新表有问题,你可以马上执行反向操作,把名字换回来,数据零损失。

  • git常用命令

    1.将本地代码推送到远程空仓库

    设置远程仓库的地址
    git remote set-url origin https://codeup.aliyun.com/123456/sph/sph_crawler.git
    
    推送并绑定master分支
    git push -u origin master
    
    强制推送 覆盖远程
    git push -f origin master
    
    

    常用的gitignore文件

    # Python
    # 字节编译的 Python 文件
    __pycache__/
    *.py[cod]
    *$py.class
    *.so
    .Python
    
    # 虚拟环境
    venv/
    env/
    .venv/
    ENV/
    
    # 编辑器
    # VS Code
    .vscode/
    *.code-workspace
    
    # PyCharm
    .idea/
    *.iml
    *.ipr
    *.iws
    
    # 其他编辑器
    *.swp
    *.swo
    *~
    .DS_Store
    
    # 日志目录
    logs/
    *.log
    
    # 环境配置文件
    .env
    .env.example
    
    # 其他
    *.egg-info/
    dist/
    build/
    .pytest_cache/
    .coverage
    htmlcov/
    
  • VSCode 、Cursor使用

    1 、如何关闭多余的工作区

    ctrl+w 关闭

    2、打开或关闭终端显示

    Ctrl+` (tab上面的反引号)

    3、修改标题栏的颜色

    Ctrl + Shift + P
    → Preferences: Open User Settings (JSON)

    打开用户设置

    "workbench.colorCustomizations": {
            "titleBar.activeBackground": "#3c5985",       // 深灰色
            "titleBar.activeForeground": "#fffb00",       // 橙黄色
            "titleBar.inactiveBackground": "#008000",     // 绿色
            "titleBar.inactiveForeground": "#FF8C00"      // 橙色
        }

    4自动补全头文件

    1 自动补全头文件
    
    
    001 按 Ctrl + Shift + P
    
    002 输入 Preferences: Configure User Snippets
    
    选择 python.json
    
    {
    	"Python File Header": {
    	  "prefix": "pyhd",
    	  "body": [
    		"# -*- coding: utf-8 -*-",
    		"\"\"\"",
    		"-------------------------------------------------",
    		"   File Name:     ${TM_FILENAME}",
    		"   Description :   $1",
    		"   Author :        Xiaoxing",
    		"   date:          ${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}  ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
    		"-------------------------------------------------",
    		"\"\"\""
    	  ],
    	  "description": "Auto generate Python file header"
    	},
    
    	"a main guard": {
        "prefix": "main2",
        "body": [
          "if __name__ == '__main__':",
          "   pass"
        ],
        "description": "Insert Python main guard"
      }
    
    }

    5 实现 ctrl+d 复制本行到下一行

    按下 Ctrl + Shift + P 打开命令面板。
    输入并选择 Preferences: Open Keyboard Shortcuts (JSON)

    首选项:打开键盘快捷方式 (JSON)


    在打开的 keybindings.json 文件的中括号 [] 里,添加以下代码并保存:

    {
            "key": "ctrl+d",
            "command": "editor.action.copyLinesDownAction",
            "when": "editorTextFocus"
    }
  • AdGuard Home代理配置

    杭州移动代理

    [/cn/]211.140.13.188
    [/qoder.com/]211.140.13.188
    [/qianwen.com/]211.140.13.188
    [/deepseek.com/]211.140.13.188
    [/ipchaxun.net/]211.140.13.188
    [/bilibili.com/]211.140.13.188
    [/hdslb.com/]211.140.13.188
    [/baidu.com/]211.140.13.188
    [/xiaohongshu.com/]211.140.13.188
    [/xhscdn.com/]211.140.13.188
    [/qq.com/]211.140.13.188
    [/tencent.com/]211.140.13.188
    [/aliyun.com/]211.140.13.188
    [/wireguard.com/]1.1.1.1
    [/download.wireguard.com/]1.1.1.1
    [/ip-api.com/]1.1.1.1
    [/cache.ip-api.com/]1.1.1.1
    [/demo.ip-api.com/]1.1.1.1
    [/lmfxu7wlb9hr16v0o9khm1e2oofpoha5.edns.ip-api.com/]1.1.1.1
    [/browserleaks.com/]1.1.1.1
    [/rdap.arin.net/]1.1.1.1
    [/rdap.db.ripe.net/]1.1.1.1
    [/tls.browserleaks.com/]1.1.1.1
    [/fast.com/]1.1.1.1
    [/ipv4-c145-tyo001-ix.1.oca.nflxvideo.net/]1.1.1.1
    [/ipv4-c202-tyo001-ix.1.oca.nflxvideo.net/]1.1.1.1
    [/fast.com/]1.1.1.1
    [/ipv4-c028-tyo010-ix.1.oca.nflxvideo.net/]1.1.1.1
    [/ipv4-c031-tyo013-ix.1.oca.nflxvideo.net/]1.1.1.1
    [/ichnaea-web.netflix.com/]1.1.1.1
    [/api.fast.com/]1.1.1.1
    [/speedtest.sg/]1.1.1.1
    [/hk/]1.1.1.1
    [/gravatar.com/]1.1.1.1
    [/tw/]1.1.1.1
    [/ava.hosting/]1.1.1.1
    [/githubusercontent.com/]1.1.1.1
    [/mail.google.com/]1.1.1.1
    [/fonts.googleapis.com/]1.1.1.1
    [/waa-pa.googleapis.com/]1.1.1.1
    [/github.githubassets.com/]1.1.1.1
    [/avatars.githubusercontent.com/]1.1.1.1
    [/collector.github.com/]1.1.1.1
    [/api.github.com/]1.1.1.1
    [/api.individual.githubcopilot.com/]1.1.1.1
    [/git-scm.com/]1.1.1.1
    [/tiktokv.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/google.com/]1.1.1.1
    [/www.google.com/]1.1.1.1
    [/netflix.com/]1.1.1.1
    [/reddit.com/]1.1.1.1
    [/yahoo.com/]1.1.1.1
    [/openvpn.net/]1.1.1.1
    [/youtube.com/]1.1.1.1
    [/doubleclick.net/]1.1.1.1
    [/ggpht.com/]1.1.1.1
    [/google.com.sg/]1.1.1.1
    [/mail.google.com/]1.1.1.1
    [/ci3.googleusercontent.com/]1.1.1.1
    [/www.gstatic.com/]1.1.1.1
    [/play.google.com/]1.1.1.1
    [/ssl.gstatic.com/]1.1.1.1
    [/ogs.google.com/]1.1.1.1
    [/fonts.gstatic.com/]1.1.1.1
    [/gemini.gstatic.com/]1.1.1.1
    [/gemini.google.com/]1.1.1.1
    [/www.googletagmanager.com/]1.1.1.1
    [/myaccount.google.com/]1.1.1.1
    [/fonts.gstatic.com/]1.1.1.1
    [/peoplestack-pa.clients6.google.com/]1.1.1.1
    [/lh3.googleusercontent.com/]1.1.1.1
    [/drive.google.com/]1.1.1.1
    [/appsgrowthpromo-pa.clients6.google.com/]1.1.1.1
    [/signaler-pa.clients6.google.com/]1.1.1.1
    [/accounts.google.com/]1.1.1.1
    [/apis.google.com/]1.1.1.1
    [/clients6.google.com/]1.1.1.1
    [/waa-pa.clients6.google.com/]1.1.1.1
    [/www.google.com/]1.1.1.1
    [/addons-pa.clients6.google.com/]1.1.1.1
    [/contacts.google.com/]1.1.1.1
    [/lh3.google.com/]1.1.1.1
    [/mail-ads.google.com/]1.1.1.1
    [/ogads-pa.clients6.google.com/]1.1.1.1
    [/peoplestackwebexperiments-pa.clients6.google.com/]1.1.1.1
    [/taskassist-pa.clients6.google.com/]1.1.1.1
    [/facebook.com/]1.1.1.1
    [/github.com/]1.1.1.1
    [/openai.com/]1.1.1.1
    [/ws.chatgpt.com/]1.1.1.1
    [/bzr.openai.com/]1.1.1.1
    [/cdn.openai.com/]1.1.1.1
    [/t1.gstatic.com/]1.1.1.1
    [/t3.gstatic.com/]1.1.1.1
    [/googlevideo.com/]1.1.1.1
    [/ytimg.com/]1.1.1.1
    [/notepad-plus-plus.org/]1.1.1.1
    [/googleapis.com/]1.1.1.1
    [/googlesyndication.com/]1.1.1.1
    [/gstatic.com/]1.1.1.1
    [/www.chatgpt.com/]1.1.1.1
    [/chatgpt.com/]1.1.1.1
    [/claude.ai/]1.1.1.1
    [/cursor.com/]1.1.1.1
    [/cloudflare.com/]1.1.1.1
    [/outlook.com/]1.1.1.1
    [/office.com/]1.1.1.1
    [/microsoft.com/]1.1.1.1
    [/paypal.com/]1.1.1.1
    [/ebay.com/]1.1.1.1
    [/huggingface.co/]1.1.1.1
    [/hf.co/]1.1.1.1
    [/x.com/]1.1.1.1
    [/twimg.com/]1.1.1.1
    [/google.dev/]1.1.1.1
    [/gemini.google/]1.1.1.1
    [/google-analytics.com/]1.1.1.1
    [/googleusercontent.com/]1.1.1.1
    [/stripe.network/]1.1.1.1
    [/stripe.com/]1.1.1.1
    [/awswaf.com/]1.1.1.1
    [/googletagmanager.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn-us.com/]1.1.1.1
    [/tiktokv.us/]1.1.1.1
    [/ttwstatic.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/tiktokw.us/]1.1.1.1
    [/electronjs.org/]1.1.1.1
    [/nodejs.org/]1.1.1.1
    [/docker.com/]1.1.1.1
    [/dedione.com/]1.1.1.1
    [/crisp.chat/]1.1.1.1
    [/googleadservices.com/]1.1.1.1
    [/idc.1anch.com/]211.140.13.188
    [/at.alicdn.com/]211.140.13.188
    211.140.13.188
    211.140.188.188
    114.114.114.114

    杭州电信代理

    [/cn/]202.101.172.35
    [/qianwen.com/]202.101.172.35
    [/deepseek.com/]202.101.172.35
    [/ipchaxun.net/]202.101.172.35
    [/bilibili.com/]202.101.172.35
    [/hdslb.com/]202.101.172.35
    [/baidu.com/]202.101.172.35
    [/xiaohongshu.com/]202.101.172.35
    [/xhscdn.com/]202.101.172.35
    [/qq.com/]202.101.172.35
    [/tencent.com/]202.101.172.35
    [/aliyun.com/]202.101.172.35
    [/opencode.ai/]202.101.172.35
    [/auth.opencode.ai/]202.101.172.35
    [/fast.com/]1.1.1.1
    [/redditmail.com/]1.1.1.1
    [/speedtest.sg/]1.1.1.1
    [/hk/]1.1.1.1
    [/accounts.google.com/]1.1.1.1
    [/tw/]1.1.1.1
    [/ava.hosting/]1.1.1.1
    [/githubusercontent.com/]1.1.1.1
    [/git-scm.com/]1.1.1.1
    [/tiktokv.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/google.com/]1.1.1.1
    [/netflix.com/]1.1.1.1
    [/reddit.com/]1.1.1.1
    [/yahoo.com/]1.1.1.1
    [/openvpn.net/]1.1.1.1
    [/youtube.com/]1.1.1.1
    [/www.youtube.com/]1.1.1.1
    [/i.ytimg.com/]1.1.1.1
    [/yt3.ggpht.com/]1.1.1.1
    [/www.gstatic.com/]1.1.1.1
    [/fonts.googleapis.com/]1.1.1.1
    [/accounts.youtube.com/]1.1.1.1
    [/wireguard.com/]1.1.1.1
    [/download.wireguard.com/]1.1.1.1
    [/www.google.com/]1.1.1.1
    [/t0.gstatic.com/]1.1.1.1
    [/t3.gstatic.com/]1.1.1.1
    [/t1.gstatic.com/]1.1.1.1
    [/t2.gstatic.com/]1.1.1.1
    [/rr3---sn-qja5m5-5v.googlevideo.com/]1.1.1.1
    [/rr1---sn-a5mlrnek.googlevideo.com/]1.1.1.1
    [/rr3---sn-a5meknzs.googlevideo.com/]1.1.1.1
    [/rr4---sn-a5mekn6r.googlevideo.com/]1.1.1.1
    [/rr4---sn-a5mlrnlz.googlevideo.com/]1.1.1.1
    [/rr1---sn-a5mekn6k.googlevideo.com/]1.1.1.1
    [/rr2---sn-a5meknds.googlevideo.com/]1.1.1.1
    [/rr3---sn-a5m7lnlr.googlevideo.com/]1.1.1.1
    [/ad.doubleclick.net/]1.1.1.1
    [/googleads.g.doubleclick.net/]1.1.1.1
    [/static.doubleclick.net/]1.1.1.1
    [/tpc.googlesyndication.com/]1.1.1.1
    [/doubleclick.net/]1.1.1.1
    [/ggpht.com/]1.1.1.1
    [/google.com.sg/]1.1.1.1
    [/facebook.com/]1.1.1.1
    [/github.com/]1.1.1.1
    [/github.githubassets.com/]1.1.1.1
    [/avatars.githubusercontent.com/]1.1.1.1
    [/collector.github.com/]1.1.1.1
    [/api.github.com/]1.1.1.1
    [/api.individual.githubcopilot.com/]1.1.1.1
    [/openai.com/]1.1.1.1
    [/googlevideo.com/]1.1.1.1
    [/ytimg.com/]1.1.1.1
    [/notepad-plus-plus.org/]1.1.1.1
    [/googleapis.com/]1.1.1.1
    [/googlesyndication.com/]1.1.1.1
    [/gstatic.com/]1.1.1.1
    [/www.chatgpt.com/]1.1.1.1
    [/chatgpt.com/]1.1.1.1
    [/ws.chatgpt.com/]1.1.1.1
    [/bzr.openai.com/]1.1.1.1
    [/lh3.googleusercontent.com/]1.1.1.1
    [/claude.ai/]1.1.1.1
    [/cloudflare.com/]1.1.1.1
    [/outlook.com/]1.1.1.1
    [/office.com/]1.1.1.1
    [/microsoft.com/]1.1.1.1
    [/paypal.com/]1.1.1.1
    [/ebay.com/]1.1.1.1
    [/huggingface.co/]1.1.1.1
    [/hf.co/]1.1.1.1
    [/x.com/]1.1.1.1
    [/twimg.com/]1.1.1.1
    [/google.dev/]1.1.1.1
    [/gemini.google/]1.1.1.1
    [/google-analytics.com/]1.1.1.1
    [/googleusercontent.com/]1.1.1.1
    [/stripe.network/]1.1.1.1
    [/stripe.com/]1.1.1.1
    [/awswaf.com/]1.1.1.1
    [/googletagmanager.com/]1.1.1.1
    [/tiktokcdn-us.com/]1.1.1.1
    [/tiktokv.us/]1.1.1.1
    [/ttwstatic.com/]1.1.1.1
    [/tiktokw.us/]1.1.1.1
    [/colocrossing.com/]1.1.1.1
    [/electronjs.org/]1.1.1.1
    [/nodejs.org/]1.1.1.1
    [/docker.com/]1.1.1.1
    [/dedione.com/]1.1.1.1
    [/crisp.chat/]1.1.1.1
    [/googleadservices.com/]1.1.1.1
    [/cache.ip-api.com/]1.1.1.1
    [/demo.ip-api.com/]1.1.1.1
    [/ip-api.com/]1.1.1.1
    202.101.172.35
    202.101.172.47
    223.5.5.5
    114.114.114.114

    选择最快的IP地址

    刷新dns缓存

    ipconfig /flushdns

    如何修改重置AdGuard Home 密码

    下载apache

    https://www.apachelounge.com/download/
    重置网页密码
    
    请按照以下步骤为您的用户账户创建新密码:
    
    1. 安装 htpasswd,它是 Apache2 网页服务器的一部分:
    
        Ubuntu系统:
        sudo apt-get install apache2
    
        Fedora系统:
        sudo dnf install httpd-tools
    
        Windows系统:
        从 https://httpd.apache.org/docs/current/platform/windows.html#down 选择一个下载源,解压下载的文件夹,打开终端,使用 chdir 命令进入其 bin 目录,然后运行 .\Htpasswd。请注意 Windows 版本中的 H 是大写的。
    
        其他版本的 htpasswd 也可以使用,但前提是必须支持 bcrypt 哈希加密,这意味着大多数在线的 htpasswd 生成器都不能使用。
    
    2. 使用 htpasswd 工具生成新的哈希值:
    
        Ubuntu/Fedora系统:
        hpasswd -B -C 10 -n -b <用户名> <密码>
    
        Windows系统:
        .\Htpasswd -B -C 10 -n -b <用户名> <密码>
    
        终端会输出 <用户名>:<哈希值>。
    
    3. 使用管理员权限打开 AdGuardHome.yaml 文件。
    
    4. 在 users:(用户)部分,找到您的用户名,并将 password(密码)设置为刚才生成的 <哈希值>:
    
        users:
          - name: ...
            password: <哈希值>
    
    5. 保存文件并重启 AdGuard Home。现在您应该可以使用新密码登录网页界面了。
  • Ubuntu 24快速搭建wireguard

    curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
    chmod +x wireguard-install.sh
    sudo ./wireguard-install.sh
    
    一键搭建脚本  一路ok  即可

    下载 wireguard 软件

    https://www.wireguard.com/install/
    建议选择msi
    https://download.wireguard.com/windows-client/
    找到
    wireguard-installer.exe 下载
    
    配置  客户端
    
    /home/ubuntu/wg0-client-xiao2.conf
    
    创建新用户  选择1
    
    sudo ./wireguard-install.sh 
    Welcome to WireGuard-install!
    The git repository is available at: https://github.com/angristan/wireguard-install
    
    It looks like WireGuard is already installed.
    
    What do you want to do?
       1) Add a new user
       2) List all users
       3) Revoke existing user
       4) Uninstall WireGuard
       5) Exit
    Select an option [1-5]: 
    
    填入名字
    
    
    
    配置 国内  AllowedIPs
    
    AllowedIPs = 0.0.0.0/8, 1.1.1.1/32, 2.0.0.0/8, 4.0.0.0/8, 5.0.0.0/8, 6.0.0.0/8, 8.8.8.8/32, 9.0.0.0/8, 12.0.0.0/8, 13.0.0.0/8, 15.0.0.0/8, 16.0.0.0/8, 17.0.0.0/8, 18.0.0.0/8, 20.0.0.0/8, 23.0.0.0/8, 24.0.0.0/8, 26.0.0.0/8, 28.0.0.0/8, 31.13.0.0/16, 32.0.0.0/8, 35.0.0.0/8, 37.0.0.0/8, 38.0.0.0/8, 40.0.0.0/8, 41.0.0.0/8, 44.0.0.0/8, 46.0.0.0/8, 48.0.0.0/8, 50.0.0.0/8, 52.0.0.0/8, 53.0.0.0/8, 54.0.0.0/8, 55.0.0.0/8, 56.0.0.0/8, 57.0.0.0/8, 62.0.0.0/8, 63.0.0.0/8, 64.0.0.0/8, 65.0.0.0/8, 67.0.0.0/8, 68.0.0.0/8, 69.0.0.0/8, 70.0.0.0/19, 70.64.0.0/10, 70.128.0.0/9, 71.0.0.0/8, 72.0.0.0/8, 73.0.0.0/8, 74.0.0.0/9, 74.128.0.0/10, 74.192.0.0/12, 74.208.0.0/13, 74.216.0.0/14, 74.220.0.0/15, 74.223.0.0/16, 74.224.0.0/11, 76.0.0.0/8, 80.0.0.0/8, 82.0.0.0/8, 83.0.0.0/8, 84.0.0.0/8, 86.0.0.0/8, 87.0.0.0/8, 88.0.0.0/8, 92.0.0.0/8, 93.0.0.0/8, 94.0.0.0/8, 95.0.0.0/8, 96.0.0.0/8, 100.0.0.0/8, 102.0.0.0/8, 104.0.0.0/9, 104.128.0.0/16, 104.130.0.0/15, 104.132.0.0/14, 104.136.0.0/13, 104.144.0.0/12, 104.160.0.0/11, 104.192.0.0/10, 105.0.0.0/8, 107.0.0.0/8, 108.0.0.0/8, 109.0.0.0/8, 128.0.0.0/8, 129.0.0.0/8, 130.0.0.0/8, 131.0.0.0/8, 132.0.0.0/8, 133.0.0.0/8, 134.0.0.0/8, 135.0.0.0/8, 136.0.0.0/8, 137.0.0.0/8, 138.0.0.0/8, 139.0.0.0/10, 139.64.0.0/12, 139.80.0.0/13, 139.88.0.0/14, 139.92.0.0/15, 139.96.0.0/11, 139.128.0.0/10, 139.192.0.0/10, 140.82.0.0/16, 141.0.0.0/8, 142.0.0.0/8, 143.0.0.0/8, 144.0.0.0/8, 145.0.0.0/8, 146.0.0.0/8, 147.0.0.0/8, 148.0.0.0/8, 149.0.0.0/8, 150.0.0.0/8, 151.0.0.0/8, 152.0.0.0/8, 154.0.0.0/8, 155.0.0.0/8, 156.0.0.0/8, 157.0.0.0/8, 158.0.0.0/8, 159.0.0.0/8, 160.0.0.0/8, 161.0.0.0/8, 162.0.0.0/8, 163.0.0.0/8, 164.0.0.0/8, 165.0.0.0/8, 166.0.0.0/8, 167.0.0.0/8, 168.0.0.0/8, 169.0.0.0/8, 170.0.0.0/8, 171.0.0.0/8, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/10, 172.192.0.0/11, 172.224.0.0/11, 173.0.0.0/8, 174.0.0.0/8, 175.0.0.0/8, 176.0.0.0/8, 179.0.0.0/8, 181.0.0.0/8, 184.0.0.0/8, 185.60.0.0/16, 185.199.0.0/16, 188.0.0.0/8, 189.0.0.0/8, 190.0.0.0/8, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/8, 195.0.0.0/8, 196.0.0.0/8, 198.0.0.0/11, 198.32.0.0/13, 198.40.0.0/14, 198.45.0.0/16, 198.46.0.0/15, 198.48.0.0/12, 198.64.0.0/10, 198.128.0.0/9, 199.0.0.0/8, 200.0.0.0/8, 204.0.0.0/8, 205.0.0.0/8, 206.0.0.0/8, 208.0.0.0/8, 212.0.0.0/8, 213.0.0.0/8, 214.0.0.0/8, 216.0.0.0/8, 224.0.0.0/8
    
    
    
    
    
    
    
    
    注意 Endpoint = 111.222.111.222:62986
    写入公网ip 否则无法上网
    
    
    代理走国内配置dns
    
    下载  AdGuardHome_windows_amd64.zip
    github地址
    https://github.com/AdguardTeam/AdGuardHome/releases
    
    解压后双击打开  AdGuardHome.exe
    
    本地地址
    http://127.0.0.1:3000   后面设置完 可能改为 http://127.0.0.1:80  了
    
    
    
    设置监听地址  选择本地lookback  地址  
    DNS server:
    127.0.0.1:53
    
    
    设置  -->   dns设置
    
    上游dns设置
    国外使用8.8.8.8  其他默认使用国内的  
    【移动配置】
    
    [/cn/]211.140.13.188
    [/qianwen.com/]211.140.13.188
    [/deepseek.com/]211.140.13.188
    [/ipchaxun.net/]211.140.13.188
    [/bilibili.com/]211.140.13.188
    [/hdslb.com/]211.140.13.188
    [/baidu.com/]211.140.13.188
    [/xiaohongshu.com/]211.140.13.188
    [/xhscdn.com/]211.140.13.188
    [/qq.com/]211.140.13.188
    [/tencent.com/]211.140.13.188
    [/aliyun.com/]211.140.13.188
    [/hk/]1.1.1.1
    [/tw/]1.1.1.1
    [/ava.hosting/]1.1.1.1
    [/githubusercontent.com/]1.1.1.1
    [/git-scm.com/]1.1.1.1
    [/tiktokv.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/google.com/]1.1.1.1
    [/netflix.com/]1.1.1.1
    [/reddit.com/]1.1.1.1
    [/yahoo.com/]1.1.1.1
    [/openvpn.net/]1.1.1.1
    [/youtube.com/]1.1.1.1
    [/doubleclick.net/]1.1.1.1
    [/ggpht.com/]1.1.1.1
    [/google.com.sg/]1.1.1.1
    [/facebook.com/]1.1.1.1
    [/github.com/]1.1.1.1
    [/openai.com/]1.1.1.1
    [/googlevideo.com/]1.1.1.1
    [/ytimg.com/]1.1.1.1
    [/notepad-plus-plus.org/]1.1.1.1
    [/googleapis.com/]1.1.1.1
    [/googlesyndication.com/]1.1.1.1
    [/gstatic.com/]1.1.1.1
    [/www.chatgpt.com/]1.1.1.1
    [/chatgpt.com/]1.1.1.1
    [/claude.ai/]1.1.1.1
    [/cursor.com/]1.1.1.1
    [/cloudflare.com/]1.1.1.1
    [/outlook.com/]1.1.1.1
    [/office.com/]1.1.1.1
    [/microsoft.com/]1.1.1.1
    [/paypal.com/]1.1.1.1
    [/ebay.com/]1.1.1.1
    [/huggingface.co/]1.1.1.1
    [/hf.co/]1.1.1.1
    [/x.com/]1.1.1.1
    [/twimg.com/]1.1.1.1
    [/google.dev/]1.1.1.1
    [/gemini.google/]1.1.1.1
    [/google-analytics.com/]1.1.1.1
    [/googleusercontent.com/]1.1.1.1
    [/stripe.network/]1.1.1.1
    [/stripe.com/]1.1.1.1
    [/awswaf.com/]1.1.1.1
    [/googletagmanager.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn-us.com/]1.1.1.1
    [/tiktokv.us/]1.1.1.1
    [/ttwstatic.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/tiktokw.us/]1.1.1.1
    [/electronjs.org/]1.1.1.1
    [/nodejs.org/]1.1.1.1
    [/docker.com/]1.1.1.1
    [/dedione.com/]1.1.1.1
    [/crisp.chat/]1.1.1.1
    [/googleadservices.com/]1.1.1.1
    211.140.13.188
    211.140.188.188
    223.5.5.5
    114.114.114.114
    
    选择最快的ip地址
    应用
    
    DNS 缓存配置
    启用
    覆盖最小 TTL 值
    600
    覆盖最大 TTL 值
    86400
    保存
    
    
    
    然后配置  wireguard  
    DNS = 127.0.0.1
    
    
    测试是否成功  这样就对了
    
    nslookup google.com
    服务器:  activate.navicat.com
    Address:  127.0.0.1
    
    非权威应答:
    名称:    google.com
    Addresses:  2404:6800:4012:8::200e
              142.251.218.174
    
    
    
    设置AdGuardHome  自启动  为服务程序
    在安装目录右键  打开终端 powershell
    .\AdGuardHome.exe -s install   安装服务  设置为自动
    .\AdGuardHome.exe -s start   启动服务
    
    【电信配置】
    [/cn/]202.101.172.35
    [/qianwen.com/]202.101.172.35
    [/deepseek.com/]202.101.172.35
    [/ipchaxun.net/]202.101.172.35
    [/bilibili.com/]202.101.172.35
    [/hdslb.com/]202.101.172.35
    [/baidu.com/]202.101.172.35
    [/xiaohongshu.com/]202.101.172.35
    [/xhscdn.com/]202.101.172.35
    [/qq.com/]202.101.172.35
    [/tencent.com/]202.101.172.35
    [/aliyun.com/]202.101.172.35
    [/hk/]1.1.1.1
    [/tw/]1.1.1.1
    [/ava.hosting/]1.1.1.1
    [/githubusercontent.com/]1.1.1.1
    [/git-scm.com/]1.1.1.1
    [/tiktokv.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/google.com/]1.1.1.1
    [/netflix.com/]1.1.1.1
    [/reddit.com/]1.1.1.1
    [/yahoo.com/]1.1.1.1
    [/openvpn.net/]1.1.1.1
    [/youtube.com/]1.1.1.1
    [/doubleclick.net/]1.1.1.1
    [/ggpht.com/]1.1.1.1
    [/google.com.sg/]1.1.1.1
    [/facebook.com/]1.1.1.1
    [/github.com/]1.1.1.1
    [/openai.com/]1.1.1.1
    [/googlevideo.com/]1.1.1.1
    [/ytimg.com/]1.1.1.1
    [/notepad-plus-plus.org/]1.1.1.1
    [/googleapis.com/]1.1.1.1
    [/googlesyndication.com/]1.1.1.1
    [/gstatic.com/]1.1.1.1
    [/www.chatgpt.com/]1.1.1.1
    [/chatgpt.com/]1.1.1.1
    [/claude.ai/]1.1.1.1
    [/cursor.com/]1.1.1.1
    [/cloudflare.com/]1.1.1.1
    [/outlook.com/]1.1.1.1
    [/office.com/]1.1.1.1
    [/microsoft.com/]1.1.1.1
    [/paypal.com/]1.1.1.1
    [/ebay.com/]1.1.1.1
    [/huggingface.co/]1.1.1.1
    [/hf.co/]1.1.1.1
    [/x.com/]1.1.1.1
    [/twimg.com/]1.1.1.1
    [/google.dev/]1.1.1.1
    [/gemini.google/]1.1.1.1
    [/google-analytics.com/]1.1.1.1
    [/googleusercontent.com/]1.1.1.1
    [/stripe.network/]1.1.1.1
    [/stripe.com/]1.1.1.1
    [/awswaf.com/]1.1.1.1
    [/googletagmanager.com/]1.1.1.1
    [/tiktok.com/]1.1.1.1
    [/tiktokcdn-us.com/]1.1.1.1
    [/tiktokv.us/]1.1.1.1
    [/ttwstatic.com/]1.1.1.1
    [/tiktokcdn.com/]1.1.1.1
    [/tiktokw.us/]1.1.1.1
    [/electronjs.org/]1.1.1.1
    [/nodejs.org/]1.1.1.1
    [/docker.com/]1.1.1.1
    [/dedione.com/]1.1.1.1
    [/crisp.chat/]1.1.1.1
    [/googleadservices.com/]1.1.1.1
    202.101.172.35
    202.101.172.47
    223.5.5.5
    114.114.114.114

  • Windows安装Redis

    安装Redis-x64-5.0.14.1.msi

    配置文件设置

    找到 安装目录下的 redis.windows-service.conf

    #修改最大内存

    maxmemory 4gb

    #设置出错时允许写入 避免一些报错

    stop-writes-on-bgsave-error no

    #设置端口号

    port 6379

    #设置允许内网和本地访问redis(以空格隔开可以多个)

    bind 192.168.1.150 127.0.0.1

    #设置redis密码

    requirepass your_strong_password

  • Windows定时任务报错原因

    终端程序 对于有空格的需要加上引号 否则报错
    “C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.22.11141.0_x64__8wekyb3d8bbwe\wt.exe”

    运行参数
    -w 0 nt -p “PowerShell” “C:\Users\Administrator\Desktop\fsdownload\venv\Scripts\python.exe” “C:\Users\Administrator\PycharmProjects\pythonProject2\新脚本\ttt.py”

  • git常用命令

    git常用命令

    # 查看提交历史,找到要回退的commit hash

    git log –oneline

    恢复到以前的某个版本

    git reset –hard 93424a2

    # 强制推送,会覆盖远程的提交历史(之前的一些提交)

    git push –force origin master

    强制拉取远程 覆盖本地

    git pull –force origin master

    丢弃所有未提交的修改,回到最近一次提交的状态

    git reset –hard HEAD

    查看分支

    git branch

    切换分支

    git checkout feature-xc

    验证结果

    git branch

    # 查看当前状态

    git status

    ————文件冲突 checkout 文件名 进行覆盖 ——–

    # 方法 A:直接 checkout 覆盖(保留文件但内容变回远程版本)

    git checkout HEAD — .env

    git pull origin master

    —————– 如何忽略文件———–

    git rm –cached .env

    . 确保 .gitignore 已包含 .env

    提交本次修改

    git add .gitignore

    git commit -m “停止监控并忽略 .env文件”

    git push origin master