Parsec错误码-800解决办法

如果web无法访问就是parsec.app被屏蔽了

在文件中添加%appdata%\Parsec\config.txt代理配置

1
2
3
4
app_proxy_address = 127.0.0.1
app_proxy_scheme = http
app_proxy = true
app_proxy_port = 7890

具体参数根据个人配置而定

阅读全文 »

因为大量上传被管理员在路由器上限速了,结果网页也访问不了,只能更换MAC,WLAN的MAC由于没有对应条目,无法在设备管理器更改,直接改注册表也不太友好

TMAC下载

image-20220124102110974
  • 简单易用,可以随机生成

Python_Matplotlib极坐标系作全向反应谱图

\[ a_\theta(t)=a_x(t)\cos\theta+a_y(t)\sin\theta \]

  1. 通过NS和EW向地震波生成360度全方向地震波
  2. 计算出该条地震动反应谱
  3. 在极坐标系上使用等高线工具绘制全向反应谱图
1
2
3
4
5
def graph(theta,r,value,name):#theta,r,value,命名(包含路径)
fig, axes = plt.subplots(subplot_kw=dict(projection='polar'),figsize=(10,10))
contourplot = axes.contourf(theta,r,value,cmap=plt.cm.jet)
plt.colorbar(contourplot, shrink=.6, pad=0.08)
plt.savefig(name)
  • 只需要计算0-180度反应谱去最大值,\(\theta+180\)取最小值即可,减少计算量
阅读全文 »

题目

Given an array rectangles where rectangles[i] = [xi, yi, ai, bi] represents an axis-aligned rectangle. The bottom-left point of the rectangle is (xi, yi) and the top-right point of it is (ai, bi).

Return true if all the rectangles together form an exact cover of a rectangular region.

Example 1:

img
阅读全文 »

需求

  • 例如frpc内网穿透服务要求在重启后立即执行,不要等到用户登入后

方案

  • 计划任务中使用SYSTEM用户进行
  • QQ截图20210914173300

Python基于中心差分及Newmark法计算地震波反映谱

地震工程作业代码

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import os
import math
import numpy as np
import matplotlib.pyplot as plt
import scipy

class spectrum:
sw=np.array([]) #地震波a
v=np.array([]) #地震波速度
su=np.array([]) #地震波位移
tf=np.array([]) #调幅后地震波a

u=np.array([])
u0=np.array([])
u00=np.array([])

saT=np.array([])
sa=np.array([]) #谱加速度
sv=np.array([]) #谱速度
sd=np.array([]) #谱位移

PGA=0
PGD=0
PGV=0
t=0

def __init__(self,path,t):#路径,步长
file_4=open(path,"r")
str4="" #文件前四行
for p in range(0,4):
str4=str4+file_4.readline()
data=file_4.readlines()# 读取后面全部数据
file_4.close() #获取前四行
lit=[]
for d in data:
tmpd=d.split()
for num_tmpd in range(0,len(tmpd)):
lit.append(float(tmpd[num_tmpd]))
self.sw=np.array(lit)
self.t=t
return

def newmark_beta(self,T,ksi=0.05,gamma=0.5,beta=0.25):#步长,周期,地震波
if T==0:
T=0.00000001
n=len(self.sw)
m=1.0
c=2*m*ksi*(2*np.pi/T)
#分别为加速度,速度,位移
u00=np.zeros(n)
u0=np.zeros(n)
u=np.zeros(n)
k=(2*np.pi/T)**2*m
u00[0]=-self.sw[0]-c*u0[0]-k*u[0]
a1=m/(beta*(self.t**2))+gamma*c/(beta*self.t)
a2=m/(beta*self.t)+(gamma/beta-1)*c
a3=(1/(2*beta)-1)*m+self.t*(gamma/(2*beta)-1)*c
k_hat=k+a1 #k^/hat

for i in range(1,n):
p_hat=-self.sw[i]+a1*u[i-1]+a2*u0[i-1]+a3*u00[i-1]
u[i]=p_hat/k_hat
u0[i]=gamma/(beta*self.t)*(u[i]-u[i-1])+(1-gamma/beta)*u0[i-1]+self.t*(1-gamma/(2*beta))*u00[i-1]
u00[i]=1/(beta*(self.t**2))*(u[i]-u[i-1])-u0[i-1]/(beta*self.t)-(1/(2*beta)-1)*u00[i-1]
self.u=u
self.u0=u0
self.u00=u00+self.sw
return u,u0,u00+self.sw

def central_difference(self,T,ksi=0.05,gamma=0.5,beta=0.25):
m=1.0
n=len(self.sw)
u00=np.zeros(n)
u0=np.zeros(n)
u=np.zeros(n+1)
c=2*m*ksi*(2*np.pi/T)
k=(2*np.pi/T)**2*m
u00[0]=-self.sw[0]-c*u0[0]-k*u[0]
u_1=u[0]-self.t*u0[0]+self.t**2*u00[0]/2
k_hat=m/(self.t**2)+c/(2*self.t)
a=m/(self.t**2)-c/(2*self.t)
b=k-2*m/(self.t**2)
for i in range(n):
if i==1:
p_hat=-self.sw[i]-a*u_1-b*u[i]
else:
p_hat=-self.sw[i]-a*u[i-1]-b*u[i]
u[i+1]=p_hat/k_hat
u0[i]=(u[i+1]-u[i-1])/(2*self.t)
u00[i]=(u[i+1]-2*u[i]+u[i-1])/(self.t**2)
self.u=u[:n]
self.u0=u0
self.u00=u00+self.sw
return

def get_PGA(self):
self.PGA=max(abs(self.sw))
return max(abs(self.sw))

def get_PGV(self):
self.PGV=max(abs(self.v))
return max(abs(self.v))

def get_PGD(self):
self.PGD=max(abs(self.su))
return max(abs(self.su))

def get_sa(self,begin,end,step):
T=np.arange(begin,end,step)
sa=np.array([])
sv=np.array([])
su=np.array([])
for i in T:
u,v,a=self.newmark_beta(i)
sa=np.append(sa,max(abs(a)))
sv=np.append(sv,max(abs(v)))
su=np.append(su,max(abs(u)))
self.saT=T
self.sa=sa
self.sd=su
self.sv=sv
return

def get_v(self):#步长,地震波
v=[]
for i in range(len(self.sw)):
v.append(np.trapz(self.sw[:i+1],dx=self.t))
self.v=np.array(v)
return v

def get_u(self):
v=self.get_v()
u=[]
for i in range(len(self.sw)):
u.append(np.trapz(v[:i+1],dx=self.t))
self.su=np.array(u)
return u

def tiaofu_sa(self,T,target):# 地震波步长 地震波 要调幅到的周期和值'
u,v,a=self.newmark_beta(T)
sa=max(abs(a))
self.tf=self.sw
self.sw=self.sw*(target/sa)
self.get_v()
self.get_u()
return target/sa

def fypa(self,T,x,path):
y=np.loadtxt(path)
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.figure(figsize=(10,5))
plt.title("标准加速度反应谱")
self.get_PGA()
plt.plot(T,x/self.PGA,label="python")
plt.plot(T,y/self.PGA,label="SPECTR")
plt.xlabel("T(s)")
plt.ylabel("$\\beta$")
plt.legend()

def fypv(self,T,x,path):
y=np.loadtxt(path)/1000
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.figure(figsize=(10,5))
plt.title("标准速度反应谱")
self.get_PGV()
plt.plot(T,x/self.PGV,label="python")
plt.plot(T,y/self.PGV,label="SPECTR")
plt.xlabel("T(s)")
plt.ylabel("$\\beta$")
plt.legend()

def fypu(self,T,x,path):
y=np.loadtxt(path)/1000
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.figure(figsize=(10,5))
plt.title("标准位移反应谱")
self.get_PGD()
plt.plot(T,x/self.PGD,label="python")
plt.plot(T,y/self.PGD,label="SPECTR")
plt.xlabel("T(s)")
plt.ylabel("$\\beta$")
plt.legend()

def sw_a(self):
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus']=False # 用来正常显示负号
plt.figure(figsize=(10,5))
plt.title("地震波加速度时程")
t=np.linspace(0,len(self.sw)*self.t,len(self.sw))
plt.plot(t,self.sw)
plt.xlabel("t(s)")
plt.ylabel("a(g)")
#plt.legend()

使用实例

阅读全文 »

基于GitHub-webhook进行Hexo自动部署

  1. wget https://github.com/yezihack/github-webhook/releases/download/v1.5.0/github-webhook1.5.0.linux-amd64.tar.gz
  2. tar -zxvf github-webhook1.5.0.linux-amd64.tar.gz
  3. cp github-webhook /usr/local/bin/
  4. 写执行脚本vim webhook.sh
1
2
3
4
#!/bin/bash
cd /root/hexo/blog #注意:替换自己hexo所在路径
git pull
hexo g -d
  1. github-webhook -b [shell脚本路径] -s [github webhook的密码]

详细配置webhook官方脚本有详解,地址在下面

阅读全文 »

Step.1 安装samba

yum install samba

Step.2 添加samba用户

smbpasswd -a samba 必须为系统存在的用户

smbpasswd -e samba激活用户

阅读全文 »

Step.1 安装pm2

npm install pm2 -g

Step.2 在source目录下创建 start.js

1
2
3
4
5
6
7
var process = require('child_process');

process.exec(' hexo g -d', function (error, stdout, stderr) {
if (error !== null) {
console.log('exec error: ' + error);
}
});

Step.3 在source目录下创建 watch.json

阅读全文 »
0%