北极熊的窝


残念だな

小爱课程表导入(正方教务)

0 条评论 无标签 雷蒙

最近给学校的教务系统适配了下小爱课程表的导入,暂时没发现什么问题。学校的教务是正方的,同样正方的教务可以看看

如果你有兴趣,点击这里加入小爱课程表的开发,适配你的学校(2020.6.12更新)

这里是官方的开发文档。需要你做的只有两个Javascript文件,前一个Provider基本通用,而Parser需要自己修改。

function scheduleHtmlParser(html) {
    let result = []
    let courses = $('td').has('br')
    for (let u = 0; u < courses.length; u++) {
        let re = {sections: [], weeks: []}

        re.position = courses[u].children[0].next.children[0].next.children[0].next.children[0].data
        re.teacher = courses[u].children[0].next.children[0].next.children[0].data
        re.name = courses[u].children[0].data

        let week = courses[u].children[0].next.children[0].data
        if (week) {
            let weekChinese = week.split('第')[0]
            switch (weekChinese) {
                case "周一": {
                    re.day = 1;
                    break;
                }
                case "周二": {
                    re.day = 2;
                    break;
                }
                case "周三": {
                    re.day = 3;
                    break;
                }
                case "周四": {
                    re.day = 4;
                    break;
                }
                case "周五": {
                    re.day = 5;
                    break;
                }
                case "周六": {
                    re.day = 6;
                    break;
                }
                case "周日": {
                    re.day = 7;
                    break;
                }
                default : {
                    re.day = null;
                    break;
                }
            }



            let weekString1 = week.split('第')[2]
            let weekString2 = weekString1.split('周')[0]
            let weekString3 = weekString2.split('-')
            if (week.search('单')!==-1) {
                if (weekString3[0] / 2 !== 1) {
                    for (let i = Number(weekString3[0]); i <= Number(weekString3[1]); i += 2)
                        re.weeks.push(i)
                } else if (weekString3[0] / 2 === 1) {
                    for (let i = Number(weekString3[0]) + 1; i <= Number(weekString3[1]); i += 2)
                        re.weeks.push(i)
                }
            } else if (week.search('双')!==-1) {
                if (weekString3[0] / 2 === 1) {
                    for (let i = Number(weekString3[0]); i <= Number(weekString3[1]); i += 2)
                        re.weeks.push(i)
                } else if (weekString3[0] / 2 !== 1) {
                    for (let i = Number(weekString3[0]) + 1; i <= Number(weekString3[1]); i += 2)
                        re.weeks.push(i)
                }
            } else {
                for (let i = Number(weekString3[0]); i <= Number(weekString3[1]); i++)
                    re.weeks.push(i)
            }

            let courseString1 = week.split('第')[1]
            let courseString2 = courseString1.split('节')[0]
            if (courseString2.length === 1)
                re.sections.push({section: courseString2[0]})
            else {
                let courseString3 = courseString2.split(',')
                for (let i = 0; i < courseString3.length; i++)
                    re.sections.push({section: courseString3[i]})
            }

        }
        result.push(re)
        if (courses[u].children[0].next.children[0].next.children[0].next.children[0].next!==null){
            let re2 = {sections: [], weeks: []}
            re2.position = courses[u].children[0].next.children[0].next.children[0].next.children[0].next.children[0].children[0].next.children[0].next.children[0].next.children[0].data
            re2.teacher = courses[u].children[0].next.children[0].next.children[0].next.children[0].next.children[0].children[0].next.children[0].next.children[0].data
            re2.name = courses[u].children[0].next.children[0].next.children[0].next.children[0].next.children[0].children[0].data

            let week2 = courses[u].children[0].next.children[0].next.children[0].next.children[0].next.children[0].children[0].next.children[0].data

            if (week2) {
                let weekChinese2 = week2.split('第')[0]
                switch (weekChinese2) {
                    case "周一": {
                        re2.day = 1;
                        break;
                    }
                    case "周二": {
                        re2.day = 2;
                        break;
                    }
                    case "周三": {
                        re2.day = 3;
                        break;
                    }
                    case "周四": {
                        re2.day = 4;
                        break;
                    }
                    case "周五": {
                        re2.day = 5;
                        break;
                    }
                    case "周六": {
                        re2.day = 6;
                        break;
                    }
                    case "周日": {
                        re2.day = 7;
                        break;
                    }
                    default : {
                        re2.day = null;
                        break;
                    }
                }
            }
            let weekString4 = week2.split('第')[2]
            let weekString5 = weekString4.split('周')[0]
            let weekString6 = weekString5.split('-')
            if (week2.search('单')!==-1) {
                if (Number(weekString6[0]) / 2 !== 1) {
                    for (let i = Number(weekString6[0]); i <= Number(weekString6[1]); i += 2)
                        re2.weeks.push(i)
                } else if (Number(weekString6[0]) / 2 === 1) {
                    for (let i = Number(weekString6[0]); i <= Number(weekString6[1]); i += 2)
                        re2.weeks.push(i)
                }
            } else if (week2.search('双')!==-1) {
                if (Number(weekString6[0]) / 2 === 1) {
                    for (let i = Number(weekString6[0]); i <= Number(weekString6[1]); i += 2)
                        re2.weeks.push(i)
                } else if (Number(weekString6[0]) / 2 !== 1) {
                    for (let i = Number(weekString6[0]) + 1; i <= Number(weekString6[1]); i += 2)
                        re2.weeks.push(i)
                }
            } else {
                for (let i = Number(weekString6[0]); i <= Number(weekString6[1]); i++)
                    re2.weeks.push(i)
            }

            let courseString4 = week2.split('第')[1]
            let courseString5 = courseString4.split('节')[0]
            if (courseString5.length === 1)
                re2.sections.push({section: courseString2[0]})
            else {
                let courseString6 = courseString5.split(',')
                for (let i = 0; i < courseString6.length; i++)
                    re2.sections.push({section: courseString6[i]})
            }
            result.push(re2)
        }
    }
    console.log(result)
    return {courseInfos: result}
}

RSA密钥算法

0 条评论 无标签 雷蒙
  1. 选两个保密的大素数 p,q(p≠q)
  2. 计算 n=p×qφ(n)=(p-1)(q-1) ,其中 φ(n)n 的欧拉函数值;
  3. 选一整数 e ,满足 1<e<φ(n) ,且 gcd(φ(n),e)=1
  4. 计算d满足 d·e≡1modφ(n) ,即 de 在模 φ(n) 下的乘法逆元,因 eφ(n) 互素,由模运算可知,它的乘法逆元一定存在;
  5. {c,n} 为公钥, {d,n} 为私钥。

HTC Wildfire S G13 Latest TWRP and Cyanogenmod 9 Backup

0 条评论 记录 Android 雷蒙

最后一个版本的TWRP
twrp-2.3.3.0-marvel.img
CM来源于XDA
cm-9.1.0-CRYPTOMILK-ALPHA9-marvel.zip
以及刷机工具Flashify
Flashify_1.6.7.apk(最低Android2.3)
Flashify_1.9.2.apk(最低Android4.0,最新版)
还有Via浏览器(最低Android2.3)


解决博客引入哔哩哔哩视频时无法自适应窗口大小的问题

0 条评论 无标签 雷蒙

使用哔哩哔哩官方提供的代码插入视频时,视频窗口会变得非常非常小