Linux命令
查看centos版本:cat /etc/redhat-release
查看服务及状态:systemctl list-unit-files --type=service
查看已安装软件包:yum list installed
查看网线连接状态:cat /sys/class/net/eth0/operstate
查看网卡连接状态:ethtool eth0 | grep detected
查看centos版本:cat /etc/redhat-release
查看服务及状态:systemctl list-unit-files --type=service
查看已安装软件包:yum list installed
查看网线连接状态:cat /sys/class/net/eth0/operstate
查看网卡连接状态:ethtool eth0 | grep detected
vi /etc/systemd/system/obtain-ipv6.service
[Unit]
Description=Auto Obtain IPV6 Address
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/obtain-ipv6.sh start
ExecStop=/usr/bin/obtain-ipv6.sh stop
ExecReload=/usr/bin/obtain-ipv6.sh reload
[Install]
WantedBy=multi-user.target
systemctl enable obtain-ipv6.service
vi /usr/bin/obtain-ipv6.sh
#!/bin/bash
if [ $1 == "start" ];then
dhclient -6 ens3
elif [ $1 == "STOP" ];then
dhclient -6 -r
elif [ $1 == "reload" ];then
dhclient -6 -r
dhclient -6 ens3
fi
chmod u+x /usr/bin/obtain-ipv6.sh
修改主题下的index.php
将如下代码放在$this->need('header.php');后
/** 文章置顶 */
$sticky = '1'; //置顶的文章id,多个用|隔开
if($sticky){
$sticky_cids = explode('|',$sticky); //分割文本
$db = Typecho_Db::get();
$pageSize = $this->options->pageSize;
$select1 = $this->select()->where('type = ?', 'post');
$select2 = $this->select()->where('type = ? && status = ? && created < ?', 'post','publish',time());
//清空原有文章的列队
$this->row = [];
$this->stack = [];
$this->length = 0;
$order = '';
foreach($sticky_cids as $i => $cid) {
if($i == 0) $select1->where('cid = ?', $cid);
else $select1->orWhere('cid = ?', $cid);
$order .= " when $cid then $i";
$select2->where('table.contents.cid != ?', $cid); //避免重复
}
if ($order) $select1->order('', "(case cid$order end)"); //置顶文章的顺序 按 $sticky 中 文章ID顺序
if ($this->_currentPage == 1) foreach($db->fetchAll($select1) as $sticky_post){ //首页第一页才显示
$sticky_post['sticky'] = $sticky_html;
$this->push($sticky_post); //压入列队
}
$uid = $this->user->uid; //登录时,显示用户各自的私密文章
if($uid) $select2->orWhere('authorId = ? && status = ?',$uid,'private');
$sticky_posts = $db->fetchAll($select2->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize));
foreach($sticky_posts as $sticky_post) $this->push($sticky_post); //压入列队
$this->setTotal($this->getTotal()-count($sticky_cids)); //置顶文章不计算在所有文章内
}
#include <stdio.h>
//351302984184056
#define IMEI "35130298418405"
int getIMEICheckDigit(char *imei)
{
int i, sum1 = 0, sum2 = 0, temp, result = 0;
for (i = 0; i < 14; i++) {
if (i % 2 == 0) {
//奇数位和
sum1 += imei[i] - '0';
} else {
//偶数位乘2 个位十位和
temp = (imei[i] - '0') * 2;
sum2 += temp;
if (temp >= 10) {
sum2 -= 9;
}
}
}
temp = (sum1 + sum2) % 10;
if (temp != 0) {
result = 10 - temp;
}
return result;
}
int main(int argc, char *agrv[])
{
printf("IMEI %s check digit is %d\n", IMEI, getIMEICheckDigit(IMEI));
return 0;
}
计算->实例->实例详细信息->附加的VNIC->VNIC详细信息->IPv4地址->编辑->临时公共IP->更新