作者 herokay 发布的文章

2019年宁夏中小学幼儿园教师全员岗位培训继续教育网络培训挂机

Tampermonkey脚本

// ==UserScript==
// @name         国培计划挂机
// @namespace    http://herokay.cn/
// @version      0.1
// @description  try to take over the world!
// @author       herokay
// @match        http://nxgp2019.w.px.teacher.com.cn/home/student/*/course/learn/*
// @grant        none
// @require      file:///D:/ocrad.js
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    window.alert = function(txt)
    {
        console.info(txt);
    }
    function recognize_image()
    {
        OCRAD(document.getElementById("pxCheckCode"), {
            numeric: true
        }, function(text){
            $('#inputvalcode1').val(text);
            console.info( text);
            $('#comfirmButtonTo').click();
        })
    }
    function run()
    {
        // recognize_image() ;
        //console.info(TimeNum);

        if(TimeNum>600)
        {
            if( $('#btn_min').attr('class')=='max')
            {
                btnOclick();
                setTimeout("$('#inputvalcode1').click();",5000);
            }
            else
            {
                setTimeout("$('#inputvalcode1').click();",5000);
            }
            if($("#pxCheckCode").is(":visible"))
            {
                recognize_image();
            }
        }
    }
    setInterval(run, 10000);
})();

将ocrd.js文件放入D盘根目录
Tampermonkey插件设置为可访问本地文件

ocrad.zip

树莓派Nginx + PHP7.3 + mysql


在 Pi 的终端运行以下命令

sudo apt-get update
php扩展可以一个一个安装,缺哪个按如下方式安装即可
sudo apt-get install php7.3-fpm php7.3-cli php7.3-curl php7.3-gd php7.3-cgi
sudo apt-get install php7.3-mysqli
sudo service php7.3-fpm restart

sudo apt-get install nginx
sudo service nginx start

修改nginx配置

sudo nano /etc/nginx/sites-available/default

重启nginx
sudo service nginx restart

安装mysql

sudo apt install mariadb-server
mysql添加用户密码
create user pi@localhost identified by 'raspberry';
grant all privileges on *.* to pi@localhost identified by 'raspberry';
flush privileges; 

参考:http://shumeipai.nxez.com/2018/04/25/install-pi-dashboard-with-nginx-php7-on-pi.html

教育资源公共服务平台验证码识别

只做理论分析,不发实际代码。请勿用于商业用途

验证码的识别一般也就几个步骤:降噪,修正扭曲,二值化,分割,识别。
对于教育资源公共服务平台的验证码,仔细区分研究的话过程没这么复杂。

一、几大特点

1.数字全是红色

2.只有加法

3.数字始终一种字体字号

4.结果提示用白色

5.未做扭曲处理

二、识别方法

1.提取数字,按坐标及颜色提取四个数字的图像

方式:□□+□□=?

2.生成四副图像的特征码和标准结果对比

3.输出计算结果

zw.gif

Typecho插件开发采坑手记(一)

记录踩过的第一个坑addRoute
 /**
 * 增加路由
 *
 * @access public
 * @param string $name 路由名称
 * @param string $url 路由路径
 * @param string $widget 组件名称
 * @param string $action 组件动作
 * @param string $after 在某个路由后面
 * @return integer
 */
public static function addRoute($name, $url, $widget, $action = NULL, $after = NULL)
{
}

一、添加路由

在Plugin.php中找到public static function activate(),添加addRoute

public static function activate()
{
    Helper::addRoute('wx', '/wx', 'WxAssistant_Action', 'action');
    return ('微信助手已经成功激活,请进入设置Token!');
}

二、注销路由

在Plugin.php中找到public static function deactivate(),添加removeRoute

public static function deactivate()
{
    Helper::removeRoute('wx');
}

三、测试路由

浏览器输入http://www.{你的域名>}/index.php/wx
例如:http://127.0.0.1/typecho/index.php/wx

四、坑

addRoute('wx', '/wx', 'WxAssistant_Action', 'action');
第一个参数:路由名称
第二个参数:路由地址
第三个参数:组件名称
第四个参数:组件相应名称(名称千万不要叫index

VBA对话框批量添加按钮

说明:这篇不是原创内容,来自ExcelHome。时间长了也忘了具体网址了,这里摘录下来方面以后查找。

1.插入一个类模块,命名为MyCla,代码如下:

Public WithEvents Butt As MSForms.CommandButton
Private Sub Butt_Click()
    Dim x, y As Integer  
    strs = Split(Butt.Tag, "|")
    x = strs(0)
    y = strs(1)
End Sub

2.插入一个用户窗体UserForm1,代码如下:

Private Sub UserForm_Initialize()
    Dim i, j As Integer
    '画按钮,默认隐藏
    For i = 0 To MAPHEIGHT - 1 '行
        For j = 0 To MAPWIDTH - 1 '列
            Set buttons(i, j).Butt = UserForm1.Controls.Add("Forms.Commandbutton.1")
            With buttons(i, j).Butt
                .Caption = ""
                .Height = 18
                .Width = 18
                .Tag = i & "|" & j
                .PicturePosition = 12
                .Visible = False
                '.Caption = i & j
                If i = 0 Then
                    .Top = 10
                Else
                    .Top = buttons(i - 1, j).Butt.Top + 18
                End If
                If j = 0 Then
                    .Left = 150
                Else
                    .Left = buttons(i, j - 1).Butt.Left + 18
                End If
            End With
        Next
    Next
End Sub

效果图: