2021年4月

使用systemctl来控制启动

sudo vim /lib/systemd/system/frps.service

在frps.service里写入以下内容

[Unit]
Description=fraps service
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/root/frp/frps -c /root/frp/frps.ini

[Install]
WantedBy=multi-user.target

将以下代码添加到functions.php中即可:

//后台登陆数学验证码
function myplugin_add_login_fields() {
    //获取两个随机数, 范围0~10,可以自行更改为更大或更小数字
    $num1=rand(0,10);
    $num2=rand(0,10);
    //最终网页中的具体内容
        echo "<p><label for='math' class='small'>验证码</label><br /> $num1 + $num2 = ?<input type='text' name='sum' class='input' value='' size='25' tabindex='4'>"
    ."<input type='hidden' name='num1' value='$num1'>"
    ."<input type='hidden' name='num2' value='$num2'></p>";
    }
    add_action('login_form','myplugin_add_login_fields');
function login_val() {
    $sum=$_POST['sum'];//用户提交的计算结果
    switch($sum){
    //得到正确的计算结果则直接跳出
    case $_POST['num1']+$_POST['num2']:break;
    //未填写结果时的错误讯息
    case null:wp_die('错误: 请输入验证码.');break;
    //计算错误时的错误讯息
    default:wp_die('错误: 验证码错误,请重试.');
    }
    }
    add_action('login_form_login','login_val');

斐讯N1刷linux后经常报错
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

Read-only file system

这是系统无法写入文件导致报错,根据排查应该是有坏道导致的,修复方法只需要运行下面命令后重启N1就行了

e2fsck /dev/mmcblk1p2

注意:mmcblk1p2 是你的磁盘挂载的路径名称,如果你的名称不是这个请根据情况修改

本来准备直接yum install golang或者yum install go, 执行命名后,发现没有这个包。于是只能先添加源,然后在使用命令行安装了。

Install on CentOS: 
Current version: 1.11
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
        


Install on Fedora: 
Current version: 1.11
rpm --import https://mirror.go-repo.io/fedora/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
        


Example $GOPATH setup:
mkdir -p ~/go/{bin,pkg,src}
echo 'export GOPATH="$HOME/go"' >> ~/.bashrc
echo 'export PATH="$PATH:${GOPATH//://bin:}/bin"' >> ~/.bashrc
        


Unstable (Pre-release) Packages
Current version: 1.11rc2 

CentOS:
rpm --import https://mirror.go-repo.io/centos-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golang
        

Fedora:
rpm --import https://mirror.go-repo.io/fedora-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golang