• By not providing "FindQt6.cmake" in CMAKE

    编译wireshark报错
    ```c
    root@jungle:/home/jungle/code/wireshark/builds# cmake ..
    — Generating build using CMake 3.28.3
    — Using “Unix Makefiles” generator and build type “RelWithDebInfo”
    — LTO/IPO is not enabled
    — V: 4.4.2, MaV: 4, MiV: 4, PL: 2, EV: .
    — Linker flags: -Wl,—as-needed
    — Found LIBSSH: /usr/lib/x86_64-linux-gnu/libssh.so (found suitable version “0.10.6”, minimum required is “0.8.5”)
    — Checking for one of the modules ‘libpcap’
    — Could NOT find PCAP (missing: PCAP_LIBRARY PCAP_INC…

    4.1k 0
    HappyOJ 发布于 3 个月前
  • 搜索引擎和SEO带来的假流量,需要robots屏蔽掉

    最近半年的公网出流量MB,可见上周出现异常日均增长到40G+,导致流量超过阈值,服务停机
    1728141531448.png
    1728141687333.png
    于是只能增加robots.txt协议控制:

    ```c
    User-agent:
    Disallow: /profile/
    Disallow: /problemset/status/
    Disallow: /problemset/
    /status/
    Disallow: /problemset/standings/
    Disallow: /contest/
    Disallow: /api/
    Disallow: /admin/

    User-agent: SemrushBot
    User-agent: MJ12bot
    User-a…

    6.3k 0
    HappyOJ 发布于 5 个月前
  • libyang接口使用

    libyang学习:主要是为了学习如何将yang模型data path 转化为schema path。

    背景:最近在做一个yang的gtest配置下发测试工具时,遇到yang模型xpath带choice case时(参见文章后面的yang模型):
    data path不带choice case节点,如:/acme-system:system/food/tea
    schema path是带的,如:/acme-system:system/food/snack/late-bight/tea
    导致业务基于schema path注册回调函数时,基于data path数据注入时找不到回调函数,所以需要做一次转换,以便能够给予path找到回调函数。

    思路:从data path获取 lysc_node,再从 lysc_node 获取schema path。
    ```c

    1. LY_ERR ret = LY_SUCCESS;
    2. struct ly_ctx *ctx = NULL;
    3. const struct lys_module *module;
    4. // 初始化libyang上下文
    5. r...
    35.6k 0
    HappyOJ 发布于 7 个月前
  • Cisco CloudSec

    The virtue of MACSec paired with the requirements of Confidentiality, Integrity, and Availability (CIA) results in CloudSec. In essence, CloudSec is MACSec-in-UDP using Transport Mode, similar to ESP-in-UDP in Transport Mode as described in RFC3948. In addition to the specifics of transporting MACSec encrypted data over IP networks, CloudSec also carries a UDP header for entropy as well as an encrypted payload for Network Virtualization use-cases.
    ![1719759436850.png](/upload/image/20240630/2024…

    49.5k 0
    HappyOJ 发布于 9 个月前
  • Arista’s TunnelSec
    • TunnelSec
      Arista’s TunnelSec technology addresses each of these encryption use-cases by providing line-rate hardware based 10G to 400G encryption, embedded within the R3 series routing platforms with support for IPsec, MACsec and an innovative new VXLANsec solution.
    1. MACsec
      MACsec is performed at the interface (MAC layer) level on the platform, where security keys are exchanged with the neighboring node of the link, resulting in all data beyond the initial Ethernet header being fully en…
    49.6k 0
    HappyOJ 发布于 9 个月前
  • vbox Ubuntu无界面动态扩展磁盘空间

    问题:磁盘创建时时动态扩展方式,现在空间已经不足,却没有自动扩展生效磁盘空间

    1714828168094.png

    查询当前磁盘情况,显示实际只有19G

    ```
    root@jungle:~# df -h
    Filesystem Size Used Avail Use% Mounted on
    tmpfs 391M 2.5M 389M 1% /run
    /dev/mapper/ubuntu—vg-ubuntu—lv 19G 16G 2.2G 88% /
    tmpfs 2.0G 0 2.0G 0% /dev/shm
    tmpfs 5.0M 0 5.0M 0% …

    54.9k 0
    Weizengke 发布于 11 个月前
  • Problem A + B

    略微有单简单

    1. #include
    2. int main(void)
    3. {
    4. int a,b;
    5. while(scanf("%d%d", &a,&b) != EOF)
    6. printf("%d\n",a+b);
    7. return 0;
    8. }
    55.2k 0
    Weizengke 发布于 11 个月前
  • python 使用telnetlib登陆telnet服务器

    ```python
    import telnetlib
    import time
    import logging
    import re
    import ipaddress
    from ipaddress import ip_address
    logging.basicConfig(format=’%(asctime)s - %(pathname)s - [line:%(lineno)d] - %(levelname)s: %(message)s’,
    level=logging.DEBUG)
    username = [‘0000000’, ‘huawei’,’root’,’huawei123’,’huawei1234’]
    password = [‘Root@123’,’Huawei@123’,’Huawei@1234’,’huawei@123’,’huawei@1234’,’Root@1234’]

    def contains_chars(s, chars):
    pattern = f”[{‘’.join(chars)}]”
    return bool(r…

    65.9k 0
    HappyOJ 发布于 1 年前
  • 你好,请问如何在Windows下架设WEB?

    大大你好,我是一个小白。
    应该是成功运行了kernel系统,但网站显示是一个Jar包,不知道如何启用网站。我瞎参照您的Ubuntu部署OJ网站,修改了一下运行代码,做了个bat文件

    java -Xms128m -Xmx512m -jar oj-2.0.4.jar —server.port=80 —server.redirect-https-enable=false —server.ssl.enabled=false —config.encode=utf-8 —config.judgerIp=127.0.0.1 —config.ojPath=/OJ/ —config.dataPath=/OJ/data/ —config.judgeLogPath=/OJ/logfile/judge_log/ —config.templatePath=/OJ/conf/code_template/ —config.configFile=/OJ/conf/config.json —spring.datasource.url=jdbc:mysql://127.0.0.1:3306/gdoj?useUnicod…

    67.1k 14
    bugwolf 发布于 1 年前  , 最后评论 (1 年前): ACSolo>>
  • Python + openCV去除图片中红色字体

    ```python
    import cv2
    import numpy as np

    class SealRemove(object):

    1. def remove_red_seal(self, image):
    2. # 获得红色通道
    3. blue_c, green_c, red_c = cv2.split(image)
    4. # 多传入一个参数cv2.THRESH_OTSU,并且把阈值thresh设为0,算法会找到最优阈值
    5. thresh, ret = cv2.threshold(red_c, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
    6. # 实测调整为95%效果好一些
    7. filter_condition = int(thresh * 0.95)
    8. nominator_thresh, red_thresh = cv2.threshold(red_c, filter_condition, 255, cv2.THRESH_BINARY)
    9. ...
    67.4k 1
    HappyOJ 发布于 1 年前  , 最后评论 (11 个月前): Weizengke>>
  • Github Copilot在代码检视内存泄漏上的能力

    我给了一个带出参的由内存申请的函数,它能够识别函数内没有泄漏,但是需要提醒我调用者有没有释放内存,还是不错。

    1702474521965.png

    然后我故意构造假的内存泄漏,中间加了return,他一开始没有发现问题,我再次询问后,它竟被我带歪了,(⊙﹏⊙)

    1702474784152.png

    然后我构造了一个真实存在内存泄漏的代码,它没能发现问题,由点失望。

    1702475609612.png

    我再次质疑它,它又反应过来了

    ![1702475727238.png](/upload/image/2…

    67.3k 0
    HappyOJ 发布于 1 年前
  • 使用Github Copilot辅助开发的一些感受

    我先选择了一段比较简单的代码,发现它给出的解释实际上就是代码本身自注释到的

    1702470653550.png

    我又选择了一段逻辑性比较强的代码,对cmd_match_command_integer函数进行提问,回答非常准确

    1702472384761.png

    对于自动补全的函数也能够准确解释cmd_complete_command

    1702472567513.png

    对于超过500行的代码,Copilot无法给出解释

    ![1702472726790.png](/upload/image/20…

    67.3k 0
    HappyOJ 发布于 1 年前
  • @Scheduled注解实现启动时延时60秒执行一次定时任务,后续按照cron定义的计划执行

    最近遇到一个问题,通过springboot Scheduled定时调度,在启动时就会执行定时任务,导致启动性能较差。
    代码如下:
    1)@PostConstruct 注解表示启动时就执行一次。
    2)@Scheduled(cron = “0 0 1,6,12,18,21 ?”) 注解表示按照每天1点/6点/12点/18点/21点执行一次

    1. @Component
    2. public class ContestCollectorSchedule {
    3. @PostConstruct
    4. @Scheduled(cron = "0 0 1,6,12,18,21 * * ?")
    5. private void contestCollectorTimer() {
    6. OJCollector.CollectContests();
    7. }
    8. }

    修改后方案如下:
    1)取消启动时执行注解
    2)增加一个调度器,第一次后延时60秒执行一次,后续按照一年执行一次
    这样可以达到启动时延时60秒执行,后续按照每天1点/6点/12点/18点/21点执行一次的效果

    ```…

    73.4k 0
    HappyOJ 发布于 1 年前
  • Springboot docker容器方式部署https站点,同时http自动重定向到https

    配置文件:
    1683955193277.png

    1. server:
    2. port: 8443
    3. redirect-https-port: 443 -----》由于我是用docker容器部署,所以这里重定向是主机端口号
    4. redirect-https-enable: true
    5. http-port: 8080
    6. ssl:
    7. key-store: classpath:happyoj.com.pfx
    8. key-store-password: 证书密码
    9. key-store-type: PKCS12

    代码中新增Redirect2HttpsConfig类执行重定向:

    ```java
    package com.oj.config;

    import lombok.extern.slf4j.Slf4j;
    import org.apache.catalina.Context;
    import org…

    73.2k 0
    HappyOJ 发布于 1 年前
  • Judger Kernel 配置文件

    ```json
    {
    “system”: {
    “startup_config”: “config.cfg”,
    “sysname”: “Judge-Kernel”,
    “JudgePath”: “judger.exe”,
    “sock_port”: 5000
    },

    1. "judger": {
    2. "WorkingPath": "temp/",
    3. "JudgeLogPath": "logfile/judge_log/",
    4. "judge_logbuf_size": 500,
    5. "DataPath": "data",
    6. "DeleteTemp": 1,
    7. "LimitJudge": 2000001
    8. },
    9. "mysql": {
    10. "url": "172.17.0.1",
    11. "username": "xxx",
    12. "password": "pwd",
    13. "tabl...
    73.6k 0
    ACSolo 发布于 1 年前
  • springboot 写文件中文乱码,统一配置utf-8

    解决中文乱码,统一配置utf-8:

    1. public static boolean write(String fileName, String content) {
    2. try {
    3. Writer out = new OutputStreamWriter(new FileOutputStream(fileName),"UTF-8");
    4. out.write(content);
    5. out.flush();
    6. out.close();
    7. return true;
    8. } catch (IOException ioe) {
    9. ioe.printStackTrace();
    10. return false;
    11. }
    12. }
    73.3k 0
    ACSolo 发布于 1 年前
1 2 3