存档

文章标签 ‘vps12.com’

VPS性能一键测试脚本

2019年6月10日 没有评论

服务器性能测试

命令如下:
中文版:

1
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench-CN.sh && bash ZBench-CN.sh

英文版:

1
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/ZBench/master/ZBench.sh && bash ZBench.sh

效果如下图所示:

 

分类: Linux 标签: ,

docker的简单状态监控

2019年6月8日 没有评论
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
docker stats
 
//可以使用占位符,显示想要看的信息:
 
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.Name}}"
 
CONTAINER           CPU %               MEM USAGE / LIMIT     NET I/O             NAME
62be266217e3        0.00%               1.793MiB / 15.39GiB   2.34GB / 1.95GB     vps12.com_nginx_1
21f986581173        0.00%               5.543MiB / 15.39GiB   16.9kB / 0B         vps12.com_php54_1
f4a2f0111178        0.00%               6.48MiB / 15.39GiB    16.9kB / 0B         vps12.com_php56_1
d984db8a9615        0.00%               19.55MiB / 15.39GiB   2.31GB / 2.66GB     vps12.com_php72_1
dcd9e311a1f0        0.20%               443.4MiB / 15.39GiB   1.77GB / 2.68GB     vps12.com_mysql_1
21c1f6fccf9c        0.15%               34.99MiB / 15.39GiB   7.49GB / 11.9GB     vps12.com_redis_1

各个占位符的含义:
.Container – 显示容器ID;
.Name – 显示容器名称;
.ID – 显示容器ID;
.CPUPerc – 显示CPU百分比;
.MemUsage – 显示内存使用情况;
.NetIO – 显示网络I / O;
.BlockIO – 显示块I / O;
.MemPerc – 显示内存百分比;
.PID – 显示进程ID的数量;

分类: Linux, 软件使用 标签: ,

CentOS 一键安装Cacti 1.2.3脚本

2019年5月19日 没有评论
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#!/bin/bash
 
echo "this script requires git"
yum install -y git 
 
echo "This script will download all Cacti dependecies and download the chosen cacti version from the cacti github"
echo "Dont forget to support cacti @ cacti.net!"
 
echo "set selinux to disabled"
setenforce 0 
sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
 
#Download chosen release
echo "here are some of the current cacti release versions \n
release/1.2.3
release/1.2.2
release/1.2.1
release/1.2.0
"
 
echo  "which release would you like to download ? Hit enter for latest"
read version
 
if  [ "$version" == "" ]
then
git clone https://github.com/Cacti/cacti.git
 
else 
yum install -y wget unzip
wget https://github.com/Cacti/cacti/archive/release/$version.zip
unzip $version 
mv cacti-release-$version cacti
fi
 
echo "will you be using the spine poller enter 1 for yes 2 for no"
read answer
if [ $answer == "1" ]
then
##Download packages needed for spine
yum install -y gcc mysql-devel net-snmp-devel autoconf automake libtool dos2unix help2man
echo "downloading and compling spine"
git clone https://github.com/Cacti/spine.git
cd spine
./bootstrap
./configure
make
make install
chown root:root /usr/local/spine/bin/spine
chmod u+s /usr/local/spine/bin/spine
cd ..
 
else
echo "spine dependecies  will not be installed"
fi
 
echo "On Centos systems we need to enable EPEL repos"
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum install yum-utils -y
yum-config-manager --enable remi-php72
 
echo "Downloading PHP modules needed for Cacti install"
 
yum install  -y rrdtool mariadb-server net-snmp-utils net-snmp  snmpd php php-mysql  php-snmp php-xml php-mbstring php-json php-gd php-gmp php-zip php-ldap php-mc php-posix 
 
###Start services 
 
systemctl enable httpd
systemctl enable mariadb
systemctl start mariadb
systemctl start httpd
 
####Open Port 80 and 443 on firewalld
 
echo "Open http and https ports on firewalld"
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --reload
 
##Timezone settings needed for cacti
echo "Enter your PHP time zone i.e America/Toronto  Default is US/Central "
read timezone
if [ $timezone == "" ] 
then
 
echo "date.timezone =" US/Central >> /etc/php.ini
else
 
echo "date.timezone =" $timezone >> /etc/php.ini
 
fi  
 
echo "Where would you like to install cacti default location is /var/www/html hit enter for default location"
read location
if [$location = ""]
then
 
location="/var/www/html"
 
mv cacti /var/www/html
else
mv cacti $location
fi
 
#Create cacti user and change permission of directory
echo "Which user would you like to run Cacti under (Default is www-data) hit enter for default"
read user
if [$user = ""]
then 
user="apache"
echo  "cacti will be run under apache"
chown -R  apache:apache $location/cacti
else 
useradd $user
chown -R $user:$user $location/cacti
fi
 
#assign permissions for cacti installation
 
chown -R apache:apache $location/cacti/resource/snmp_queries/          
chown -R apache:apache $location/cacti/resource/script_server/
chown -R apache:apache $location/cacti/resource/script_queries/
chown -R apache:apache $location/cacti/scripts/
chown -R apache:apache $location/cacti/cache/boost/
chown -R apache:apache $location/cacti/cache/mibcache/
chown -R apache:apache $location/cacti/cache/realtime/
chown -R apache:apache $location/cacti/cache/spikekill/
touch $location/cacti/log/cacti.log
chmod 777 $location/cacti/log/cacti.log
chown -R apache:apache   $location/cacti/log/
cp $location/cacti/include/config.php.dist $location/cacti/include/config.php
 
##Create database 
echo "would you like to customize the database name and user ? hit enter for defaults"
read customize
 
if [[ $customize = "" ]] 
then
 
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE cacti DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'localhost' IDENTIFIED BY 'cacti'; ;
GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
USE mysql;
ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES;
MYSQL_SCRIPT
 
#pre populate cacti db
mysql -u root  cacti < $location/cacti/cacti.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root  mysql
 
sed -i -e 's@^$database_type.*@$database_type = "mysql";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_default.*@$database_default = "cacti";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_hostname.*@$database_hostname = "127.0.0.1";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_username.*@$database_username = "cacti";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_password.*@$database_password = "cacti";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_port.*@$database_port = "3306";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^$database_ssl.*@$database_ssl = "false";@g' /var/www/html/cacti/include/config.php
sed -i -e 's@^//$url_path@$url_path@g' /var/www/html/cacti/include/config.php
 
echo "default database setup with following details"
echo "database name cacti\n
database username cacti\n
database password cacti"
 
else
 
echo "enter db name"
read customdbname
echo "enter db user"
read customdbuser
echo "enter db password"
read customdbpassword
 
mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE $customdbname;
GRANT ALL PRIVILEGES ON $customdbname.* TO '$customdbuser'@'localhost' IDENTIFIED BY '$customdbpassword';
GRANT SELECT ON mysql.time_zone_name TO $customdbuser@localhost;
ALTER DATABASE $customdbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES;
MYSQL_SCRIPT
 
echo "Pre-populating cacti DB"
mysql -u root  $customdbname < $location/cacti/cacti.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root  mysql
 
sed -i -e 's@^$database_type.*@$database_type = "mysql";@g' $location/cacti/include/config.php
sed -i -e 's@^$database_default.*@$database_default = '$customdbname'\;@g' $location/cacti/include/config.php
sed -i -e 's@^$database_hostname.*@$database_hostname = "127.0.0.1";@g' $location/cacti/include/config.php
sed -i -e 's@^$database_username.*@$database_username = '$customdbuser';@g' $location/cacti/include/config.php
sed -i -e 's@^$database_password.*@$database_password = '$customdbpassword';@g' $location/cacti/include/config.php
sed -i -e 's@^$database_port.*@$database_port = "3306";@g' "$location"/cacti/include/config.php
sed -i -e 's@^$database_ssl.*@$database_ssl = "false";@g' "$location"/cacti/include/config.php
sed -i -e 's@^//$url_path@$url_path@g' $location/cacti/include/config.php
 
fi
 
###Adding recomended PHP settings 
sed -e 's/max_execution_time = 30/max_execution_time = 60/' -i /etc/php.ini
sed -e 's/memory_limit = 128M/memory_limit = 400M/' -i /etc/php.ini
 
echo "Applying recommended DB settings"
echo "
innodb_file_format = Barracuda
character_set_client = utf8mb4
max_allowed_packet = 16777777
join_buffer_size = 32M
innodb_file_per_table = ON
innodb_large_prefix = 1
innodb_buffer_pool_size = 250M
innodb_additional_mem_pool_size = 90M
innodb_flush_log_at_trx_commit = 2
" >> /etc/my.cnf.d/server.cnf
 
echo "this script can download the following plugins monitor,thold would you like to install them  ?
type yes to download hit enter to skip"
read plugins
 if [ $plugins == "yes" ]
  then
   git clone https://github.com/Cacti/plugin_thold.git
    git clone https://github.com/Cacti/plugin_monitor.git
mv plugin_thold thold
  mv plugin_monitor monitor
   chown -R $user:$user thold
    chown -R $user:$user monitor
     mv thold $location/cacti/plugins
      mv monitor $location/cacti/plugins
else
 echo "plugins will not be installed"
fi
 
touch /etc/cron.d/$user
echo "*/5 * * * * $user php $location/cacti/poller.php > /dev/null 2>&1" > /etc/cron.d/$user 
 
echo "refreshing services"
systemctl restart httpd
systemctl restart mariadb
 
echo "Installation completed !"
分类: Linux, 编程实践 标签: , ,

centos7 firewall-cmd

2019年4月4日 没有评论
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
#删除端口规则
firewall-cmd --zone=public --remove-port=22/tcp --permanent
 
#查看列表规则
firewall-cmd --zone=public --list-ports
 
#开设端口
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
 
firewall-cmd --reload
systemctl enable firewalld
systemctl restart firewalld
 
#限制指定ip地址访问端口,例如ssh端口22
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.11.11" port protocol="tcp" port="22" accept"
 
#删除限制规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.11.11" port protocol="tcp" port="11300" accept"
 
#开通端口范围规则
firewall-cmd --permanent --add-port=1000-2000/tcp
 
#添加指定网段对ssh所用的端口访问权限
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="112.112.112.0/24" port protocol="tcp" port="22" accept"
 
#以上是一些实用新版本防火墙笔记,希望对大家有用

查看网线是否接上及mii-tool使用(转)

2019年3月26日 没有评论

==================================Debian=======================================
1、发行版本
cat /etc/debian_version
5.0.2

2、内核
uname -r
2.6.18-6-amd64

3、机型
dmidecode -s system-product-name
PowerEdge R710

4、安装软件包
apt-get -y install net-tools

5、使用ip命令查看网络接口状态
1)ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:12 brd ff:ff:ff:ff:ff:ff
3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 84:2b:2b:48:ab:14 brd ff:ff:ff:ff:ff:ff
inet 192.168.35.133/24 brd 192.168.35.255 scope global eth1
4: eth2: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:16 brd ff:ff:ff:ff:ff:ff
5: eth3: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:18 brd ff:ff:ff:ff:ff:ff
查看结果是eth1已经有ip 但eth0还没有ip及网络接口也没有打开

2)参数说明
qdisc pfifo_fast #Priority queueing
qlen #默认接口传输队列的默认长度
mtu #最大传输单元
qdisc noop #表示网络接口还没有up状态
up #设备处于运行状态,能接收和发送数据包
down #设备处于关闭状态,不能接收和发送数据包
qdisc mq #Multiqueue

6、如果没打开eth0网络接口的话使用mii-tool命令后结果是这样的
mii-tool
SIOCGMIIPHY on ‘eth0′ failed: Resource temporarily unavailable
eth1: negotiated 1000baseT-FD flow-control, link ok
SIOCGMIIPHY on ‘eth2′ failed: Resource temporarily unavailable
SIOCGMIIPHY on ‘eth3′ failed: Resource temporarily unavailable

7、使用ifconfig命令打开eth0网络接口
ifconfig eth0 up

8、再次使用mii-tool命令查看网线是否连接,这次看到显示eth0是no link状态 判定网线没接上
eth0: no link
eth1: negotiated 1000baseT-FD flow-control, link ok
eth2: no link
eth3: no link

9、找idc工程师让他们接上网线

==================================Centos=======================================
1、发行版本
cat /etc/redhat-release
CentOS release 6.5 (Final)

2、内核
uname -r
2.6.32-431.el6.x86_64

3、机型
dmidecode -s system-product-name
PowerEdge R610

4、安装软件包
yum -y install net-tools

5、使用ip命令查看网络接口状态
ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:5e brd ff:ff:ff:ff:ff:ff
inet 111.222.333.444/24 brd 111.222.333.444 scope global eth0
inet6 fe80::222:19ff:fe63:975e/64 scope link
valid_lft forever preferred_lft forever
3: eth1: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:60 brd ff:ff:ff:ff:ff:ff
inet 10.18.22.190/24 brd 10.18.22.255 scope global eth1
inet6 fe80::222:19ff:fe63:9760/64 scope link
valid_lft forever preferred_lft forever
4: eth2: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:62 brd ff:ff:ff:ff:ff:ff
inet 111.222.333.444/25 brd 111.222.333.444 scope global eth2
inet6 fe80::222:19ff:fe63:9762/64 scope link
valid_lft forever preferred_lft forever
5: em4: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:22:19:63:97:64 brd ff:ff:ff:ff:ff:ff

6、如果没打开em4网络接口的话使用mii-tool命令后结果是这样的
mii-tool em4
SIOCGMIIPHY on ‘em4′ failed: Resource temporarily unavailable

7、使用ifconfig命令打开eth0网络接口
ifconfig em4 up

8、找idc工程师让他们接上网线后查看
mii-tool em4
em4: negotiated 100baseTx-FD flow-control, link ok

参考文章

http://events.linuxfoundation.org/sites/events/files/slides/Linux_traffic_control.pdf

分类: 解决方案 标签: ,

“流量监管”和”流量整形”的区别

2019年3月13日 没有评论

“流量监管” (Traffic Policing) 就是对流量进行控制,通过监督进入交换机端口的流量速率,对超出部分的流量进行”惩罚” (采用监管方式时是直接丢弃),使进入端口的流量被限制在一个合理的范围之内。例如可以限制HTTP报文不能占用超过50%的网络带宽,否则QoS流量监管功能可以选择丢弃报文,或重新配置报文的优先级。

“流量整形”为控制最大输出通信速率提供可能,以确保通信符合配置的最大传输速率规定。符合某种配置的通信可能被整形,以使它符合下游设备的通信速率需求,处理任何失配的数据传输速率。流量整形通常使用缓冲区和令牌桶来完成,当报文的发送速率过快时,首先在缓冲区进行缓存,在令牌桶的控制下再均匀地发送这些被缓冲的报文。当下游设备的接口速率小于上游设备的端口速率或发生突发流量时,在下游设备入端口处可能出现流量拥塞的情况。此时用户可以通过在下游设备的出端口配置流量整形将上游不规整的流量进行削峰填谷,输出一条比较平整的流量,从而解决下游设备的拥塞问题。流量整形是一种可应用于接口、子接口或队列的流量控制技术,可以对从接口上经过的所有报文或某类报文进行速率限制

流量整形和流量监管都是作用于网络边缘,对进入设备端口的流量进行的一种处理方式。它们的主要区别在于:流量监管直接丢弃不符合速率要求的报文,丢弃的报文比较多,可能引发重传;而流量整形是将不符合速率要求的报文先行缓存,当令牌桶有足够的令牌时再均匀地向外发送这些被缓存的报文,较少丢弃报文,但引入时延和抖动,需要较多的缓冲资源缓存报文 。所以这两种功能的应用领域也不尽相同,流量监管适用于对丢弃率不敏感,而对时延和抖动比较敏感的网络应用,如一些普通的话音和视频通信;流量整形适用于对时延和抖动不敏感的网络应用,如数据传输、 www 访问等 。

分类: 网络产品 标签:

CentOS7使用firewalld打开关闭防火墙与端口

2019年3月10日 没有评论

1、firewalld的基本使用
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld
开机禁用 : systemctl disable firewalld
开机启用 : systemctl enable firewalld

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl –failed

3.配置firewalld-cmd

查看版本: firewall-cmd –version
查看帮助: firewall-cmd –help
显示状态: firewall-cmd –state
查看所有打开的端口: firewall-cmd –zone=public –list-ports
更新防火墙规则: firewall-cmd –reload
查看区域信息: firewall-cmd –get-active-zones
查看指定接口所属区域: firewall-cmd –get-zone-of-interface=eth0
拒绝所有包:firewall-cmd –panic-on
取消拒绝状态: firewall-cmd –panic-off
查看是否拒绝: firewall-cmd –query-panic

那怎么开启一个端口呢
添加
firewall-cmd –zone=public –add-port=80/tcp –permanent (–permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd –reload
查看
firewall-cmd –zone= public –query-port=80/tcp
删除
firewall-cmd –zone= public –remove-port=80/tcp –permanent

分类: Linux 标签: , ,

如何破解EXCEL工作表保护密码忘记密码怎么办(转)

2019年3月6日 没有评论

1.新建一个EXCEL工作表,而后点击另存为,讲表格保存为启用宏的工作表.
2.一次点击开发工具—录制新宏,在弹出的对话框内修改宏名称而后确定.
3.依次点击开发工具—-停止录制宏,宏录制完成.
4.依次点击开发工具,—宏—-在弹出的对话框找到我们刚才录制的宏名称而后进入VBA界面.
5.在VBA界面,全选里面的代码,而后删除,讲里面的代码全部删除完.

代码复制到VBA编辑窗口内

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
Public Sub AllInternalPasswords() 
' Breaks worksheet and workbook structure passwords. Bob McCormick 
' probably originator of base code algorithm modified for coverage 
' of workbook structure / windows passwords and for multiple passwords 
' 
' Norman Harker and JE McGimpsey 27-Dec-2002 (Version 1.1) 
' Modified 2003-Apr-04 by JEM: All msgs to constants, and 
' eliminate one Exit Sub (Version 1.1.1) 
' Reveals hashed passwords NOT original passwords 
Const DBLSPACE As String = vbNewLine & vbNewLine 
Const AUTHORS As String = DBLSPACE & vbNewLine & _ 
"Adapted from Bob McCormick base code by" & _ 
"Norman Harker and JE McGimpsey" 
Const HEADER As String = "AllInternalPasswords User Message" 
Const VERSION As String = DBLSPACE & "Version 1.1.1 2003-Apr-04" 
Const REPBACK As String = DBLSPACE & "Please report failure " & _ 
"to the microsoft.public.excel.programming newsgroup." 
Const ALLCLEAR As String = DBLSPACE & "The workbook should " & _ 
"now be free of all password protection, so make sure you:" & _ 
DBLSPACE & "SAVE IT NOW!" & DBLSPACE & "and also" & _ 
DBLSPACE & "BACKUP!, BACKUP!!, BACKUP!!!" & _ 
DBLSPACE & "Also, remember that the password was " & _ 
"put there for a reason. Don't stuff up crucial formulas " & _ 
"or data." & DBLSPACE & "Access and use of some data " & _ 
"may be an offense. If in doubt, don't." 
Const MSGNOPWORDS1 As String = "There were no passwords on " & _ 
"sheets, or workbook structure or windows." & AUTHORS & VERSION 
Const MSGNOPWORDS2 As String = "There was no protection to " & _ 
"workbook structure or windows." & DBLSPACE & _ 
"Proceeding to unprotect sheets." & AUTHORS & VERSION 
Const MSGTAKETIME As String = "After pressing OK button this " & _ 
"will take some time." & DBLSPACE & "Amount of time " & _ 
"depends on how many different passwords, the " & _ 
"passwords, and your computer's specification." & DBLSPACE & _ 
"Just be patient! Make me a coffee!" & AUTHORS & VERSION 
Const MSGPWORDFOUND1 As String = "You had a Worksheet " & _ 
"Structure or Windows Password set." & DBLSPACE & _ 
"The password found was: " & DBLSPACE & "$$" & DBLSPACE & _ 
"Note it down for potential future use in other workbooks by " & _ 
"the same person who set this password." & DBLSPACE & _ 
"Now to check and clear other passwords." & AUTHORS & VERSION 
Const MSGPWORDFOUND2 As String = "You had a Worksheet " & _ 
"password set." & DBLSPACE & "The password found was: " & _ 
DBLSPACE & "$$" & DBLSPACE & "Note it down for potential " & _ 
"future use in other workbooks by same person who " & _ 
"set this password." & DBLSPACE & "Now to check and clear " & _ 
"other passwords." & AUTHORS & VERSION 
Const MSGONLYONE As String = "Only structure / windows " & _ 
"protected with the password that was just found." & _ 
ALLCLEAR & AUTHORS & VERSION & REPBACK 
Dim w1 As Worksheet, w2 As Worksheet 
Dim i As Integer, j As Integer, k As Integer, l As Integer 
Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer 
Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer 
Dim PWord1 As String 
Dim ShTag As Boolean, WinTag As Boolean 
Application.ScreenUpdating = False 
With ActiveWorkbook 
WinTag = .ProtectStructure Or .ProtectWindows 
End With 
ShTag = False 
For Each w1 In Worksheets 
ShTag = ShTag Or w1.ProtectContents 
Next w1 
If Not ShTag And Not WinTag Then 
MsgBox MSGNOPWORDS1, vbInformation, HEADER 
Exit Sub 
End If 
MsgBox MSGTAKETIME, vbInformation, HEADER 
If Not WinTag Then 
MsgBox MSGNOPWORDS2, vbInformation, HEADER 
Else 
On Error Resume Next 
Do 'dummy do loop 
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 
With ActiveWorkbook 
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ 
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _ 
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) 
If .ProtectStructure = False And _ 
.ProtectWindows = False Then 
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ 
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ 
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) 
MsgBox Application.Substitute(MSGPWORDFOUND1, _ 
"$$", PWord1), vbInformation, HEADER 
Exit Do 'Bypass all for...nexts 
End If 
End With 
Next: Next: Next: Next: Next: Next 
Next: Next: Next: Next: Next: Next 
Loop Until True 
On Error GoTo 0 
End If 
If WinTag And Not ShTag Then 
MsgBox MSGONLYONE, vbInformation, HEADER 
Exit Sub 
End If 
On Error Resume Next 
For Each w1 In Worksheets 
'Attempt clearance with PWord1 
w1.Unprotect PWord1 
Next w1 
On Error GoTo 0 
ShTag = False 
For Each w1 In Worksheets 
'Checks for all clear ShTag triggered to 1 if not. 
ShTag = ShTag Or w1.ProtectContents 
Next w1 
If ShTag Then 
For Each w1 In Worksheets 
With w1 
If .ProtectContents Then 
On Error Resume Next 
Do 'Dummy do loop 
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66 
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66 
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126 
.Unprotect Chr(i) & Chr(j) & Chr(k) & _ 
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ 
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) 
If Not .ProtectContents Then 
PWord1 = Chr(i) & Chr(j) & Chr(k) & Chr(l) & _ 
Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _ 
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n) 
MsgBox Application.Substitute(MSGPWORDFOUND2, _ 
"$$", PWord1), vbInformation, HEADER 
'leverage finding Pword by trying on other sheets 
For Each w2 In Worksheets 
w2.Unprotect PWord1 
Next w2 
Exit Do 'Bypass all for...nexts 
End If 
Next: Next: Next: Next: Next: Next 
Next: Next: Next: Next: Next: Next 
Loop Until True 
On Error GoTo 0 
End If 
End With 
Next w1 
End If 
MsgBox ALLCLEAR & AUTHORS & VERSION & REPBACK, vbInformation, HEADER 
End Sub

点击保存
点击开发工具,宏,找到我们刚才录制的宏,点击执行宏

而后,在弹出的所有对话框上,都点击确定,都确定,1分钟后,就可以编辑了

本方法仅适用于2007-2016,2003版本没有开发工具

修复win10 F8无法进入安全模式的方法

2019年3月1日 没有评论

windwos的操作系统中一个模式叫做安全模式,很多无法在开机时修复的故障或是设置都可以进入到安全模式中处理。小编最近在使用win10系统的时候经常会遇到这样的情况,关机重启之后按下F8按钮电脑不会有任何的反应,依旧是正常的开机,无法打开系统中的安全模式,这是什么回事呢?大家在遇到这样的故障是不用太过担心,我们使用一个命令语句就可以解决这个问题。

随后将下面的代码复制粘贴进去,然后按下回车键进行执行!

  bcdedit set {default} bootmenupolicy legac

等待系统自动执行完毕之后大家可以重新关闭电脑,此时再次使用F8按键就可以进入到安全模式中去了!PS:有的用户担心错过按下F8的机会,可以一直连续点击,这样就可以进入到提示界面了!

宝塔面板安装好后,默认ip访问的那个html页面在哪个文件夹?

2019年2月13日 没有评论

宝塔面板很好用。大家都知道不过有些默认的选择项目也给大家说一下。

宝塔面板ip地址默认访问页在此目录下(默认安装的是NMP环境就在如下路径中)
/www/server/nginx/html/

删除掉index.html或是改名不就可以不用出现访问ip地址时的尴尬了。因为别人一看就知道你是哪个面板了。