- 博客(379)
- 收藏
- 关注
原创 network: open /run/flannel/subnet.env:no such file or directory
kubectl describe pod ngx ,之后发现network: open /run/flannel/subnet.env:no such file or directory。kubectl get pod 之后,一直处于creating状态。
2023-05-13 16:22:59
2046
1
原创 Could not resolve host: ngx-svc (k8s)
Could not resolve host: ngx-svc (k8s)
2023-02-18 16:23:02
600
原创 error: unable to upgrade connection: pod does not exist
error: unable to upgrade connection: pod does not exist。
2023-02-18 10:40:16
912
原创 The connection to the server localhost:8080 was refused - did you specify the right host or port
The connection to the server localhost:8080 was refused - did you specify the right host or port
2023-02-14 19:16:57
431
原创 virtualbox 安装系统全屏
安装系统的方式有无人值守的和手动。不管哪种方式安装完之后系统是不会全屏的,需要安装一个增强工具。我virtualbox 的显示的全局设置如下,最大屏幕尺寸选择。virtualbox 的设置有全局的和单个mashine的。2. 点击光盘,在光盘所在的文件位置打开终端。
2023-02-08 12:59:36
1495
原创 go Gin程序的热加载(fresh)
官网使用的安装是 go get github.com/pilu/fresh。使用 go install github.com/pilu/fresh。在cmd 中执行fresh 就相当于 go run main.go。安装完之后把 $GOPATH/bin 加入到环境变量就ok。安装完之没有任何反应使用fresh 没有任何反应。
2023-01-10 17:08:11
1294
原创 go ginSwagger 安装完后不是内部命令的解决
gin-swagger 按照官方的readme 安装后无法使用swag init。cd 你下载的package 的路径,然后执行。把生成swag.exe 加入到环境变量。
2023-01-04 17:42:42
898
1
原创 python 根据jinjia模板写excle
python 更具jinjia 模板写excel文件,需要安装python 的一个包。pip install xlsxtpl写excle 模板,jinjia 语法。代码如下:import osfrom datetime import datetimefrom xlsxtpl.writerx import BookWriterdef write_test(): pth = os.path.dirname(__file__) fname = os.path.join(pth.
2022-05-19 23:35:48
2538
3
原创 python转化时区
datetime 包进行转化方法一from datetime import datetime, timedelta, timezonedatetime_zone = datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(timezone(timedelta(hours=8)))print(datetime_zone)# 结果# 2022-04-23 09:46:15.757988+08:00方法二from datetim
2022-04-23 10:07:40
1791
原创 marshmallow数据校验的神器(python)
marshmallow 包的使用marshmallow 和 django 的序列化器有点像。可以自定义校验的模型使用方法如下:1、定义需要校验的字段from marshmallow import Schema, fields, EXCLUDE, validate, ValidationErrorclass User(Schema): name = fields.String(required=True,allow_none=True,validate=Length(10,20,er
2022-04-04 18:46:32
1860
原创 supervisor 安装以及管理python服务
supervisor 是linux系统的一个进程管理工具。1、安装 pip install supervisor2、创建一个配置文件echo_supervisord_conf > /etc/supervisord.conf3、修改配置文件把 /tmp/supervisor.sock,/tmp/supervisord.log ,/tmp/supervisord.pid改成自己的目录,tmp 目录下会被linux 清除掉。我的改成了 file=/var/run/supe..
2022-03-13 11:21:19
2246
原创 python 一行代码去掉emoji表情符号
安装python 包pip install emoji使用方法import emojires = "".join(emoji.replace_emoji("I 😂🤣❤️👌😘💕 you").split())
2022-02-28 22:48:16
1873
原创 fabric的使用(python)
fabric 强大的运维工具包,python 实现自动化部署。建立连接from fabric import Connectionc = Connection(host=host,user=user,connect_kwargs{"password":"ubuntu")执行shell 命令c.run("uname -a")c.sudo("ls",password="")切换命令with c.cd("../"): c.run("pwd")实用小例:def.
2022-02-28 22:30:51
10846
原创 强大的时间处理包arrow(python)
import arrow获取当前时间的utc 时间utc_now = arrow.utcnow()##获取前一个小时的时间hour_age = utc_now.shift(hours=-1)转成时间戳utc_now.timestamp()arrow.get(1367900664).format()arrow.get(1367900664.152325).format()格式化输出res = utc_now.to(“Asia/Shanghai”).format()h.
2022-02-12 13:08:58
619
原创 mysql 中的GROUP_CONCAT函数
该函数的功能是把分组相同的数按照分割符连接起来。GROUP_CONCAT 函数的语法如下:GROUP_CONCAT([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [SEPARATOR '分隔符'])例如:select name,GROUP_CONCAT(money) FROM deposit GROUP BY name;效果如下默认是按照,连接还可以对连接的数字进行排序:select name,GROUP_CONCAT(money ORD.
2022-02-09 23:24:43
1044
1
原创 每日温度python (leetcode)
请根据每日 气温 列表 temperatures ,请计算在每一天需要等几天才会有更高的温度。如果气温在这之后都不会升高,请在该位置用 0 来代替。解法一:题意就是找到比自己值大的下标的差。拿到当前值,循环往后找比自己大的数,并且该值的下标与当前值的下标之差。(超时)class Solution: def dailyTemperatures(self, temperatures): length, result = len(temperatures),[] f.
2022-01-31 16:24:12
1374
原创 mq 的通配符模式(python)
mq 的topic 模式,就是根据通配符去匹配路由,决定发送到那个队列。通配符的使用*表示一个单词,# 表示匹配零个或多个单词代码如下:produceimport pikafrom pika.exchange_type import ExchangeTypecon = pika.BlockingConnection( pika.ConnectionParameters(host="localhost"))channel = con.channel()channe.
2022-01-23 18:01:06
1531
原创 mq 的 direct 模式(python)
mq 的direct 模式,在生产者中,绑定队列和路由key 和 发布的路由key 一定要一致。消费者和生产者的路由key 一致,当然一个队列也可以绑定多个key.生产者python 代码import pika from pika.exchange_type import ExchangeType .
2022-01-18 22:50:11
2918
原创 mq 的Publish/Subscribe 模式
一个交换机绑定多个队列,使用交换机使用fanout 类型,那么会发给与之绑定的所有队列。代码如下:Publishimport pikafrom pika.exchange_type import ExchangeTypeclass Producer(object): def __init__(self, queue_name,exchange_name, username, password, host, port, virtual_host): con_param.
2022-01-18 21:09:24
2420
原创 mysql 的 TRUNCATE不同含义
TRUNCATE 作为函数来使用的话是截取一定位数的小数。TRUNCATE(x,y) 返回x保留到小数点后y位的值,与round 最大的区别是不会进行四舍五入。如图截取小数点后两位。如果Truncate 后面给table的话,是删除表中的数据,并且连同索引一块清零,不能回滚。...
2022-01-17 21:49:13
528
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人