Skip to content

Instantly share code, notes, and snippets.

View Youngv's full-sized avatar

Victor Yang Youngv

View GitHub Profile
@Youngv
Youngv / WSL2.bat
Last active February 21, 2025 14:32
给 WSL2 和 Host 设置静态 IP 地址,每次重启 Host 或 WSL2 后运行
@ECHO OFF
wsl -d Ubuntu-20.04 -u root ip addr del $(ip addr show eth0 ^| grep 'inet\b' ^| awk '{print $2}' ^| head -n 1) dev eth0
wsl -d Ubuntu-20.04 -u root ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0
wsl -d Ubuntu-20.04 -u root ip route add 0.0.0.0/0 via 192.168.50.1 dev eth0
wsl -d Ubuntu-20.04 -u root echo nameserver 192.168.50.1 ^> /etc/resolv.conf
powershell -c "Get-NetAdapter 'vEthernet (WSL)' | Get-NetIPAddress | Remove-NetIPAddress -Confirm:$False; New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (WSL)'; Get-NetNat | ? Name -Eq WSLNat | Remove-NetNat -Confirm:$False; New-NetNat -Name WSLNat -InternalIPInterfaceAddressPrefix 192.168.50.0/24;"
@Youngv
Youngv / RESTART_BT.bat
Created March 27, 2025 09:07
Restart Bluetooth devices after Windows 11 sleep.
@echo off
title Bluetooth Device Restart Tool
echo Restarting Bluetooth devices...
:: Check for admin privileges
NET SESSION >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo ERROR: Please run this script as administrator!
echo Right-click the script and select "Run as administrator"
pause
@Youngv
Youngv / U20+OpenWrt.md
Created April 5, 2025 08:11
OpenWrt 连接飞猫 U20 之后局域网设备流量分流设置

下面是设置和复原网络规则的完整命令集合。你可以直接按照以下步骤运行每条命令,快速实现配置和清理。


设置规则

以下命令将指定设备 192.168.1.6 的流量通过 USB 网口 eth4 (网关 192.168.88.1) 出网。

1. 创建 USB 路由表

将路由表名称 usb_route 写入 /etc/iproute2/rt_tables 文件:

@Youngv
Youngv / Termux SSH Tutorial.md
Created April 23, 2025 06:01 — forked from devmaars/Termux SSH Tutorial.md
This guide will show you how to set up an ssh server on your phone using Termux and connect to it from your computer. This is useful if you want to access your phone's files or run commands on your phone from your computer.

How to ssh to termux the right way

Termux

Requirements

  • Termux (From F-Droid)
  • ADB (Android Debug Bridge)
  • USB Cable (Wireless connection is also possible but it's slower)