3月 132021
2月 022021
202102
1月 262021
iptables示例
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443
firewalld示例
# allow incoming connections on port 80. # You can also use --add-service=http instead of adding a port number sudo firewall-cmd --add-port=80/tcp --permanent sudo firewall-cmd --permanent \ --add-forward-port=port=80:proto=tcp:toaddr=127.0.0.1:toport=8080 # allow incoming connections on port 443. # You can also use --add-service=https instead of adding a port number sudo firewall-cmd --add-port=443/tcp --permanent sudo firewall-cmd --permanent \ --add-forward-port=port=443:proto=tcp:toaddr=127.0.0.1:toport=8443 sudo firewall-cmd --reload
内容引用:
https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-iptables/
1月 262021
安装阶段修改配置
[root@jenkins ~]# cd /var/lib/jenkins/ [root@jenkins jenkins]# cat hudson.model.UpdateCenter.xml <?xml version='1.1' encoding='UTF-8'?> <sites> <site> <id>default</id> <url>https://updates.jenkins.io/update-center.json</url> </site> </sites>[root@jenkins jenkins]# [root@jenkins jenkins]# cat hudson.model.UpdateCenter.xml <?xml version='1.1' encoding='UTF-8'?> <sites> <site> <id>default</id> <url>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url> </site> </sites> [root@jenkins jenkins]#
使用阶段修改配置
1月 152021
1月 052021
File -> Settings -> Project -> Python Interpreter -> Install -> Available Packages -> Manage Repositories https://mirrors.163.com/pypi/simple/ https://mirrors.ustc.edu.cn/pypi/web/simple https://pypi.tuna.tsinghua.edu.cn/simple https://mirrors.aliyun.com/pypi/simple/
12月 242020
https://ipinfo.io/developers
C:\Users\harveymei>curl ipinfo.io { "ip": "119.137.55.106", "city": "Shenzhen", "region": "Guangdong", "country": "CN", "loc": "22.5455,114.0683", "org": "AS4134 CHINANET-BACKBONE", "timezone": "Asia/Shanghai", "readme": "https://ipinfo.io/missingauth" } C:\Users\harveymei>
10月 122020
#定义一个创建文件的函数
def create_file():
path = 'C:/Users/harveymei/Desktop/' #最后一个斜线必须有
fullname = path + filename + '.txt'
file = open(fullname, 'w')
file.close()
#使用for循环调用创建文件函数
for name in range(1,11): #使用range()函数提供1-10序列数值
filename = str(name) #使用str()函数将整数转换为字符串赋值给变量
create_file() #循环调用函数,创建10个文件
PS D:\Python> & C:/Users/harveymei/AppData/Local/Programs/Python/Python39/python.exe d:/Python/hello.py
PS D:\Python> ls C:\Users\harveymei\Desktop\
目录: C:\Users\harveymei\Desktop
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2020/10/12 11:51 0 1.txt
-a---- 2020/10/12 11:51 0 10.txt
-a---- 2020/10/12 11:51 0 2.txt
-a---- 2020/10/12 11:51 0 3.txt
-a---- 2020/10/12 11:51 0 4.txt
-a---- 2020/10/12 11:51 0 5.txt
-a---- 2020/10/12 11:51 0 6.txt
-a---- 2020/10/12 11:51 0 7.txt
-a---- 2020/10/12 11:51 0 8.txt
-a---- 2020/10/12 11:51 0 9.txt
-a---- 2020/10/9 9:00 2136 Docker Desktop.lnk
-a---- 2020/4/14 8:55 2371 GitHub Desktop.lnk
-a---- 2020/8/28 15:20 2312 Kindle.lnk
-a---- 2020/8/21 17:59 2255 MockingBot.lnk
-a---- 2020/10/10 9:40 2217 Slack.lnk
PS D:\Python>
10月 092020
#定义密码列表并赋值给变量
password_list = ['*#*#', '12345']
#定义函数
def account_login():
password = input('Password:') #用户输入赋值变量
password_correct = password == password_list[-1] #使用列表索引取值进行布尔运算并赋值变量
password_reset = password == password_list[0]
if password_correct: #条件成立打印信息
print('Login success!')
elif password_reset: #反之,password_reset条件成立(即输入*#*#)
new_password = input('Enter a new password:') #用户输入赋值变量
password_list.append(new_password) #列表追加数据
print('Your password has changed successfully!')
account_login() #继续调用函数
else: #反之,打印错误信息
print('Wrong password or invalid input!')
account_login()
#调用函数
account_login()
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python39/python.exe c:/Users/harveymei/hello.py
Password:54321
Wrong password or invalid input!
Password:12345
Login success!
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python39/python.exe c:/Users/harveymei/hello.py
Password:*#*#
Enter a new password:hahaha
Your password has changed successfully!
Password:hahaha
Login success!
PS C:\Users\harveymei>
9月 232020
#自定义函数,a*a+b*b=c*c,开平方求c值
def Pythagorean_theorem(a,b):
return 'The right triangle third side\'s length is {}'.format((a**2 + b**2)**(1/2))
#引号内的字符串出现符号时需要使用\转义
#使用.format()将格式化的运算值填入字符串中
#调用函数,传入参数并打印函数返回
print(Pythagorean_theorem(3,4))
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python38/python.exe c:/Users/harveymei/hello.py
The right triangle third side's length is 5.0
PS C:\Users\harveymei>