Skip to content

Commit 112e47c

Browse files
committed
Initial commit
0 parents  commit 112e47c

File tree

10 files changed

+123
-0
lines changed

10 files changed

+123
-0
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dictionaries/Mikasa.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/study.iml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NetWork/SSH/Simple_SSH_Client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import paramiko
4+
5+
6+
def simple_ssh_connect(ip, port, user, passwd, cmd):
7+
new_ssh = paramiko.SSHClient() # 创建一个新的SSH连接
8+
try:
9+
new_ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy) # 用户名密码登录方式
10+
new_ssh.connect(hostname=ip, port=port, username=user, password=passwd, timeout=5, compress=True)
11+
stdin, stdout, stderr = new_ssh.exec_command(command=cmd)
12+
print(stdout.read().decode())
13+
print(stderr.read().decode())
14+
except Exception as e:
15+
print("%s:%s" % (e.__class__, e))
16+
finally:
17+
new_ssh.close()
18+
19+
20+
if __name__ == '__main__':
21+
simple_ssh_connect('192.168.10.1', 22, 'root', '1234qwer', 'ip -4 a')
22+
23+
24+
"""
25+
@author: jiaopengyu
26+
@file: Simple_SSH_Client.py.py
27+
@project:study
28+
@software: PyCharm
29+
@time: 2023/4/7 10:18
30+
"""

function.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# -*- coding: utf-8 -*-
2+
import math
3+
4+
5+
def my_abs(x): # 自定义绝对值函数
6+
if not isinstance(x, (int, float)): # 如果传参不为整型和浮点型,打印下一行TypeError中的报错
7+
raise TypeError('bad operand type')
8+
if x >= 0:
9+
return x
10+
else:
11+
return -x
12+
13+
14+
def move(x, y, z, n=0.0): # 多参函数
15+
mx = x+z*math.cos(n)
16+
my = y-z*math.sin(n)
17+
return mx, my
18+
19+
20+
def quadratic(x, y, z): # 解一元二次方程
21+
m1 = (-y+math.sqrt(math.pow(y, 2)-4*x*z))/(2*x)
22+
m2 = (-y-math.sqrt(math.pow(y, 2)-4*x*z))/(2*x)
23+
return m1, m2
24+
25+
26+
if __name__ == '__main__':
27+
a = my_abs(-908)
28+
print(a)
29+
r = move(100, 200, 300, math.pi / 6)
30+
print(r)
31+
print(100+300*math.cos(math.pi/6))
32+
print(200-300*math.sin(math.pi/6))
33+
w = quadratic(1, 0, -1)
34+
print(w)
35+
36+
37+
"""
38+
@author: jiaopengyu
39+
@file: function.py
40+
@project:study
41+
@software: PyCharm
42+
@time: 2022/7/12 14:32
43+
"""

0 commit comments

Comments
 (0)