作者文章归档:陈海峰

[ Python二维码生成 ]


python二维码生成

  • flask版本
  • fastapi版本
  • 记得安装库
# from flask import Flask, make_response
# import qrcode
# import io

# app = Flask(__name__)

# @app.route("/image")
# def index():
#     qr = qrcode.QRCode(
#         version=3,
#         error_correction=qrcode.ERROR_CORRECT_L,
#         box_size=10

< Read more >

[ Selenium参考文章 ]


参考文章

  1. 安装需要先下载驱动
from selenium.webdriver.common.action_chains import ActionChains # 导包。鼠标
from selenium import webdriver # 浏览器导包
import time #时间导包
from selenium.webdriver.common.by import By # 元素导包
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expecte

< Read more >

[ 创建pod服务 ]


一. 配置字典

  1. 配置字典 1. 配置字典

  2. 配置字典 - 名字 2. 名字

  3. 配置字典 - 文件 3. 字典配置

二. 配置副本集pod

  1. 有状态副本集 4. 有状态服务

  2. 有状态副本集 - 名字 5

  3. 有状态副本集 - 容器配置1 6

  4. 有状态副本集 - 容器配置2 7

  5. 有状态副本集 - 储存配置 8

  6. 有状态副本集 - 储存配置 - 挂载持久卷 9

  7. 有状态副本集 - 储存配置 - 挂载配置字典 10

  8. 创建服务 11

  9. 创建服务 - 指定工作负载 12

  10. 创建服务 - 名字 13

  11. 创建服务 - 服务配置(选择访问模式, 保留端口, 选择工作负载) 14

  12. 创建服务 - 高级设置 - 外部访问 15

  13. 查看创建完成的服务 16

  14. 使用服

< Read more >

[ kubesphere流水线 ]


jenkinsfile文件

  • REGISTRY环境变量为dockerhub私有仓库的ip地址
  • DOCKERHUB_NAMESPACE为dockerhub私有仓库的命名空间

1.前端vue3项目配置到nginx

  • 自己指定docker镜像node:latest容器
pipeline {
  agent {
    kubernetes {
      inheritFrom 'nodejs base'
      containerTemplate {
        name 'nodejs'
        image 'node:latest&#

< Read more >

[ 内网穿透frp ]


官网

  • linux系统下载frp_0.49.0_linux_amd64.tar.gz

客户端frpc.ini

[common]
# 服务端端口ip
server_addr = 47.120.55.99
# 与服务端对接的端口
server_port = 9999
token = test@123

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 7000

[k8s]
type = http
# 客户端本地要转发的ip
local_ip = 192.168.50.205
# 客户端本地要转发的端口
loc

< Read more >

[ 百度图片识别api ]


百度智能云api

1. 创建应用

https://console.bce.baidu.com/ai/#/ai/ocr/app/list

2. 调试api

https://console.bce.baidu.com/tools/#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E9%80%9A%E7%94%A8%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Fgeneral_basic&method=post

代码演示

imp

< Read more >

[ kubesphere安装 ]


官网

一. 安装

debain系统, 所有k8s安装到一台主机上

1.1 ssh

注意需要配置允许root用户连接

1.2 安装依赖

apt-get install socat

apt-get install conntrack

apt-get install ebtables

apt-get install ipset

1.3 下载

如果您访问 GitHub/Googleapis 受限

设置时区

export KKZONE=cn

下载

curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -

如果网络正常能连g

< Read more >

[ pymongo的使用 ]


Pymongo基本使用

from pymongo import MongoClient from django.conf import settings

查询

# 1. 分页
res = collection.find({}, {"_id": 0}).limit(limit).skip(offset)

# 2. 查询, 并限制返回字段
# 前面括号是条件, 后面括号为限制返回字段(0不返回, 1返回)
res = collection.find_one({"user_id": pk}, {"_id": 0})

新增

# 1. 插

< Read more >