Skip to content

Instantly share code, notes, and snippets.

Avatar

logan gufengxiaoyuehan

View GitHub Profile
@gufengxiaoyuehan
gufengxiaoyuehan / switch_inteface.py
Created Jun 27, 2019
windows system switch interface need run as administrator and change the interace name in line:30-39
View switch_inteface.py
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
@gufengxiaoyuehan
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
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
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.