Skip to content

Instantly share code, notes, and snippets.

@canbingzt
canbingzt / clash.yaml
Last active November 7, 2025 05:14
clash覆写
dns:
enable: true
listen: :53
enhanced-mode: redir-host
fake-ip-range: 198.18.0.1/16
fake-ip-filter-mode: blacklist
prefer-h3: false
respect-rules: true
use-hosts: false
use-system-hosts: true
@canbingzt
canbingzt / repair.sh
Created July 16, 2025 00:14
修复docker容器内无法访问网络的问题
# 查看防火墙状态
firewall-cmd --state
# 查看防火墙是否开启ip地址转发(ip地址伪装)
firewall-cmd --query-masquerade
# 开启ip地址转发
firewall-cmd --add-masquerade --permanent
# 将网络接口 docker0 加入 trusted zone,解决 DNS 问题
firewall-cmd --permanent --zone=trusted --add-interface=docker0
# 更新防火墙规则
firewall-cmd --reload
function proxy {
$env:http_proxy = "http://127.0.0.1:7890"
$env:https_proxy = "http://127.0.0.1:7890"
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy ("http://127.0.0.1:7890")
Write-Host "Proxy enabled: http://127.0.0.1:7890" -ForegroundColor Green
}
function unproxy {
$env:http_proxy = $null
$env:https_proxy = $null
@canbingzt
canbingzt / compact-disk.txt
Last active July 14, 2025 06:03
distpart
select vdisk file="%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx"
compact vdisk
@canbingzt
canbingzt / 1.ps1
Created January 13, 2024 02:20
Windows Defender 阻止访问受保护的文件夹/内存(保护历史记录) 清理
Set-MpPreference -ScanPurgeItemsAfterDelay 2
# 其中的数字是在发现威胁后的多少天里清除
@canbingzt
canbingzt / build.sh
Created July 21, 2023 09:34
docker build using proxy
#!/bin/bash
PROXY_HTTP="http://localhost:1080"
docker build -f Dockerfile \
--network host \
--build-arg HTTP_PROXY=$PROXY_HTTP \
--build-arg HTTPS_PROXY=$PROXY_HTTP \
-t mytag:latest .
@canbingzt
canbingzt / app.sh
Created August 6, 2021 01:09
app.sh
#!/bin/bash
## blog:www.cnbuilder.cn
## create 2019-04-30
version="5.2.1";
appName=$2
if [ -z $appName ];then
appName=`ls -t |grep .jar$ |head -n1`
fi
Remove-NetFirewallRule -DisplayName "WSL"
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" -Action Allow