咕噜猫小站

do it, do it right, do it right now

0%

Windows 右键菜单添加以管理员打开 cmd

open_cmd_as_admin.reg 文件内容:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Windows Registry Editor Version 5.00

; 以管理员身份打开 CMD
; 注册表项的路径必须为 runas ,否则无效。文件编码为 ansi ,使用 utf-8 中文会显示乱码。
; Extended 表示要 shift+右键 才会显示
; HasLUAShield 显示管理员图标

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="在此处打开 CMD (管理员)"
"Extended"=""
"HasLUAShield"=""
"ShowBasedOnVelocityId"=dword:00639bc8

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

对 Html 文件进行 Gzip 压缩

gzip 压缩

对目录下的所有 html, js, css 文件进行 gzip 压缩

1
find /usr/share/nginx/html -type f -regex ".*\.\(html\|js\|css\)" -exec sh -c "gzip < {} > {}.gz" \;

配置 nginx 支持

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 启用静态压缩,如果存在同名的以.gz结尾的文件,则优先使用.gz文件。优先级高于gzip。
gzip_static  on;
# 启用压缩。
gzip on;
# 文件大小大于2k时才进行压缩。
gzip_min_length 2k;
# 压缩级别,1-10。数字越大压缩率越高,CPU占用率也越高。
gzip_comp_level 5;
gzip_buffers 4 16k;
# 对以下MIME类型的文件进行压缩。text/html无论是否指定,都进行压缩。gzip_types设置对gzip_static无效。
gzip_types text/plain text/css application/javascript application/xml;
# 允许根据请求头的信息来判断返回压缩或非压缩数据。
gzip_vary on;

Trojan-go 安装指南

本文以 Debian 11 为例。

参考资料:

1. 安装 Trojan-go

1.1 二进制安装方式

1
2
3
4
5
6
7
8
wget https://github.com/p4gefau1t/trojan-go/releases/download/v0.10.6/trojan-go-linux-amd64.zip

unzip trojan-go-linux-amd64.zip

cp trojan-go /usr/local/bin/

mkdir /etc/trojan-go
cp *.dat /etc/trojan-go

相关文件路径为:

Etcd + Confd 动态配置 nginx 站点

运行环境为 Debian 11docker

1. 安装 nginx-proxy (该方案无直接安装 nginx 方便)

使用 docker 下载 nginx-proxy

1
2
docker pull nginxproxy/nginx-proxy:alpine
docker network create nginx-proxy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
version: '2'

services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy:alpine
    restart: always
    ports:
      - "80:80"
      - "443:443"
    environment:
      - ENABLE_IPV6=true
    volumes:
      - ./conf.d:/etc/nginx/conf.d
      - ./vhost.d:/etc/nginx/vhost.d:ro
      - ./certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - nginx-proxy

networks:
  nginx-proxy:
    external: true

2. 安装 nginx

直接安装源里的 nginx

Windows 内置工具简介

Windows 10 之后,操作系统内置了一系列比较实用的工具,此处对这些工具进行梳理介绍。

1. File Hash

可选的算法有: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

1
2
3
4
5
# cmd
certutil -hashfile filename md5

# powershell
Get-FileHash filename -algorithm md5

2. CSV 文件格式转换

csv 的文件格式进行标准化,如全部字段加上引号。

维护启动盘 Ventoy 备注

参考资料: github: Ventoy

1. 制作启动盘

下载 Ventoy 工具,使用该工具对 U 盘进行格式化。

2. 修改配置文件

配置文件所在路径: /ventoy/ventoy.json

示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
    "control": [
        { "VTOY_DEFAULT_SEARCH_ROOT": "/ISO" },
        { "VTOY_MENU_TIMEOUT": "10" },
        { "VTOY_DEFAULT_IMAGE": "/ISO/debian-11.1.0-amd64-netinst.iso" },
        { "VTOY_HELP_TXT_LANGUAGE": "zh_CN" }
    ],
    "theme": {
        "file": "/ventoy/themes/gulucat/theme.txt",
        "gfxmode": "1920x1080",
        "fonts": [
            "/ventoy/themes/gulucat/ascii.pf2",
            "/ventoy/themes/gulucat/DejaVuSans10.pf2",
            "/ventoy/themes/gulucat/DejaVuSans12.pf2",
            "/ventoy/themes/gulucat/DejaVuSans-Bold14.pf2",
            "/ventoy/themes/gulucat/droidlogo_bold_26.pf2"
        ],
        "ventoy_left": "100%",
        "ventoy_top": "100%",
        "ventoy_color": "gainsboro"
    },
    "menu_class": [
        {
            "key": "debian",
            "class": "debian"
        },
        {
            "key": "ubuntu",
            "class": "ubuntu"
        },
        {
            "key": "windows",
            "class": "windows"
        },
        {
            "key": "win",
            "class": "windows"
        }
    ],
    "auto_install": [
        {
            "image": "/ISO/debian-11.1.0-amd64-netinst.iso",
            "template": "/ventoy/script/debian-11.seed"
        },
        {
            "image": "/ISO/zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso",
            "template": "/ventoy/script/windows-unattended.xml"
        }
    ]
}

3. 放置镜像文件

把各个安装镜像文件放到 /ISO 目录下。

Debian 解压 zip 文件名乱码解决方案

zip 文件对于文件名的编码没有进行统一,因此有可能对于不同编码的系统,解压出来的文件名会产生乱码。

对于 Debian 来说,比较方便快捷的一个解决方案是使用 unar 进行解压。