博客

  • pve安装windows 7

    • 创建虚拟机




    • 安装补丁
      如果不安装基本的补丁的话驱动和自动更新都不能用
      依次安装以下补丁:
      windows6.1-kb4474419
      Windows6.1-KB3135445
      windows6.1-kb3125574
      Windows6.1-KB3102810
      Windows6.1-KB3020369
      windows6.1-kb2533552
      安装好后再执行
      LegacyUpdate-1.9.exe
      https://github.com/LegacyUpdate/LegacyUpdate
      然后打开系统更新进行更新
    • 激活
      https://github.com/abbodi1406/KMS_VL_ALL_AIO/releases
      KMS_VL_ALL进行激活
    • 安装驱动
      运行virtio-win-gt-x64.msi提示不支持windows 8以下的系统,使用低版本的qemu guest tools直接没有virtio-win-gt-x64.msi这个文件了,索性用最新版本一个一个装驱动。

      全部装完后还有一个设备找不到驱动
      下载
      windows6.x-hypervintegrationservices-x64.cab
      https://support.microsoft.com/en-gb/topic/hyper-v-integration-components-update-for-windows-virtual-machines-that-are-running-on-a-windows-10-or-windows-server-2016-based-host-bd22f4f6-feec-89f4-8a1d-405076ff4222
      然后执行
      Dism /online /Add-Package /PackagePath:C:\Users\Administrator\Desktop\windows6.x-hypervintegrationservices-x64.cab
    • 安装qemu guest agent
      下载101.2.0版本
      https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-qemu-ga/qemu-ga-win-101.2.0-1.el7ev/
      然后直接安装即可,如果安装不上可以用这里的方法
      https://forum.proxmox.com/threads/qemu-guest-fails-to-install.86030/page-2#post-628055

    Views: 6

  • conan中开启Package Revisions

    Package Revisions的目的是为了让上传的二进制包不会互相覆盖,然后用conan.lock对二进制包版本(PRev)进行锁定实现构建的稳定性。这导致了一些行为上的变化,需要特别注意。

    Package Revisions字面意思是包修订,这里指的是同一个包不同的二进制rev可以同时存储在conan仓库中。

    配置

    • 方法1

    conan config set general.revisions_enabled=1
    conan config set general.full_transitive_package_id=1

    • 方法2

    在conan.conf的general段中配置
    revisions_enabled=1
    full_transitive_package_id=1

    • 方法3

    配置环境变量
    CONAN_REVISIONS_ENABLED=1

    说明

    • full_transitive_package_id=1是conan2中的默认行为,是官方推荐的配置-
    • 当rev版本不同时不会被覆盖
    • 包的package id由包名,版本号,settings,options,requires共同决定
    • 包的PRev由包的内容hash组成
    • 包的RRev由conanfile.py的hash组成
    • 在conan2中Package Revisions是默认开启的,不用另外配置
    • jfrog artifactory版本大于等于6.9
    • conan客户端版本大于等于1.13
    • artifactory中revision特性是默认开启的(不可关闭),conan2中也是默认开启的(不可关闭),而且服务端与客户端必须一致(同时开启同时关闭)
    • 当conanfile.py改变时(RREV改变)或源代码改变时(如果需要上传源代码时)所有不同架构二进制包要重新编译,不然conan会找不到未重编译架构的二进制包,这是因为默认conan只查找最后一次的RREV下的二进制包
      比如修改版本号,requires等都会修改conanfile.py文件,这时候就需要重新上传所有的二进制包。另外不同的换行符格式,不同的空白符号也会导致Conanfile.py文件的hash不一样(hash就是RREV)。
      英文原话:
      If you generate and upload N binary packages for a recipe with a given revision, then if you modify the recipe, and thus the recipe revision, you need to build and upload N new binaries matching that new recipe revision.
      如果不想重新上传所有二进制包,则需要明确指定所要引用的RRev版本,而不是使用最新的RRev如:
      self.requires("hello/1.0#2475ece651f666f42c155623228c75d2")
      https://docs.conan.io/1/versioning/revisions.html

    查看conan仓库中的包(conan2)

    • 列出所有RRev
      conan list hello/1.1#* -r conan
    • 列出指定RRev的二进制包
      conan list hello/1.1#2d62851f23cc70eb930774045906cd5d:* -r conan
    • 列出最新RRev的二进制包
      conan list hello/1.1:* -r conan

    Views: 10

  • ubuntu on arm install qt creator

    qt安装器下载地址
    https://download.qt.io/archive/online_installers/
    https://mirrors.sau.edu.cn/qt/archive/online_installers/
    https://download.qt.io/official_releases/online_installers/
    curl https://mirrors.sau.edu.cn/qt/official_releases/qtcreator/13.0/13.0.1/qt-creator-opensource-linux-arm64-13.0.1.run –outputfile qt-creator-opensource-linux-arm64-13.0.1.run
    curl https://download.qt.io/official_releases/online_installers/qt-unified-linux-arm64-online.run -o qt-unified-linux-arm64-online.run
    apt install libdouble-conversion3 libxcb-cursor0 libxkbcommon-x11-dev
    qt creator是IDE,qt-unified是SDK

    Views: 2

  • 关于Go/OpenSSL对ECH的支持

    go stdlib中已经计划在go1.23中支持各户端的ECH,但是服务端的ECH支持要等到go1.24中,界时caddy也将能支持ECH,这样Caddy将成为第一个支持ECH功能的HTTP服务端。这个时间点大概是2025年2月,这个时候会发布go1.24。
    另外openssl 3.4将在2024年10月31日发布,openssl 3.4提供了QUIC的支持,界时nginx将能获取正式的HTTP/3功能(现在是实验性的支持)。
    openssl也正在合并ECH支持的PR,预计会合并到OpenSSL3.5版本中,OpenSSL3.5将会在2025年4月发布。也就是说在2025年上半年go标准库和openssl都会支持ECH,到时候nginx支持ECH应该也会很快。
    这个commit添加了server端的ech支持
    https://github.com/golang/go/commit/f69711434ae0ab383fb6088000736af9bd5638f4
    https://github.com/golang/go/milestone/212?closed=1
    https://github.com/golang/go/issues/32936 (服务端支持的讨论,已经列入proposal)
    https://github.com/golang/go/issues/68500
    https://github.com/orgs/golang/projects/17 (所有proposal)
    https://github.com/orgs/golang/projects/17/views/1?filterQuery=Encrypted+Client+Hello
    https://github.com/golang/go/issues/63369
    https://github.com/openssl/project/issues/52
    https://github.com/openssl/openssl/pull/22938
    https://github.com/openssl/openssl/milestone/48
    https://trac.nginx.org/nginx/milestone/nginx-1.27
    https://github.com/nginx/nginx/issues/266 nginx关于ech的issue
    https://github.com/yaroslavros/nginx/

    Views: 7

  • 配置npm仓库镜像

    npm config set registry http://mirrors.hetao.me/npm-registry/

    Views: 13

  • linux查看监听IP端口

    netstat -lpn -4 -6

    Views: 0

  • Python数据等比连续抽样算法

    numpy里面自带了几种抽样算法,但都是随机抽样,我这里要做的是等比连续抽样,就是对原始数据从前到后按固定的间隔固定的顺序去抽样数据。
    方法一:
    把列表分成n个子组,从每个子组中再抽取一个数作为样本

    def evenly_divide_list(lst, num_groups):
        """按顺序分隔列表为指定数量的子组
        Args:
            lst (list): 列表
            num_groups (int): 分隔次数
        Returns:
            list: 返回子列表的集合
        """
        quotient, remainder = divmod(len(lst), num_groups)
        group_sizes = [quotient] * num_groups
        for i in range(remainder):
            group_sizes[i] += 1
        groups = []
        i = 0
        for size in group_sizes:
            groups.append(lst[i:i + size])
            i += size
        return groups
    data = [1, 2, 4, 5]
    count = 3
    sample_group = evenly_divide_list(data, count)
    for i in range(len(sample_group)):
            print(sample_group[i][0])
    

    方法二:
    对列表索引分成固定的间隔然后进行进行四舍五入

    def extract_elements(lst, num_elements):
        """按顺序均匀抽样元素
        Args:
            lst (list): 列表
            num_groups (int): 抽样次数
        Returns:
            list: 返回抽样元素的集合
        """
        if num_elements > len(lst):
            return lst
        step = len(lst) / num_elements
        return [lst[round(i * step)] for i in range(num_elements)]
    data = [1, 2, 4, 5]
    count = 3
    sample_group = extract_elements(data, count)
    for i in range(len(sample_group)):
            print(sample_group[i])
    

    第一种方法是把不能整分的元素全部加到最前面几个组中,这样前面的组就比后面的组抽样间隔更大
    第二种方法则是把不能等分的元素按四舍五入法分散在不同的段中,这种方法显然抽样更均匀,而且方法一多了一个数组切分过程,算法复杂度更大,所以推荐用方法二。

    Views: 2

  • 正态分布及Python用法

    方差和标准差都是用来反映样本差异大小的
    方差的计算公式:

    标准差的计算公式:
    标准差就是方差的开平方,求方差的目的就是为了得到标准差,方差是求标准差过程的中间值。数学符号是:σ
    正态分布的计算公式:

    其中只有两个变量,一个是中间值,也就是总体的平均值,样本均数,总值均值,用mean表示,数学符号是μ。另一个值就是方差(这里用方差不用标准差应该只是计算方便),数学符号是

    Python用numpy生成符合正态分布的随机数:
    random.normal(loc=0.0, scale=1.0, size=None)
    loc就是中间值,scale是标准差,szie是数据结构,如果整数就是生成几条数据,如果元组就是就数组的维数

    Views: 27

  • Centos7安装Python12

    centos7自带的gcc和openssl版本过低无法成功编译python3.12,所以需要另外安装gcc11和编译openssl1.11。

    yum install centos-release-scl
    yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++
    scl enable devtoolset-11 bash
    echo /opt/rh/devtoolset-11/root/usr/bin/gcc>>~/.bashrc
    yum install -y wget make cmake gcc bzip2-devel libffi-devel zlib-devel
    yum groupinstall -y "Development Tools"
    wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
    tar -zxf openssl-1.1.1w.tar.gz
    cd openssl-1.1.1w
    ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
    make && make install_sw
    export PATH=/usr/local/openssl/bin:\PATH
    export LD_LIBRARY_PATH=/usr/local/openssl/lib:\$LD_LIBRARY_PATH
    cd ..
    wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz
    tar -zxf Python-3.12.3.tgz
    cd Python-3.12.3
    ./configure --with-openssl=/usr/local/python3 --enable-shared --enable-optimizations
    CFLAGS=-Wno-coverage-mismatch make
    make install
    export PATH=/usr/local/python3/bin:PATH
    export LD_LIBRARY_PATH=/usr/local/python3/lib:$LD_LIBRARY_PATH
    echo /usr/local/python3/lib/ > /etc/ld.so.conf.d/python.conf
    ldconfig
    

    Views: 14

  • LVM扩容swap分区

    swapoff -a
    lvresize /dev/pve/swap -L 32G
    mkswap /dev/pve/swap
    swapon -a
    

    新建swap分区

    lvcreate ubuntu-vg -L 16G -n swap
    mkswap /dev/ubuntu-vg/swap
    echo "/dev/ubuntu-vg/swap swap swap defaults 0 0" >> /etc/fstab
    swapon -a
    

    Views: 53