2022-5-13 myluzh
Python
import re
subject = '080045000106309140003F2F7D100A01'
if (len(subject) % 2) == 0:
result = re.sub(r"(?<=\w)(?=(?:\w\w)+$)", "-", subject)
elif (len(subject) % 2) != 0:
a_subject = subject[:-1]
b_subject = subject[-1]
result = re.sub(r"(?<=\w)(?=(?:\w\w)+$)", "-", a_subject) + "-" + b_subject
print(result)
输出内容 08-00-45-00-01-06-30-91-40-00-3F-2F-7D-10-0A-01
阅读全文>>
标签: python
评论(0)
(605)
2022-4-24 myluzh
Python
def get_mac():
macList = list(net_if_addrs().items())
macI = 0
macAll = ""
while True:
try:
macName = macList[macI][0]
macAdders = macList[macI][1][0][1]
# macInfo = str(macName + " " + macAdders + " ")
if validate_mac(macAdders):
macAdders=macAdders.replace('-', ':')
print(macName, macAdders)
# macAll = macAll + macInfo
macI = macI + 1
except:
break
...
阅读全文>>
标签: python
评论(0)
(556)
2022-4-19 myluzh
MySQL
1、进入数据库
mysql -u root -p ‘原来的密码’ //进入数据库中
2、切换数据库
use mysql;
3、使用以下命令开启root用户远程访问权限:
CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';
GRANT ALL ON *.* TO 'root'@'%';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
4、刷新权限
FLUSH PRIVILEGES;
阅读全文>>
标签: mysql8 远程访问
评论(0)
(614)
2022-4-14 myluzh
VMware
VMware Workstation 7.0以上版本中有自带一个OVFTool.exe的工具
在VM安装路径下的\VMware\VMware OVF Tool\ovftool.exe
cmd运行以下命令即可转换成ovf
C:\Program Files\VMware\VMware OVF Tool\ovftool.exe "原文件路径\xxx.vmx" "目标路径\xxx.ovf"
阅读全文>>
标签: vmx转ovf
评论(0)
(1102)
2022-3-27 myluzh
Huawei
出口nat
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 10.1.0.0 0.0.255.255
[R1]int g 2/0/0
[R1-GigabitEthernet2/0/0]nat outbound 2000
端口映射
#当前接口地址 映射到本地
[R1-GigabitEthernet2/0/0]nat server protocol tcp global current-interface 80 ins
ide 10.1.200.10 80
阅读全文>>
标签: 华为 交换机 nat
评论(0)
(754)
2022-3-27 myluzh
Huawei
[HX-SW1]ospf 1 router-id 1.1.1.1
[HX-SW1-ospf-1]area 0
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.200.0 0.0.0.255
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.10.0 0.0.0.255
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.20.0 0.0.0.255
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.30.0 0.0.0.255
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.40.0 0.0.0.255
[HX-SW1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[R1]ospf 1 router-id 2.2.2.2
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[R1-ospf-1-area-...
阅读全文>>
标签: 华为 交换机 ospf
评论(0)
(388)