屏蔽百度搜索百家号文章

百家号都是一些垃圾文章,搜索结果每页都能占用一半,屏蔽了眼不见心不烦。

现在也不用百度,用Google或者Bing

// ==UserScript==
// @name 屏蔽百度搜索百家号文章
// @namespace https://github.com/tengxunlaozu/baijiahao
// @version 1.0
// @description 屏蔽百度搜索结果中的百家号文章
// @author tengxunlaozu
// @match ://.baidu.com/*
// ==/UserScript==

(function() {
‘use strict’;

// 创建样式隐藏百家号元素
const style = document.createElement('style');
style.textContent = `
    div[data-tuiguang*='baijiahao'],
    div[id*='baijiahao'],
    div[class*='baijiahao'],
    a[href*='baijiahao.baidu.com'] {
        display: none !important;
    }
`;
document.head.appendChild(style);

// MutationObserver 监控页面动态加载内容
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        if (mutation.addedNodes.length) {
            // 查找并隐藏百家号相关元素
            document.querySelectorAll('div[data-tuiguang*="baijiahao"], div[id*="baijiahao"], div[class*="baijiahao"], a[href*="baijiahao.baidu.com"]').forEach(element => {
                element.style.display = 'none';
            });
        }
    });
});

// 观察页面变化
observer.observe(document.body, {
    childList: true,
    subtree: true
});

// 初始隐藏页面中的百家号内容
document.querySelectorAll('div[data-tuiguang*="baijiahao"], div[id*="baijiahao"], div[class*="baijiahao"], a[href*="baijiahao.baidu.com"]').forEach(element => {
    element.style.display = 'none';
});

})();

或者直接链接:https://github.com/tengxunlaozu/baijiahao

Sublime Text4配置c#补全并运行

c#开发的小项目准备扔给我,提前把基础语法过一遍

1,安装sdk:https://dotnet.microsoft.com/zh-cn/download

2,在sublime安装Omnisharp

3,安装msbuild(否则omnisharp报错:Error talking to http://localhost:60375/checkreadystatus)

4,在sublime安装LSP-Omnisharp(前提已安装LSP)

5,新建编译系统c#:

{
“cmd”: [“dotnet”, “run”, “–project”, “$file_path”],
“working_dir”: “$file_path”,
“selector”: “source.cs”,
“shell”: true,
“encoding”: “utf-8”,
“variants”: [
{
“name”: “Run”,
“cmd”: [“dotnet”, “run”, “–project”, “$file_path”]
}
]
}

6,在lsp-setting配置:

// Settings in here override those in “LSP/LSP.sublime-settings”
{
“clients”: {
“pylsp”: {
“enabled”: true,
“command”: [“pylsp”],
“selector”: “source.python”,
“settings”: {
“pylsp.plugins.jedi_completion.enabled”: true,
“pylsp.plugins.jedi_completion.include_params”: true,
“pylsp.plugins.pylsp_mypy.enabled”: true,
“pylsp.plugins.flake8.enabled”: true,
“pylsp.plugins.pylsp_black.enabled”: false,
“pylsp.plugins.pylsp_isort.enabled”: false
}
},
“omnisharp”: {
“enabled”: true,
“command”: [“dotnet”, “C:/Users/Administrator/AppData/Local/Sublime Text/Package Storage/LSP-OmniSharp/OmniSharp.dll”],
“args”: [“–hostPID”, “${pid}”, “–hostIpc”, “pipes”, “–threads”, “1”],
“selector”: “source.cs”,
“settings”: {
“DotNetPath”: {
“Path”: “C:\Program Files\dotnet\dotnet.exe”
},
“RoslynExtensionsOptions”: {
“EnableEditorConfigSupport”: true,
“LocationPaths”: []
},
“FormattingOptions”: {
“EnableEditorConfigForFormatting”: true
},
“OmniSharp”: {
“UseGlobalMono”: “never”,
“RoslynServerPort”: “60777”,
“SdkVersion”: “8.0.414” // 替换为您的 dotnet –version 输出
}
}
}
}
}

用Python语言把excel内base64文本内容转成图片直接在excel中显示

import base64
import io
import openpyxl
from openpyxl.drawing.image import Image
from openpyxl.utils import units

def process_excel_file(input_file, output_file, base64_col, image_col):
    # 加载输入工作簿
    wb = openpyxl.load_workbook(input_file)
    ws = wb.active  # 假设处理的是活动工作表

    # 单元格尺寸转换因子
    # Excel 列宽单位转换为像素(近似,取决于 DPI 和字体设置)
    # 1 单位宽度 ≈ 7 像素(基于默认字体)
    # 行高以点为单位,1 点 ≈ 1.333 像素(假设 96 DPI)
    pixels_per_width_unit = 7
    pixels_per_point = 1.333

    # 遍历第 2 到第 6 行(对应 V2 到 V6 单元格)
    for row in range(2, 7):
        # 获取指定列(例如 'V')中的 base64 字符串
        base64_cell = ws[f"{base64_col}{row}"]
        base64_string = base64_cell.value

        # 检查单元格是否包含有效的 base64 字符串
        if base64_string and isinstance(base64_string, str) and base64_string.startswith("data:image/png;base64,"):
            try:
                # 提取 base64 数据(去除前缀)
                base64_data = base64_string.split(",")[1]
                # 将 base64 字符串解码为字节
                img_data = base64.b64decode(base64_data)
                # 创建 BytesIO 对象以存储图像数据
                img_io = io.BytesIO(img_data)
                # 为 openpyxl 创建 Image 对象
                img = Image(img_io)

                # 获取目标单元格(例如 AC2)的尺寸
                target_cell = f"{image_col}{row}"
                col_idx = openpyxl.utils.column_index_from_string(image_col) - 1
                # 获取列宽(Excel 单位,默认 8.43 如果未设置)
                col_width = ws.column_dimensions[image_col].width or 8.43
                # 获取行高(点,默认 12.75 如果未设置)
                row_height = ws.row_dimensions[row].height or 12.75

                # 将单元格尺寸转换为像素
                img_width_pixels = col_width * pixels_per_width_unit
                img_height_pixels = row_height * pixels_per_point

                # 设置图片尺寸以匹配单元格大小
                img.width = img_width_pixels
                img.height = img_height_pixels

                # 将图片锚定到目标单元格(例如 AC2)
                img.anchor = target_cell

                # 将图片添加到工作表
                ws.add_image(img, target_cell)
            except Exception as e:
                print(f"处理第 {row} 行图像时出错:{e}")
        else:
            print(f"{base64_col}{row} 中没有有效的 base64 图像数据")

    # 保存输出工作簿
    wb.save(output_file)
    print(f"Excel 文件成功保存到 {output_file}")

# 示例用法
input_excel = "input.xlsx"
output_excel = "output.xlsx"
base64_col = "V" # V是base64所在列
image_col = "AC" # AC为生成图片所在列
process_excel_file(input_excel, output_excel, base64_col, image_col)

docker部署3x-ui且配置ssl

如果你的服务器使用 Nginx 或其他 Web 服务器,安装对应的 Certbot 插件(例如 python3-certbot-apache)。
sudo apt install certbot python3-certbot-nginx

运行以下命令为你的域名生成证书
sudo certbot –nginx -d yourdomain.com

替换 yourdomain.com 为你的实际域名。
–standalone 模式适用于没有运行 Web 服务器的情况(确保 80 端口未被占用)。
证书默认存储在 /etc/letsencrypt/live/yourdomain.com/,包含 fullchain.pem(证书)和 privkey.pem(私钥)。

确保证书生成成功:
ls /etc/letsencrypt/live/yourdomain.com/

创建目录3x-ui,新建docker-compose.yml写入以下内容

services:
3x-ui:
image: ghcr.io/mhsanaei/3x-ui:latest
container_name: 3x-ui
hostname: 213879.xyz
volumes:
- ./db/:/etc/x-ui/
- /etc/letsencrypt/:/etc/letsencrypt/:rw
- /etc/letsencrypt/live/213879.xyz/fullchain.pem:/etc/letsencrypt/live/213879.xyz/fullchain.pem:ro
- /etc/letsencrypt/live/213879.xyz/privkey.pem:/etc/letsencrypt/live/213879.xyz/privkey.pem:ro
environment:
XRAY_VMESS_AEAD_FORCED: "true"
XRAY_USE_TLS: "ture"
XRAY_WORKER_THREADS: "4"
X_UI_ENABLE_FAIL2BAN: "true"
tty: true
ports:
- "25505:3300"
- "65321:2053"
- "35505:35505"
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.8'
memory: '512M'
reservations:
cpus: '0.20'
memory: '128M'
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "3"

在面板后填入证书路径
Let’s Encrypt 证书有效期为 90 天,需配置自动续期。
测试续期
sudo certbot renew --dry-run

设置自动续期
Certbot 默认会添加一个 cron 任务或 systemd 定时器来自动续期。你可以检查
sudo systemctl status certbot.timer
如果未启用,可手动添加 cron 任务:
echo "0 0,12 * * * root certbot renew --quiet" | sudo tee -a /etc/crontab

更新容器证书
证书续期后,需重启 3X-UI 容器以加载新证书:
docker compose restart

Ubuntu安装docker和docker-compose

一、安装docker

  1. 更新系统包
    sudo apt update && sudo apt upgrade -y
  2. 安装Docker依赖
    sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
  3. 添加Docker官方GPG密钥
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. 添加Docker仓库
    echo “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. 安装Docker引擎
    sudo apt update
    sudo apt install -y docker-ce docker-ce-cli containerd.io
    6.启动 Docker 并设置开机自启:
    sudo systemctl start docker
    sudo systemctl enable docker
    二、安装 Docker Compose
    1.下载最新的 Docker Compose 二进制文件
    sudo curl -L “https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose
    2.为 Docker Compose 二进制文件添加执行权限
    sudo chmod +x /usr/local/bin/docker-compose
    3.创建一个符号链接(可选)
    sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
    4.如果你希望非 root 用户也能运行 Docker,可以将该用户添加到 docker 组:
    sudo usermod -aG docker $(whoami)
    5.之后你需要注销并重新登录,或者执行以下命令以应用组更改
    newgrp docker