分类目录归档:折腾

油猴读取国开形考回顾答案

现在在国家开放大学上学习,面对形考任务的时候,一是要靠对教材的认真学习,二要靠搜索引擎。但是我发现在搜索引擎上绝大部分的参考答案的文档都要付费,感觉有点不开心。于是在自己完成部分考试后,对开考回顾的页面进行脚本采集,在控制台直接打到markdown格式的文本,然后进行分享。

分享的目的不是为了抄答案,而是在以答题的形式的过程中,提供相对正确的参考,帮助学习。

// ==UserScript==
// @name         国开回顾
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://chengdu.ouchn.cn/mod/quiz/review.php?attempt=*&cmid=*
// @icon         https://www.google.com/s2/favicons?domain=ouchn.cn
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var res = "";

    $(".que").each(function(){
        var que = $(this);
        var bt = que.find(".info .no").text();
        res += "\n";
        res += "\n";
        if(bt.indexOf("信息")<0){
            res += bt+" ";
        } else {
         res += "## ";
        }
        que.find(".formulation").each(function(){
            var _this = $(this);
            var qtext = _this.find(".qtext");
            var prompt = _this.find(".prompt");
            var answer = _this.find(".answer");

            if(qtext.length>0) {
                res += qtext.text();
                res += "\n";
            }
            if(prompt.length>0) {
               // res += prompt.text();
               // res += "\n";
            }

            if(answer.length>0){
                answer.children().each(function(){
                    var cc = $(this);
                    if(cc.hasClass("correct")){
                        res += "<span style='color:red'>"+cc.text()+"</span>";
                        res += "\n";
                    } else {
                        res += cc.text();
                        res += "\n";
                    }
                });
            }

        });
    });


    console.log(res);
})();

postman发送时间戳和MD5加密

主要是在Pre-request Script中预处理一下

var ak = "2f567a1b";
var sk = "4a134596";
var time = Math.round(new Date().getTime());
var pageindex = 1;
var pagesize = 10;

//待加密明文
var str = ak+";"+sk+";"+time+";?pageindex="+pageindex+"&pagesize="+pagesize+";"
//MD5加密
var token = CryptoJS.MD5(str).toString();

// 设置全局变量
pm.environment.set("ak",ak);
pm.environment.set("sk", sk);
pm.environment.set("time", time);
pm.environment.set("pageindex", pageindex);
pm.environment.set("pagesize", pagesize);
pm.environment.set("token", token);

URL的正则表达式

今天用简悦编辑自定义站点,遇到需要通过js正则表达式来匹配url地址的情况,简单记录一下。

var pattern = /http:\/\/chengdu.ouchn.cn\/course\/view.php\?id=\d+&sectionid=\d+&mid=\d+/

var url = "http://chengdu.ouchn.cn/course/view.php?id=3207&sectionid=125235&mid=358559";

console.log(pattern.test(url));

升级win11

升级win11下载了2个软件

  • WindowsPCHealthCheckSetup.msi 用于检测当前电脑是否可以升级win11
  • Windows11InstallationAssistant.exe win11在线安装程序

检测我的台式的时候,TPM没有开,secureboot没有开。

进入bios,开启TPM,开启secureboot,重启电脑,无法进入win10操作系统。原因是以前是用u盘在legacy模式下安装的。解决方案:

关闭secureboot,

  1. 用U盘安装微PE:http://www.wepe.com.cn/
  2. 进入微PE系统,通过【分区助手】助手,把现有的系统盘转成GPT格式;
  3. 使用【DiskGenius】在系统盘上创建【ESP/MSR分区】,并给它一个新的盘符;(我是压缩了C盘,空了500M给新的分区)
  4. 使用【UEFI引导修复】,选择刚刚建好的【ESP/MSR分区】,选择C盘(原win10系统所在盘),然后修复。

开启secureboot,顺利进入win10操作系统。

双击Windows11InstallationAssistant.exe,开始安装win11,安装过程傻瓜化,耗时稍稍有点久。

安装完成后,不想再回到win10,所以删除C盘的老win10文件。
C盘属性-常规-磁盘清理-清理系统文件(第一次打开可能需要较长时间)-选择以前的Windows安装,确定即可。

参考:https://tieba.baidu.com/p/7428783856
参考:https://www.zhihu.com/question/33611980

官方检测程序:https://aka.ms/GetPCHealthCheckApp
官方安装程序:https://www.microsoft.com/zh-cn/windows/get-windows-11

群晖openvpn

下载

国行已无法下载openserver,上英文网站下载安装包

https://www.synology.com/en-global/support/download
  1. 选择自己型号的nas
  2. 在Packages中找到VPN Server
  3. 下载对应的版本

继续阅读