摘要: 添加元素:你可以使用push方法来在数组的末尾添加一个元素,或者使用unshift方法来在数组的开头添加一个元素。你也可以使用concat方法或者扩展运算符...来合并两个数组。 let arr = [1, 2, 3]; arr.push(4); // arr is now [1, 2, 3, 4] 阅读全文
posted @ 2023-12-01 23:32 老鲜肉 阅读(112) 评论(0) 推荐(0) 编辑
摘要: cip.cc #返回 IP 地区 运营商myip.ipip.net #返回IP 运营商ipinfo.io #返回IP 地区https://api.myip.com #返回IP 地区ifconfig.me #返回IPip.sb #返回IPcheckip.amazonaws.com #返回IP 阅读全文
posted @ 2023-04-24 09:57 老鲜肉 阅读(34) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/prometheus/client_golang/prometheus/promhttp" "net/http" ) type item struct { Name string Tag map[string]string valu 阅读全文
posted @ 2023-02-24 09:55 老鲜肉 阅读(13) 评论(0) 推荐(0) 编辑
摘要: import time class Timer: def __init__(self, func=time.perf_counter): self.elapsed = 0.0 self._func = func self._start = None def start(self): if self. 阅读全文
posted @ 2022-10-18 16:53 老鲜肉 阅读(94) 评论(0) 推荐(0) 编辑
摘要: import os import re import argparse import sys import time SLEEP_DURATION = 0.001 # 1ms MAX_LINE_LENGTH = 1024 * 1024 * 128 # 128MB enable_color = Fal 阅读全文
posted @ 2022-10-12 23:09 老鲜肉 阅读(19) 评论(0) 推荐(0) 编辑
摘要: python GIL(全局解释器锁) 线程模型分类 一.基本概念线程是处理器调度和分配的基本单位,进程则作为资源拥有的基本单位。每个进程是由私有的虚拟地址空间、代码、数据和其它各种系统资源组成。线程是进程内部的一个执行单元。每一个进程至少有一个主执行线程,它无需由用户去主动创建,是由系统自动创建的。 阅读全文
posted @ 2022-09-17 11:52 老鲜肉 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 背景:业务代码上线后,莫名会重复输出很多相同的日志,已知以为是多线程问题,后仔细了解期logging原理后发现并非如此。 以下为解决方案 from flask import Flask as _Flask from flask.helpers import locked_cached_propert 阅读全文
posted @ 2022-08-27 00:27 老鲜肉 阅读(670) 评论(0) 推荐(0) 编辑
摘要: 1、下载rabbitMQ对应版本Mq https://www.rabbitmq.com/news.html 下载对应版本解压即可,注意下载的Mq的版本对应的erl版本 2、使用root用户安装对应版本的erl https://www.erlang.org/downloads ,在右边可以选择对应的版 阅读全文
posted @ 2022-07-31 10:59 老鲜肉 阅读(737) 评论(0) 推荐(0) 编辑
摘要: func YesNO(choose bool) { userFile := "/dev/tty" if !choose { here: fmt.Printf("Continue (y/n):") fin, err := os.Open(userFile) defer fin.Close() if e 阅读全文
posted @ 2022-07-11 15:46 老鲜肉 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1、设置home hbrew 安装protobuf brew install protobuf 2、设置gomod模式 GO111MODULE=off无模块支持,go 会从 $GOPATH 文件夹和 vendor 目录中寻找依赖项。 GO111MODULE=on模块支持,go 忽略 $GOPATH 阅读全文
posted @ 2022-07-10 21:08 老鲜肉 阅读(209) 评论(0) 推荐(0) 编辑