Myluzh Blog

CentOS安装nginx

2023-6-1 myluzh Nginx

0x01 通过rpm包离线安装 rpm包地址:https://nginx.org/packages/centos/7/x86_64/RPMS/ wget https://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.24.0-1.el7.ngx.x86_64.rpm rpm -i nginx-1.24.0-1.el7.ngx.x86_64.rpm 0x02 创建nginx仓库文件 vim /etc/yum.repos.d/nginx.repo [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=...

阅读全文>>

标签: centos nginx

评论(0) (346)

Python selenium在Chrome中设置传感器(位置)

2023-5-25 myluzh Python

是否可以使用 Chrome Headless 设置自定义位置坐标?我在里面找不到。 Is it possible to set custom location coordinates with Chrome Headless? I can't find it in the Devtools protocol API. Is there a workaround available? 解决方案 I googled it and got many methods. I try one by one, almost all of them turn out outdated. Then I find out a solution, use chrome devtools protocol to achieve that. The small example code below, that it uses the most common tool selenium to execute chrome devtools protocol command. import time from selenium.webdr...

阅读全文>>

标签: selenium Chrome 传感器 位置 虚拟定位

评论(0) (440)

Django-Form与ModelForm

2023-5-24 myluzh Python

0x01 原始的Form表单 用户提交数据没有校验。 页面上没有错误提示。 页面上每个字段都要写一遍。 关联的数据还需要手动获取后循环展示在页面中。 0x02 Django组件-Form views.py from django.forms import Form class MyForm(Form): user = forms.CharField(widget=forms.Input) pwd = form.CharFiled(widget=forms.Input) email = form.CharFiled(widget=forms.Input) def user_add(request): if request.method == "GET": form = MyForm() return render(request, 'user_add.html', {"form": form}) user_add.html <form method="post"> <!--以前的写法写in...

阅读全文>>

标签: django

评论(0) (328)

python调用OPENAI_ChatGPT类

2023-5-24 myluzh Python

0x01 前言 python有直接现成的OPENAI模块,为了锻炼下自己,写了个基础的调用类。 0x02 代码 需要更改成你自己的open_ai_key,还有就是要设置下http代理,因为目前GPT只能国外访问。 class OPENAI: def __init__(self): self.open_ai_key = "sk-DR5GkhpENIwerq9qfmYqT3BlbkFJXeWBFt4melgpmv8PFr" self.open_ai_api = "https://api.openai.com/v1/chat/completions" self.model = "gpt-3.5-turbo-0301" def openai_reply_requests(self, message): error_counter = 0 while error_counter <= 3: headers = { "Content-Type": "a...

阅读全文>>

评论(0) (322)

MacOS双开微信

2023-5-24 myluzh macOS

访达-应用程序-自动操作,选择“新建应用程序”-"实用工具"-“运行shell脚本” cd /Applications/WeChat.app/Contents/MacOS && nohup ./WeChat > nohup.out 2>&1 & 保存成此app到桌面,两次双击就是两个微信了。

阅读全文>>

标签: macos

评论(0) (347)

python requests模块设置代理

2023-5-23 myluzh Python

import requests # 设置代理,多用于爬虫 proxies = {"http":"http://12.34.56.79:9527", "https":"https://12.34.56.79:9527"} # 1.普通的代理 rqq= requests.get(url="http://www.baidu.com",proxies=proxies) print(res.content.decode("utf-8")) # 2.携带了登录的用户名和密码 # proxies1 = {"http":"http://用户名:密码@12.34.56.79:9527"} # rqq = requests.get(url="http://www.baidu.com",proxies=proxies1)

阅读全文>>

标签: python requests

评论(0) (310)