This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import locale | |
import subprocess | |
from argparse import ArgumentParser | |
from collections import namedtuple | |
Interface = namedtuple("Interface", "admin_status status type name") | |
p = subprocess.run("netsh interface show interface", stdout=subprocess.PIPE) | |
interfaces = [Interface(*line.split()) for i, line in enumerate(p.stdout.decode(locale.getpreferredencoding()).replace("\r", "").split("\n")) | |
if i > 2 and len(line.split()) == 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: replace <xxx> with your configuration include "<" and ">" | |
setlocal enableextensions disabledelayedexpansion | |
set ip=<your staic ip> | |
set name=<your adapter name> | |
netsh interface ipv4 show addresses "%name%" | findstr /r /i /c:"ip.*%ip%$" >nul 2>nul | |
if errorlevel 1 ( | |
echo "current dynamic ip, swtich to %ip%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val pattern = """(?:https?://)?(?:[^\./]*\.)*([^\./]*\.(?:com|cn|com\.cn|net|org|me))(?::\d+)?(?:$|/.*)""".r | |
val pattern(url) = "some url" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.