2023年11月

查看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)); //置顶文章不计算在所有文章内
}

DateTimeDistanceAvg. Pace
2023-10-1105:58-06:245KM5'07"
2023-10-1306:05-06:305KM4'51"
2023-10-1406:19-06:425KM4'45"
2023-10-1506:44-07:5915KM4'57"
2023-10-1706:12-06:365KM4'50"
2023-10-1906:37-07:025KM4'52"
2023-10-2006:18-06:425KM4'54"
2023-10-2306:00-06:245KM4'52"
2023-10-2606:02-06:265KM4'46"
2023-10-3006:12-06:365KM4'48"
2023-11-305:28-05:535KM5'00"
2023-11-508:04-09:5021KM5'00"
2023-11-2305:54-06:165KM4'28"
2023-11-2405:43-06:065KM4'39"
2023-11-2606:18-07:0510KM4'44"
2023-12-606:22-06:445KM4'29"
2023-12-1007:03-07:5010KM4'44"
2023-12-1306:29-06:515KM4'25"
2024-1-106:16-07:0310KM4'43"
2024-1-609:06-10:1311.8KM5'27"
2024-1-2709:34-10:4011.74KM5'23"
2024-2-1216:39-17:045KM4'49"
2024-3-618:39-19:4711KM6'12"
2024-3-2309:02-10:1211.77KM5'48"
2024-4-205:47-06:125KM4'59"
2024-4-1605:48-06:125KM4'51"
2024-6-1905:38-06:035KM5'03"
2024-6-2505:49-06:145KM4'57"
2024-6-2705:51-06:155KM4'47"
2024-7-505:56-06:195KM4'42"
2024-7-905:50-06:145KM4'56"
2024-7-1005:44-06:105KM5'18"
2024-7-1505:57-06:215KM4'47"
2024-7-1705:49-06:145KM4'56"
2024-7-1905:42-06:065KM4'51"
2024-7-2205:58-06:235KM4'58"
2024-7-2505:58-06:215KM4'40"
2024-8-404:51-05:165KM4'55"
2024-8-605:45-06:095KM4'46"
2024-8-805:56-06:195KM4'46"
2024-8-1505:55-06:205KM4'56"
2024-8-2005:39-06:045KM4'46"
2024-8-2205:59-06:245KM4'56"
2024-8-2406:55-08:1211KM6'09"
2024-8-3121:25-21:525KM5'04"
2024-9-205:49-06:155KM4'53"
2024-9-905:47-06:125KM4'59"
2024-9-1305:24-05:495KM5'01"
2024-9-1405:44-06:125KM5'12"
2024-9-2605:53-06:185KM4'55"
2024-9-2705:35-06:005KM4'55"
2024-9-2905:55-06:195KM4'42"
2024-9-3005:12-05:365KM4'47"
2024-10-107:49-08:225KM6'10"
2024-10-1005:47-06:145KM5'22"
2024-10-1205:47-06:135KM5'03"
2024-10-1705:54-06:185KM4'56"
2024-10-2405:57-06:225KM4'59"
2024-10-2605:51-06:175KM5'07"
2024-10-3006:02-06:275KM5'07"
2024-10-3106:02-06:295KM5'13"
2024-11-405:57-06:235KM5'16"
2024-11-705:56-06:225KM5'08"
2024-11-916:04-17:1011KM5'40"
2024-11-1605:45-06:115KM5'06"

#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;
}