上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页
摘要: 1、安装必要工具 yum install -y tar zlib-devel 2、编译安装 OpenSSL cd /usr/local/src wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz tar -xvzf openssl-1. 阅读全文
posted @ 2024-07-11 12:34 wanghongwei-dev 阅读(288) 评论(0) 推荐(0)
摘要: 单例模式 # 方法 1: 使用类变量 class Singleton: _instance = None def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super(Singleton, cls).__ 阅读全文
posted @ 2024-06-29 20:05 wanghongwei-dev 阅读(25) 评论(0) 推荐(0)
摘要: 1、文件读写 # 写入文件 with open('example.txt', 'w') as file: file.write('Hello, World!') # 读取文件 with open('example.txt', 'r') as file: content = file.read() p 阅读全文
posted @ 2024-06-29 20:05 wanghongwei-dev 阅读(25) 评论(0) 推荐(0)
摘要: 组合 class Engine: """引擎类,提供基本的引擎功能""" def __init__(self, power): self.power = power def start(self): print(f"引擎启动,功率:{self.power}") class Car: """汽车类,使 阅读全文
posted @ 2024-06-23 14:39 wanghongwei-dev 阅读(22) 评论(0) 推荐(0)
摘要: 函数的特殊参数 # /前的参数只能是位置参数,*后面的只能是关键字参数,之间的不限参数类型 def func(a, b, /, c, *, d, e): print(a, b, c, d, e) func(1, 2, 3, d=4, e=5) func(1, 2, c=3, d=4, e=5) # 阅读全文
posted @ 2024-06-23 14:39 wanghongwei-dev 阅读(26) 评论(0) 推荐(0)
摘要: 格式化输出 %[(name)][flags][width].[precision] typecode (name) :可选,用于选择指定的 key flags:可选,可供选择的值有: – + 右对齐:正数的加正号,负数的加负号 – - 左对齐:正数前没有负号,负数前加负号 width:可选,占有宽度 阅读全文
posted @ 2024-06-23 14:38 wanghongwei-dev 阅读(23) 评论(0) 推荐(0)
摘要: 1、确定主板和CPU都支持虚拟化技术,在BIOS将VT-d(芯片组、IO)、VT-x(CPU)设置成启用。 2、确保BIOS中启用了SR-IOV。 3、内核启动参数设置,开启IOMMU。 # 检查系统是否启用iommu cat /proc/cmdline | grep iommu # 编辑/etc/ 阅读全文
posted @ 2024-05-30 15:43 wanghongwei-dev 阅读(607) 评论(0) 推荐(0)
摘要: 1、查询网络命名空间。 [root@kolla ~]# ip netns list qdhcp-e66f117c-4412-4ee1-a89a-3ac3949bffa1 (id: 2) qrouter-9e2aae1d-2bd5-4174-883b-bb55bacbaa80 (id: 1) qdhc 阅读全文
posted @ 2024-03-31 01:23 wanghongwei-dev 阅读(141) 评论(0) 推荐(0)
摘要: kolla-ansible提供的一键式创建示例网络、图像等,不得不说,真的是太贴心了!只需根据实际环境修改公共网络和租户网络部分。 #!/bin/bash set -o errexit # This script is meant to be run once after running start 阅读全文
posted @ 2024-03-30 11:43 wanghongwei-dev 阅读(61) 评论(0) 推荐(0)
摘要: 批量导出 #!/bin/bash # 设置导出镜像的目录 EXPORT_DIR="/root/images" # 确保导出目录存在 mkdir -p "$EXPORT_DIR" # 获取所有的镜像并导出 IMAGES=$(docker images --format '{{.Repository}} 阅读全文
posted @ 2024-03-28 16:37 wanghongwei-dev 阅读(769) 评论(0) 推荐(1)
上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页