Skip to content

Instantly share code, notes, and snippets.


logan gufengxiaoyuehan

View GitHub Profile
gufengxiaoyuehan /
Created Jun 27, 2019
windows system switch interface need run as administrator and change the interace name in line:30-39
import locale
import subprocess
from argparse import ArgumentParser
from collections import namedtuple
Interface = namedtuple("Interface", "admin_status status type name")
p ="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
gufengxiaoyuehan / swtichIP.bat
Last active Apr 27, 2018
swtich between static ip address and dhcp
View swtichIP.bat
@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%"
gufengxiaoyuehan / extractdomain.txt
Last active Dec 24, 2017
extract domain from url using regex in scala
View extractdomain.txt
val pattern = """(?:https?://)?(?:[^\./]*\.)*([^\./]*\.(?:com|cn|com\.cn|net|org|me))(?::\d+)?(?:$|/.*)""".r
val pattern(url) = "some url"
gufengxiaoyuehan / automobile.ipynb
Created Jul 11, 2017 — forked from martinwicke/automobile.ipynb
Estimator demo using Automobile dataset
View automobile.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.