摘要: 背景: 特殊原因使用wsl + vscode 开发python, 使用一段时间后突然无法上网了(dns解析失败), 宿主机能正常上网; 1 查看wsl配置 cat /etc/wsl.conf [network] generateResolvConf = false 2 查看wsl ip配置 3 查看 阅读全文
posted @ 2024-04-03 16:39 干炸小黄鱼 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 问题背景: 有个pg查询的sql很慢, 需要优化, 打印出原始sql来explain: from sqlalchemy.dialects import postgresql query = Config.query.all() try: # 引入方言, literal_binds 指定参数全部替换 阅读全文
posted @ 2024-04-01 19:26 干炸小黄鱼 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 场景: 输入一段内容, 找到问题集中跟该内容最相似的问题 import jieba from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_simi 阅读全文
posted @ 2024-03-26 16:55 干炸小黄鱼 阅读(3) 评论(0) 推荐(0) 编辑
摘要: def merge(lists): list.sort(key=lamba x: x[0]) merges = [] for l in list: if not merges or l[0] > merges[-1][1] merges.append(l) else: merges[-1][1] = 阅读全文
posted @ 2024-02-28 20:02 干炸小黄鱼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import time class LocalStrategy: def execute(self): print("this is a local 104 execute") class SaasStrategy: def execute(self): print("this is a saas 阅读全文
posted @ 2024-02-28 19:58 干炸小黄鱼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import time class Observer: def __init__(self, name) -> None: self.name = name def update(self, message): print("name %s received message: %s" % (self 阅读全文
posted @ 2024-02-28 19:57 干炸小黄鱼 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 启动测试应用时, 有时需要自己配置证书签名: 1 使用系统自带openssl openssl req \ > -x509 \ > -nodes \ > -days 365 \ > -newkey rsa:2048 \ > -keyout example.key \ > -out example.cr 阅读全文
posted @ 2024-02-23 11:10 干炸小黄鱼 阅读(71) 评论(0) 推荐(0) 编辑
摘要: iptables -A INPUT -p tcp -s {src_ip} --dport 80 -j ACCEPT iptables -A INPUT -p tcp -s {src_ip} --dport 443 -j ACCEPT iptables -A INPUT -p tcp -s {src_ 阅读全文
posted @ 2023-12-20 16:40 干炸小黄鱼 阅读(2) 评论(0) 推荐(0) 编辑
摘要: FROM python:3.8.10-slim RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \ apt-get update && \ apt-get install -y 阅读全文
posted @ 2023-12-15 18:00 干炸小黄鱼 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 最近由pycharm切到VScode, 记录一下项目的通用配置; 在项目目录建一个.vscode的文件夹分别创建三个文件 lunch.json python运行配置 settings.json vscode配置 包括代码校验; sftp.json 文件服务器配置, 直接右键上传到服务器 lunch. 阅读全文
posted @ 2023-12-08 19:32 干炸小黄鱼 阅读(69) 评论(0) 推荐(0) 编辑