登录 立即注册

找到398个回复 (用户: 罐子)

罐子 11楼回复 童真再见有玩esp32的吗?买了个板子上传项目老是出错不知道是不是接线问题 (2023-03-05//)

@童真再见,可能是感觉是没有拉低短接点用万用表测一下,
一加8Pro

罐子 7楼回复 童真再见有玩esp32的吗?买了个板子上传项目老是出错不知道是不是接线问题 (2023-03-04//)

@胡图图,你是对的。这模块我有十多个。
一加8Pro

罐子 6楼回复 童真再见有玩esp32的吗?买了个板子上传项目老是出错不知道是不是接线问题 (2023-03-04//)

@童真再见
RX接TX
TX接RX
一加8Pro

罐子 5楼回复 童真再见有玩esp32的吗?买了个板子上传项目老是出错不知道是不是接线问题 (2023-03-04//)

@胡图图@童真再见,看图他的tx rx接错了。
一加8Pro

罐子 2楼回复 童真再见有玩esp32的吗?买了个板子上传项目老是出错不知道是不是接线问题 (2023-03-04//)

@童真再见,你在Arduino里面设置了串口的端口里没有
一加8Pro

罐子 1楼回复 咯叽【楼主删除了该帖】 (2023-03-04//)

@咯叽,哦噢
一加8Pro

罐子 10楼回复 听风念给Typora写了个上传图片到cos的脚本 (2023-02-28//)

@听风念,我不用,我最多只会使用minio
一加8Pro

罐子 3楼回复 511求推荐php对接微信订阅号 (2023-02-27//)

@老虎会游泳,其实我想利用chatgpt写出一个WXPusher差不多的程序。
一加8Pro

罐子 3楼回复 残缘[网页插件][更新] @提醒(1.0.4) (2023-02-25//)

@罐子
一加8Pro

罐子 21楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

@老虎会游泳,好
一加8Pro

罐子 20楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

@老虎会游泳,好的
一加8Pro

罐子 16楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

@老虎会游泳,未命名那个代码应该在自定义数据列表public_22里
一加8Pro

罐子 13楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

@老虎会游泳,我的有小尾巴选项
一加8Pro

罐子 12楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

hi

罐子 11楼回复 老虎会游泳为了解决ChatGPT小尾巴问题,通过SQL批量更新了大家的网页插件 (2023-02-21//)

@老虎会游泳,我的尾巴还在
一加8Pro

罐子 1楼回复 黑胡子银河麒麟V10自动注销怎么解决 (2023-02-20//)
罐子 12楼回复 罐子记录 (2023-02-20//)
// 聊天框的CSS选择器
const chatBoxSelector = 'textarea.w-full.p-0';

// 发送按钮的CSS选择器
const sendButtonSelector = 'button.absolute.p-1';

// 正在输入动效(取代发送按钮)的CSS选择器
const replyNotReadySelector = 'div.text-2xl';

// 聊天回答的CSS选择器
const chatReplySelector = 'div.markdown';

// 用户自身的虎绿林uid
const hu60MyUid = 19346; // 改成自己的uid

// 用户的虎绿林sid
const hu60Sid = '4JfOlTT3iHw58i1ITtpS0okksAAA';

// 带sid的虎绿林URL
const hu60BaseUrl = 'https://hu60.cn/q.php/' + hu60Sid + '/';

/////////////////////////////////////////////////////////////

// 发送聊天信息
function sendText(text) {
    let chatBox = document.querySelector(chatBoxSelector);
    let sendButton = document.querySelector(sendButtonSelector);

    chatBox.value = text;
    sendButton.click();
}

// 读取响应
function readReply() {
    let reply = Array.from(document.querySelectorAll(chatReplySelector)).at(-1);
    let lines = [];
    
    if (!reply.childNodes) {
        // 错误信息
        return reply.innerText;
    }

    reply.childNodes.forEach(x => {
        if (x.tagName == 'PRE') { // 代码
            lines.push("\n```\n" + x.querySelector('code').innerText + "\n```\n");
        } else { // 正文
            lines.push(x.innerText);
        }
    });

    return lines.join("\n\n");
}

// 判断响应是否结束
function isFinished() {
    return document.querySelector(replyNotReadySelector) == null;
}

// 读取@消息
async function readAtInfo() {
    let response = await fetch(hu60BaseUrl + 'msg.index.@.no.json?_origin=*&_content=json');
    return await response.json();
}

// 读取帖子内容
async function readTopicContent(path) {
    let url = hu60BaseUrl + path.replace('{$BID}', 'json').replace('?', '?_origin=*&_content=text&pageSize=1&');
    let response = await fetch(url);
    return await response.json();
}

// 回复帖子
async function replyTopic(uid, replyText, topicObject) {
    let content = "<!md>\n@#" + uid + "," + replyText;

    let url = null;
    if (topicObject.tMeta) { // 帖子
        url = 'bbs.newreply.'+encodeURIComponent(topicObject.tContents[0].topic_id)+'.json';
    } else { // 聊天室
        url = 'addin.chat.'+encodeURIComponent(topicObject.chatRomName)+'.json';
    }

    let formData = new FormData();
    formData.append('content', content);
    formData.append('token', topicObject.token);
    formData.append('go', '1');

    let response = await fetch(hu60BaseUrl + url + '?_origin=*', {
        body: formData,
        method: "post",
        redirect: "manual" // 不自动重定向
    });
    return response;
}

// 休眠指定的毫秒数
// 用法:await sleep(1000)
const sleep = ms => new Promise(r => setTimeout(r, ms));

// 回复@信息
async function replyAtInfo(info) {
    try {
        let uid = info.byuid;
        let url = info.content[0].url;
        let floor = url.split('#')[1];

        // 防止自己和自己对话
        if (uid == hu60MyUid || uid < 1) {
            return;
        }

        console.log(info);

        let topicObject = await readTopicContent(url);
        let text = null;
        if (topicObject.tContents) {
            text = topicObject.tContents[0].content;
        } else {
            text = topicObject.chatList[0].content;
        }
        
        sendText(text);

        do {
            await sleep(500);
        } while (!isFinished());

        let replyText = readReply();
        let response = await replyTopic(uid, replyText, topicObject);
        console.log(response);
    } catch (ex) {
        console.error(ex);
    }
}

// 运行机器人
async function run() {
    console.log('虎绿林ChatGPT机器人已启动');
    while (true) {
        try {
            // 浏览器用户可能直接输入了问题,等待回答完成
            if (!isFinished()) {
                do {
                    await sleep(500);
                } while (!isFinished());
            }

            let atInfo = await readAtInfo();
            console.log(new Date(), atInfo);
            for (let i=0; i<atInfo.msgList.length; i++) {
                await replyAtInfo(atInfo.msgList[i]);
            }
            await sleep(1000);
        } catch (ex) {
            console.error(ex);
        }
    }
}

run();

一加8Pro

罐子 2楼回复 5258公司押金不退 (2023-02-20//)

@5258,找当地工会
一加8Pro

罐子 5楼回复 罐子组装台式电脑预算7500以内 (2023-02-17//)

asecyv@mailto.plus
package main

//计算hex校验和
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)

func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum,
:= strconv.ParseInt(line[len(line)-2:], 16, 64) //

pattern := regexp.MustCompile(`.{2}`)
parts := pattern.FindAllString(line[1:len(line)-2], -1)

var nums []int
for _, p := range parts {
    num, _ := strconv.ParseInt(p, 16, 64)
    nums = append(nums, int(num))
}
newChecksum := 256 - reduce(nums)
if checksum == int64(newChecksum) {
    fmt.Println("校验和匹配,该行无需修改")
} else {
    fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum)
    fmt.Println("正确的行:")
    fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum)
}

}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}
func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}

This is a program written in Go to calculate the checksum of a given hex line and compare it to the last two digits of the input line. The program takes input from the user, removes whitespace characters, and extracts the last two digits as the expected checksum. Then, it extracts pairs of hex digits (two characters) from the remaining part of the input line and converts them to integers. The reduce function is called with the resulting list of integers as an argument, which recursively sums them and takes the result modulo 256. The calculated checksum is then compared to the expected checksum, and if they match, the program outputs that the line is correct. Otherwise, the program outputs the correct checksum and the modified line with the correct checksum appended at the end.

asecyv@mailto.plus
package main

//计算hex校验和
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)

func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum,
:= strconv.ParseInt(line[len(line)-2:], 16, 64) //

pattern := regexp.MustCompile(`.{2}`)
parts := pattern.FindAllString(line[1:len(line)-2], -1)

var nums []int
for _, p := range parts {
    num, _ := strconv.ParseInt(p, 16, 64)
    nums = append(nums, int(num))
}
newChecksum := 256 - reduce(nums)
if checksum == int64(newChecksum) {
    fmt.Println("校验和匹配,该行无需修改")
} else {
    fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum)
    fmt.Println("正确的行:")
    fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum)
}

}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}
func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
改下添加按任意键退出
Sure, you can modify the code to add a prompt for the user to press any key to exit the program. You can use the function to wait for the user to input any text before exiting the program. Here's an example:fmt.Scanln()

go
Copy code
package main

import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)

func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum,
:= strconv.ParseInt(line[len(line)-2:], 16, 64)

pattern := regexp.MustCompile(`.{2}`)
parts := pattern.FindAllString(line[1:len(line)-2], -1)

var nums []int
for _, p := range parts {
    num, _ := strconv.ParseInt(p, 16, 64)
    nums = append(nums, int(num))
}
newChecksum := 256 - reduce(nums)
if checksum == int64(newChecksum) {
    fmt.Println("校验和匹配,该行无需修改")
} else {
    fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum)
    fmt.Println("正确的行:")
    fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum)
}
fmt.Println("按任意键退出...")
fmt.Scanln()

}

func reduce(nums []int) int {
return reduceHelper(nums, 0)
}

func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
With this modification, the program will wait for the user to press any key before exiting.

asecyv@mailto.plus
fmt.Scanln()只能算是按回车键退出,不算是任意键退出
You are correct, waits for the user to input a complete line, which usually requires pressing the Enter key. If you want to wait for the user to press any key, you can use a platform-specific package like to read a single key without waiting for Enter to be pressed. Here's an example that uses this package to wait for the user to press any key:fmt.Scanln()github.com/eiannone/keyboard

go
Copy code
package main

import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"

"github.com/eiannone/keyboard"

)

func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum,
:= strconv.ParseInt(line[len(line)-2:], 16, 64)

pattern := regexp.MustCompile(`.{2}`)
parts := pattern.FindAllString(line[1:len(line)-2], -1)

var nums []int
for _, p := range parts {
    num, _ := strconv.ParseInt(p, 16, 64)
    nums = append(nums, int(num))
}
newChecksum := 256 - reduce(nums)
if checksum == int64(newChecksum) {
    fmt.Println("校验和匹配,该行无需修改")
} else {
    fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum)
    fmt.Println("正确的行:")
    fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum)
}
fmt.Println("按任意键退出...")
keyboard.GetSingleKey()

}

func reduce(nums []int) int {
return reduceHelper(nums, 0)
}

func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
In this example, we use the function from the package to wait for the user to press any key before exiting. Note that this package may not work on all platforms, so you should check the documentation and test the program on the platforms you plan to use it on.GetSingleKey()github.com/eiannone/keyboard
一加8Pro

罐子 4楼回复 罐子组装台式电脑预算7500以内 (2023-02-17//)

C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
一加8Pro

下一页 上一页 (6 / 20页)

12月12日 21:14 星期四

本站由hu60wap6华为CPU驱动

备案号: 京ICP备18041936号-1