首页
壁纸
留言板
友链
更多
统计归档
Search
1
TensorBoard:训练日志及网络结构可视化工具
12,588 阅读
2
主板开机跳线接线图【F_PANEL接线图】
7,034 阅读
3
Linux使用V2Ray 原生客户端
6,149 阅读
4
移动光猫获取超级密码&开启公网ipv6
4,676 阅读
5
NVIDIA 显卡限制功率
3,131 阅读
好物分享
实用教程
linux使用
wincmd
学习笔记
mysql
java学习
nginx
综合面试题
大数据
网络知识
linux
放码过来
python
javascript
java
opencv
蓝桥杯
leetcode
深度学习
开源模型
相关知识
数据集和工具
模型轻量化
语音识别
计算机视觉
杂七杂八
硬件科普
主机安全
嵌入式设备
其它
bug处理
登录
/
注册
Search
标签搜索
好物分享
学习笔记
linux
MySQL
nvidia
typero
内网穿透
webdav
vps
java
cudann
gcc
cuda
树莓派
CNN
图像去雾
ssh安全
nps
暗通道先验
阿里云
jupiter
累计撰写
354
篇文章
累计收到
71
条评论
首页
栏目
好物分享
实用教程
linux使用
wincmd
学习笔记
mysql
java学习
nginx
综合面试题
大数据
网络知识
linux
放码过来
python
javascript
java
opencv
蓝桥杯
leetcode
深度学习
开源模型
相关知识
数据集和工具
模型轻量化
语音识别
计算机视觉
杂七杂八
硬件科普
主机安全
嵌入式设备
其它
bug处理
页面
壁纸
留言板
友链
统计归档
搜索到
62
篇与
的结果
2023-05-15
python调用TinyPNG进行图片无损压缩
1.TinyPNG介绍TinyPNG是一种在线图片压缩工具,可以将图片压缩到更小的文件大小,而且不会对图片质量造成明显的影响。其实现原理主要是基于两个方面:压缩算法和颜色减少。压缩算法TinyPNG使用的是一种叫做Deflate的压缩算法。Deflate算法是一种无损压缩算法,可以将图片的二进制数据进行压缩,从而减小图片文件的大小。在Deflate算法中,压缩的主要思想是利用重复的数据进行替换,从而减小文件的大小。具体来说,Deflate算法主要包括两个步骤:压缩和解压缩。在压缩过程中,数据被分成多个块,并且每个块都有自己的压缩字典。在解压缩过程中,压缩字典用于还原压缩后的数据。2. 颜色减少另一个TinyPNG使用的技术是颜色减少。颜色减少是一种通过减少图片中使用的颜色数来减小文件大小的技术。在实践中,很多图片中使用的颜色实际上是不必要的,因此可以通过将这些颜色删除来减小文件的大小。具体来说,TinyPNG会先对图片进行一个预处理,找出图片中使用频率最低的颜色,并将其替换成使用频率更高的颜色。这个过程是基于一个叫做K-means的算法实现的。K-means算法是一种基于聚类的算法,可以将图片中使用的颜色分成多个聚类,从而找出使用频率最低的颜色。2.python调用TinyPNG API进行图片压缩安装依赖pip install tinify核心代码import tinify import os import shutil def img_compress_by_tinify(img_path_local,img_size_thresh = 200): if not os.path.exists("./images"): os.makedirs("./images") # 压缩前图片大小 img_src_size = os.path.getsize(img_path_local)/1024 # 压缩后图片保存地址 img_path_compress = "./images/compress_"+img_path_local.split("/")[-1] # 若压缩前图片大小已经大小阈值img_size_thresh则跳过压缩 if(img_src_size<img_size_thresh): print("图片大小小于"+str(img_size_thresh)+"KB,跳过压缩"); shutil.copyfile(img_path_local,img_path_compress) else: print("压缩前图片大小:"+str(int(img_src_size))+"KB") # 调用tinyPNG进行图片压缩 tinify.key = "V02hTQyPz4WRXPyCChGv6nJJTZYVtzcd" source = tinify.from_file(img_path_local) source.to_file(img_path_compress) # 压缩后图片大小 img_compress_size = os.path.getsize(img_path_compress)/1024 print("压缩后图片大小:"+str(int(img_compress_size))+"KB") return img_path_compress img_path_local = "./images/1684153992017.jpg" img_path_compress = img_compress_by_tinify(img_path_local) print(img_path_compress)调用结果压缩前图片大小:693KB 压缩后图片大小:148KB ./images/compress_1684153992017.jpg
2023年05月15日
515 阅读
0 评论
0 点赞
2023-05-09
python文字转语音(可保存为mp3)
1.pyttsx3模块(亲测可用)这是一款优秀的文字转语音的模块,它生成的音频文件也比较具有个性化。可以调整声音的音量,频率,变声,当然设置方法都差不多,都是先拿到它对应功能的值然后在进行加减。下载pyttsx3模块pip install pyttsx3调用import pyttsx3 # 初始化 engine = pyttsx3.init(); # 设置个性化参数 engine.setProperty('rate',150) #调整语速 engine.setProperty('volume',2.0) #调整音量 voices = engine.getProperty('voices'); engine.setProperty('voice',voices[0].id); mp3_save_path = "./test.mp3" text="西游记" # 使用引擎进行渲染,亲测不能省略这一步,省略了就保存的文件为空 engine.say(text); engine.runAndWait(); #播放音频 # 保存到文件 engine.save_to_file(text,mp3_save_path);2.gtts模快(亲测没跑通)安装pip install gtts使用from gtts import gTTS mp3_save_path = "./test.mp3" text="西游记" # text:音频内容 # lang: 音频语言 tts = gTTS(text=text, lang='zh-tw') tts.save(mp3_save_path)
2023年05月09日
323 阅读
0 评论
0 点赞
2023-05-03
OpenVPN搭建:实现异地多设备组网
1.服务端一键安装脚本wget https://nos-public.nos-eastchina1.126.net/vpn -O openvpn-install.sh && bash openvpn-install.sh安装完毕后将 /root/ 下的 client.ovpn 文件,下载到本地导入 OpenVPN 客户端连接软件进行连接。注意:强烈建议不要使用默认的 VPN 端口 1194,建议修改为其他端口并防火墙开放该端口,使用云服务器的话还需要在安全组放行。还需要继续创建其他的client.ovpn文件继续执行该脚本即可。bash openvpn-install.sh2.客户端连接2.1 Linuxsudo apt-get install openvpn openvpn client.ovpn开机自启动服务sudo vim /etc/rc.local# exit 0 前面加入如下内容 /usr/sbin/openvpn --config /root/client.ovpn &2.2 windows使用客户端下载地址:https://nos-public.nos-eastchina1.126.net/openvpn-install-2.4.6-I602.exe参考资料搭建 OpenVPN脚本内容备份openvpn-install.sh#!/bin/bash # OpenVPN road warrior installer for Debian, Ubuntu and CentOS # This script will work on Debian, Ubuntu, CentOS and probably other distros # of the same families, although no support is offered for them. It isn't # bulletproof but it will probably work if you simply want to setup a VPN on # your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and # universal as possible. # Detect Debian users running the script with "sh" instead of bash if readlink /proc/$$/exe | grep -qs "dash"; then echo "This script needs to be run with bash, not sh" exit 1 fi if [[ "$EUID" -ne 0 ]]; then echo "Sorry, you need to run this as root" exit 2 fi if [[ ! -e /dev/net/tun ]]; then echo "The TUN device is not available You need to enable TUN before running this script" exit 3 fi if grep -qs "CentOS release 5" "/etc/redhat-release"; then echo "CentOS 5 is too old and not supported" exit 4 fi if [[ -e /etc/debian_version ]]; then OS=debian GROUPNAME=nogroup RCLOCAL='/etc/rc.local' elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then OS=centos GROUPNAME=nobody RCLOCAL='/etc/rc.d/rc.local' else echo "Looks like you aren't running this installer on Debian, Ubuntu or CentOS" exit 5 fi newclient () { # Generates the custom client.ovpn cp /etc/openvpn/client-common.txt ~/$1.ovpn echo "<ca>" >> ~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn echo "</ca>" >> ~/$1.ovpn echo "<cert>" >> ~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn echo "</cert>" >> ~/$1.ovpn echo "<key>" >> ~/$1.ovpn cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn echo "</key>" >> ~/$1.ovpn echo "<tls-auth>" >> ~/$1.ovpn cat /etc/openvpn/ta.key >> ~/$1.ovpn echo "</tls-auth>" >> ~/$1.ovpn } # Try to get our IP from the system and fallback to the Internet. # I do this to make the script compatible with NATed servers (lowendspirit.com) # and to avoid getting an IPv6. IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) VPCSUBNETDEFAULT=$(route -n | grep eth0 | grep 255.255| awk '{print $1,$3}' | tail -n 1| awk '{print $1}') VPCMASKDEFAULT=$(route -n | grep eth0 | grep 255.255| awk '{print $1,$3}' | tail -n 1| awk '{print $2}') if [[ "$IP" = "" ]]; then IP=$(wget -4qO- "http://whatismyip.akamai.com/") fi if [[ -e /etc/openvpn/server.conf ]]; then while : do clear echo "Looks like OpenVPN is already installed" echo "" echo "What do you want to do?" echo " 1) Add a new user" echo " 2) Revoke an existing user" echo " 3) Remove OpenVPN" echo " 4) Exit" read -p "Select an option [1-4]: " option case $option in 1) echo "" echo "Tell me a name for the client certificate" echo "Please, use one word only, no special characters" read -p "Client name: " -e -i netease-b CLIENT cd /etc/openvpn/easy-rsa/ ./easyrsa build-client-full $CLIENT nopass # Generates the custom client.ovpn newclient "$CLIENT" echo "" echo "Client $CLIENT added, configuration is available at" ~/"$CLIENT.ovpn" exit ;; 2) # This option could be documented a bit better and maybe even be simplimplified # ...but what can I say, I want some sleep too NUMBEROFCLIENTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c "^V") if [[ "$NUMBEROFCLIENTS" = '0' ]]; then echo "" echo "You have no existing clients!" exit 6 fi echo "" echo "Select the existing client certificate you want to revoke" tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') ' if [[ "$NUMBEROFCLIENTS" = '1' ]]; then read -p "Select one client [1]: " CLIENTNUMBER else read -p "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER fi CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p) cd /etc/openvpn/easy-rsa/ ./easyrsa --batch revoke $CLIENT EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl rm -rf pki/reqs/$CLIENT.req rm -rf pki/private/$CLIENT.key rm -rf pki/issued/$CLIENT.crt rm -rf /etc/openvpn/crl.pem cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem # CRL is read with each client connection, when OpenVPN is dropped to nobody chown nobody:$GROUPNAME /etc/openvpn/crl.pem echo "" echo "Certificate for client $CLIENT revoked" exit ;; 3) echo "" read -p "Do you really want to remove OpenVPN? [y/n]: " -e -i n REMOVE if [[ "$REMOVE" = 'y' ]]; then PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2) PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2) if pgrep firewalld; then IP=$(firewall-cmd --direct --get-rules ipv4 nat POSTROUTING | grep '\-s 10.8.0.0/24 '"'"'!'"'"' -d 10.8.0.0/24 -j SNAT --to ' | cut -d " " -f 10) # Using both permanent and not permanent rules to avoid a firewalld reload. firewall-cmd --zone=public --remove-port=$PORT/$PROTOCOL firewall-cmd --zone=trusted --remove-source=10.8.0.0/24 firewall-cmd --permanent --zone=public --remove-port=$PORT/$PROTOCOL firewall-cmd --permanent --zone=trusted --remove-source=10.8.0.0/24 firewall-cmd --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP firewall-cmd --permanent --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP else IP=$(grep 'iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to ' $RCLOCAL | cut -d " " -f 14) iptables -t nat -D POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 ! -d 10.8.0.0\/24 -j SNAT --to /d' $RCLOCAL if iptables -L -n | grep -qE '^ACCEPT'; then iptables -D INPUT -p $PROTOCOL --dport $PORT -j ACCEPT iptables -D FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT sed -i "/iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT/d" $RCLOCAL sed -i "/iptables -I FORWARD -s 10.8.0.0\/24 -j ACCEPT/d" $RCLOCAL sed -i "/iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT/d" $RCLOCAL fi fi if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$PORT" != '1194' || "$PROTOCOL" = 'tcp' ]]; then semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT fi fi fi if [[ "$OS" = 'debian' ]]; then apt-get remove --purge -y openvpn else yum remove openvpn -y fi rm -rf /etc/openvpn echo "" echo "OpenVPN removed!" else echo "" echo "Removal aborted!" fi exit ;; 4) exit;; esac done else clear echo 'Welcome to this quick OpenVPN "road warrior" installer' echo "" # OpenVPN setup and first user creation echo "I need to ask you a few questions before starting the setup" echo "You can leave the default options and just press enter if you are ok with them" echo "" echo "First I need to know the IPv4 address of the network interface you want OpenVPN" echo "listening to." read -p "IP address: " -e -i $IP IP echo "" echo "Which protocol do you want for OpenVPN connections?" echo " 1) UDP (recommended)" echo " 2) TCP" read -p "Protocol [1-2]: " -e -i 1 PROTOCOL case $PROTOCOL in 1) PROTOCOL=udp ;; 2) PROTOCOL=tcp ;; esac echo "" echo "What port do you want OpenVPN listening to?" read -p "Port: " -e -i 1194 PORT echo "" echo "what VPC subnet?" read -p "VPC subnet(E.g 172.16.0.0): " -e -i $VPCSUBNETDEFAULT VPCSUBNET echo "" echo "what VPC mask?" read -p "VPC mask(E.g 255.255.0.0): " -e -i $VPCMASKDEFAULT VPCMASK echo "" # echo "Which DNS do you want to use with the VPN?" # echo " 1) Current system resolvers" # echo " 2) Google" # echo " 3) OpenDNS" # echo " 4) NTT" # echo " 5) Hurricane Electric" # echo " 6) Verisign" # read -p "DNS [1-6]: " -e -i 1 DNS # echo "" echo "Finally, tell me your name for the client certificate" echo "Please, use one word only, no special characters" read -p "Client name: " -e -i netease-b CLIENT echo "" echo "Okay, that was all I needed. We are ready to setup your OpenVPN server now" read -n1 -r -p "Press any key to continue..." if [[ "$OS" = 'debian' ]]; then apt-get update apt-get install openvpn iptables openssl ca-certificates -y else # Else, the distro is CentOS yum install epel-release -y yum install openvpn iptables openssl wget ca-certificates -y fi # An old version of easy-rsa was available by default in some openvpn packages if [[ -d /etc/openvpn/easy-rsa/ ]]; then rm -rf /etc/openvpn/easy-rsa/ fi # Get easy-rsa wget -O ~/EasyRSA-3.0.4.tgz "https://nos-public.nos-eastchina1.126.net/EasyRSA-3.0.4.tgz" tar xzf ~/EasyRSA-3.0.4.tgz -C ~/ mv ~/EasyRSA-3.0.4/ /etc/openvpn/ mv /etc/openvpn/EasyRSA-3.0.4/ /etc/openvpn/easy-rsa/ chown -R root:root /etc/openvpn/easy-rsa/ rm -rf ~/EasyRSA-3.0.4.tgz cd /etc/openvpn/easy-rsa/ # Create the PKI, set up the CA, the DH params and the server + client certificates ./easyrsa init-pki ./easyrsa --batch build-ca nopass ./easyrsa gen-dh ./easyrsa build-server-full server nopass ./easyrsa build-client-full $CLIENT nopass EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl # Move the stuff we need cp pki/ca.crt pki/private/ca.key pki/dh.pem pki/issued/server.crt pki/private/server.key pki/crl.pem /etc/openvpn # CRL is read with each client connection, when OpenVPN is dropped to nobody chown nobody:$GROUPNAME /etc/openvpn/crl.pem # Generate key for tls-auth openvpn --genkey --secret /etc/openvpn/ta.key # Generate server.conf echo "port $PORT proto $PROTOCOL dev tun sndbuf 0 rcvbuf 0 ca ca.crt cert server.crt key server.key dh dh.pem auth SHA512 tls-auth ta.key 0 topology subnet server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt" > /etc/openvpn/server.conf echo "push \"route $VPCSUBNET $VPCMASK vpn_gateway\"" >> /etc/openvpn/server.conf echo "keepalive 10 120 cipher AES-256-CBC comp-lzo user nobody group $GROUPNAME persist-key duplicate-cn max-clients 10 persist-tun status openvpn-status.log verb 3 crl-verify crl.pem" >> /etc/openvpn/server.conf # Enable net.ipv4.ip_forward for the system sed -i '/\<net.ipv4.ip_forward\>/c\net.ipv4.ip_forward=1' /etc/sysctl.conf if ! grep -q "\<net.ipv4.ip_forward\>" /etc/sysctl.conf; then echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf fi # Avoid an unneeded reboot echo 1 > /proc/sys/net/ipv4/ip_forward if pgrep firewalld; then # Using both permanent and not permanent rules to avoid a firewalld # reload. # We don't use --add-service=openvpn because that would only work with # the default port and protocol. firewall-cmd --zone=public --add-port=$PORT/$PROTOCOL firewall-cmd --zone=trusted --add-source=10.8.0.0/24 firewall-cmd --permanent --zone=public --add-port=$PORT/$PROTOCOL firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24 # Set NAT for the VPN subnet firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP else # Needed to use rc.local with some systemd distros if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then echo '#!/bin/sh -e exit 0' > $RCLOCAL fi chmod +x $RCLOCAL # Set NAT for the VPN subnet iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL if iptables -L -n | grep -qE '^(REJECT|DROP)'; then # If iptables has at least one REJECT rule, we asume this is needed. # Not the best approach but I can't think of other and this shouldn't # cause problems. iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT sed -i "1 a\iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT" $RCLOCAL sed -i "1 a\iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT" $RCLOCAL sed -i "1 a\iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT" $RCLOCAL fi fi # If SELinux is enabled and a custom port or TCP was selected, we need this if hash sestatus 2>/dev/null; then if sestatus | grep "Current mode" | grep -qs "enforcing"; then if [[ "$PORT" != '1194' || "$PROTOCOL" = 'tcp' ]]; then # semanage isn't available in CentOS 6 by default if ! hash semanage 2>/dev/null; then yum install policycoreutils-python -y fi semanage port -a -t openvpn_port_t -p $PROTOCOL $PORT fi fi fi # And finally, restart OpenVPN if [[ "$OS" = 'debian' ]]; then # Little hack to check for systemd if pgrep systemd-journal; then systemctl restart openvpn@server.service else /etc/init.d/openvpn restart fi else if pgrep systemd-journal; then systemctl restart openvpn@server.service systemctl enable openvpn@server.service else service openvpn restart chkconfig openvpn on fi fi # Try to detect a NATed connection and ask about it to potential LowEndSpirit users EXTERNALIP=$(wget -4qO- "http://whatismyip.akamai.com/") if [[ "$IP" != "$EXTERNALIP" ]]; then echo "" echo "Looks like your server is behind a NAT!" echo "" echo "If your server is NATed (e.g. LowEndSpirit), I need to know the external IP" echo "If that's not the case, just ignore this and leave the next field blank" read -p "External IP: " -e -i $EXTERNALIP USEREXTERNALIP if [[ "$USEREXTERNALIP" != "" ]]; then IP=$USEREXTERNALIP fi fi # client-common.txt is created so we have a template to add further users later echo "client dev tun proto $PROTOCOL sndbuf 0 rcvbuf 0 remote $IP $PORT resolv-retry infinite nobind max-clients 10 persist-key persist-tun remote-cert-tls server auth SHA512 cipher AES-256-CBC comp-lzo #setenv opt block-outside-dns key-direction 1 auth-nocache verb 3" > /etc/openvpn/client-common.txt # Generates the custom client.ovpn newclient "$CLIENT" echo "" echo "Finished!" echo "" echo "Your client configuration is available at" ~/"$CLIENT.ovpn" echo "If you want to add more clients, you simply need to run this script again!" fi
2023年05月03日
646 阅读
0 评论
0 点赞
2023-02-21
sms-activate:好用的国外虚拟手机接码平台(付费但很便宜|ChatGPT可用)
sms-activate:好用的国外虚拟手机接码平台(付费但很便宜|ChatGPT可用)0.背景注册万ChatGPT激活需要验证手机号后才能正常使用,但是不支持中国地区只能使用国外手机号注册,可以通过接码平台sms-activate.org得到一个虚拟手机号并且接受注册码,平台费用很便宜并且支持国内的各个平台的支付方式。1.操作步骤1.1 注册一个 sms-activate 平台的账号访问接码平台:https://sms-activate.org/cn这个平台无需翻墙直接可以访问,并且支持中文。直接用邮箱注册,注册后通过邮箱验证完成注册并登陆网站。1.2 查看待接码的服务的价格在网站的左边下面一点可以看到,选择具体的项目点击查看具体价格。以chatGPT所需的openAI为例,最便宜需要30卢比。1.3 按需进行充值选择合适的支付方式即可,支持微信和支付宝。1.4 进行接码在待接码的平台注册好账号之后进入待接码的页面。从sms-activate 平台购买对应的激活接码服务,然后填入相应的号码,发送验证码即可稍后从平台收到相应的验证码。万一脸黑没收到验证码,可以在有效期内免费退一次的,我注册是立马就收到了,很顺利。
2023年02月21日
1,379 阅读
1 评论
0 点赞
2022-11-23
[LibreSpeed]:自建speedtest(服务器带宽测试工具)
1.背景自建了web服务有时候服务卡顿的时候想要测试一下客户端到服务器的带宽,使用专门的工具比较繁琐。因此考虑在服务器上搭建speedtest2.搭建步骤(基于宝塔)2.1 创建站点可以用域名-需要实现解析,也可以用IP:端口的方式访问$\color{red}{上面有个错误示范,PHP版本需要选,不能不指定PHP}$2.2 下载源码cd /www/wwwroot/speedtest.inat.top wget https://codeload.github.com/librespeed/speedtest/tar.gz/refs/tags/5.2.5/speedtest-5.2.5.tar.gz tar xzvf speedtest-5.2.5.tar.gz mv speedtest-5.2.5/* ./2.3 修改首页rm index.html cp example-singleServer-full.html index.html2.4 访问测试参考资料1.https://github.com/librespeed/speedtest
2022年11月23日
1,234 阅读
1 评论
0 点赞
2022-11-04
BaiduPCS-Go:仿 Linux shell 文件处理命令的百度网盘命令行客户端
BaiduPCS-Go:仿 Linux shell 文件处理命令的百度网盘命令行客户端1.简介当需要在没有图形界面的服务器上直接从百度云下载或者上传大量文件的时候,通过window中转会效率较低,BaiduPCS-Go是一款基于Go语言开发的仿 Linux shell 文件处理命令的百度网盘命令行客户端可以完美解决这个问题。项目地址:https://github.com/qjfoidnh/BaiduPCS-Go2.下载配置wget https://github.com/qjfoidnh/BaiduPCS-Go/releases/download/v3.8.7/BaiduPCS-Go-v3.8.7-linux-amd64.zip unzip BaiduPCS-Go-v3.8.7-linux-amd64.zip mv BaiduPCS-Go-v3.8.7-linux-amd64 BaiduPCS-Go cd BaiduPCS-Go3.使用方式进入BaiduPCS-Go命令模型BaiduPCS-Go用户登录login #根据提示登录 请输入百度用户名(手机号/邮箱/用户名), 回车键提交 >常用命令COMMANDS: tool 工具箱 help, ?, ? Shows a list of commands or help for one command 其他: clear, cls 清空控制台 env 显示程序环境变量 run 执行系统命令 sumfile, sf 获取本地文件的秒传信息 update 检测程序更新 百度帐号: login 登录百度账号 loglist 列出帐号列表 logout 退出百度帐号 su 切换百度帐号 who 获取当前帐号 百度网盘: cd 切换工作目录 cp 拷贝文件/目录 createsuperfile, csf 手动分片上传—合并分片文件 download, d 下载文件/目录 export, ep 导出文件/目录 fixmd5 修复文件MD5 locate, lt 获取下载直链 ls, l, ll 列出目录 match 测试通配符 meta 获取文件/目录的元信息 mkdir 创建目录 mv 移动/重命名文件/目录 offlinedl, clouddl, od 离线下载 pwd 输出工作目录 quota 获取网盘配额 rapidupload, ru 手动秒传文件 recycle 回收站 rm 删除文件/目录 search, s 搜索文件 share 分享文件/目录 transfer 转存文件/目录 tree, t 列出目录的树形图 upload, u 上传文件/目录 配置: config 显示和修改程序配置项4.使用下载效果image-20221104112121582.png
2022年11月04日
764 阅读
0 评论
0 点赞
2022-09-03
python修改支付宝步数
0.背景最近在弄支付宝的蚂蚁森林的能力,自己的步数每次都只有10000多点,攒能量攒不满,想提高积攒效率,就从网上找了找解决方案。最后发现了这个python+小米运动的实现方案1.操作步骤1.1 注册小米运动用手机号注册小米运动APP,登录,绑定微信和支付宝;1.2 修改并运行如下代码修改第144行的手机号码和第146行的密码,保存;# -*- coding: utf8 -*- # python >=3.8 import requests,time,re,json,random import os TG_BOT_TOKEN = "" # telegram bot token 自行申请 TG_USER_ID = "" # telegram 用户ID def telegram_bot(title, content): print("\n") tg_bot_token = TG_BOT_TOKEN tg_user_id = TG_USER_ID if "TG_BOT_TOKEN" in os.environ and "TG_USER_ID" in os.environ: tg_bot_token = os.environ["TG_BOT_TOKEN"] tg_user_id = os.environ["TG_USER_ID"] if not tg_bot_token or not tg_user_id: print("Telegram推送的tg_bot_token或者tg_user_id未设置!!\n取消推送") return print("Telegram 推送开始") send_data = {"chat_id": tg_user_id, "text": title + '\n\n'+content, "disable_web_page_preview": "true"} response = requests.post( url='https://api.telegram.org/bot%s/sendMessage' % (tg_bot_token), data=send_data) print(response.text) now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) headers = { 'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/20.6.18)' } #获取登录code def get_code(location): code_pattern = re.compile("(?<=access=).*?(?=&)") code = code_pattern.findall(location)[0] return code #登录 def login(user,password): url1 = "https://api-user.huami.com/registrations/+86" + user + "/tokens" headers = { "Content-Type":"application/x-www-form-urlencoded;charset=UTF-8", "User-Agent":"MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)" } data1 = { "client_id":"HuaMi", "password":f"{password}", "redirect_uri":"https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html", "token":"access" } r1 = requests.post(url1,data=data1,headers=headers,allow_redirects=False) location = r1.headers["Location"] try: code = get_code(location) except: return 0,0 #print("access_code获取成功!")ste #print(code) url2 = "https://account.huami.com/v2/client/login" data2 = { "app_name":"com.xiaomi.hm.health", "app_version":"4.6.0", "code":f"{code}", "country_code":"CN", "device_id":"2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1", "device_model":"phone", "grant_type":"access_token", "third_name":"huami_phone", } r2 = requests.post(url2,data=data2,headers=headers).json() login_token = r2["token_info"]["login_token"] #print("login_token获取成功!") #print(login_token) userid = r2["token_info"]["user_id"] #print("userid获取成功!") #print(userid) return login_token,userid #主函数 def main(user, passwd, step): user = str(user) password = str(passwd) step = str(step) if user == '' or password == '': print ("用户名或密码填写有误!") return if step == '': print ("已设置为随机步数(20000-29999)") step = str(random.randint(20000,29999)) login_token = 0 login_token,userid = login(user,password) if login_token == 0: print("登陆失败!") return "login fail!" t = get_time() app_token = get_app_token(login_token) today = time.strftime("%F") data_json = '%5B%7B%22data_hr%22%3A%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C%22wk%5C%22%3A0%2C%5C%22usrSt%5C%22%3A-1440%2C%5C%22usrEd%5C%22%3A-1440%2C%5C%22wc%5C%22%3A0%2C%5C%22is%5C%22%3A0%2C%5C%22lb%5C%22%3A0%2C%5C%22to%5C%22%3A0%2C%5C%22dt%5C%22%3A0%2C%5C%22rhr%5C%22%3A0%2C%5C%22ss%5C%22%3A0%7D%2C%5C%22stp%5C%22%3A%7B%5C%22ttl%5C%22%3A18272%2C%5C%22dis%5C%22%3A10627%2C%5C%22cal%5C%22%3A510%2C%5C%22wk%5C%22%3A41%2C%5C%22rn%5C%22%3A50%2C%5C%22runDist%5C%22%3A7654%2C%5C%22runCal%5C%22%3A397%2C%5C%22stage%5C%22%3A%5B%7B%5C%22start%5C%22%3A327%2C%5C%22stop%5C%22%3A341%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A481%2C%5C%22cal%5C%22%3A13%2C%5C%22step%5C%22%3A680%7D%2C%7B%5C%22start%5C%22%3A342%2C%5C%22stop%5C%22%3A367%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A368%2C%5C%22stop%5C%22%3A377%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A378%2C%5C%22stop%5C%22%3A386%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A387%2C%5C%22stop%5C%22%3A393%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A394%2C%5C%22stop%5C%22%3A398%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A399%2C%5C%22stop%5C%22%3A414%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A415%2C%5C%22stop%5C%22%3A427%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A428%2C%5C%22stop%5C%22%3A433%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%2C%7B%5C%22start%5C%22%3A434%2C%5C%22stop%5C%22%3A444%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A445%2C%5C%22stop%5C%22%3A455%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A456%2C%5C%22stop%5C%22%3A466%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A467%2C%5C%22stop%5C%22%3A477%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A478%2C%5C%22stop%5C%22%3A488%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A489%2C%5C%22stop%5C%22%3A499%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A500%2C%5C%22stop%5C%22%3A511%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A512%2C%5C%22stop%5C%22%3A522%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%5D%7D%2C%5C%22goal%5C%22%3A8000%2C%5C%22tz%5C%22%3A%5C%2228800%5C%22%7D%22%2C%22source%22%3A24%2C%22type%22%3A0%7D%5D' finddate = re.compile(r'.*?date%22%3A%22(.*?)%22%2C%22data.*?') findstep = re.compile(r'.*?ttl%5C%22%3A(.*?)%2C%5C%22dis.*?') data_json = re.sub(finddate.findall(data_json)[0], today, str(data_json)) data_json = re.sub(findstep.findall(data_json)[0], step, str(data_json)) url = f'https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={t}' head = { "apptoken": app_token, "Content-Type": "application/x-www-form-urlencoded" } data = f'userid={userid}&last_sync_data_time=1597306380&device_type=0&last_deviceid=DA932FFFFE8816E7&data_json={data_json}' response = requests.post(url, data=data, headers=head).json() #print(response) result = f"{user[:4]}****{user[-4:]}: [{now}] 修改步数({step})"+ response['message'] print(result) return result #获取时间戳 def get_time(): url = 'http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp' response = requests.get(url,headers=headers).json() t = response['data']['t'] return t #获取app_token def get_app_token(login_token): url = f"https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token={login_token}" response = requests.get(url,headers=headers).json() app_token = response['token_info']['app_token'] #print("app_token获取成功!") #print(app_token) return app_token if __name__ == "__main__": # 用户名(单用户的格式为 13800138000 ,多用户用#隔开,例如13800138000#13800138000#13800138000) user = "13800138000" # 登录密码(用#隔开,例如123456#123456#123456) passwd = "123456" # 要修改的步数,直接输入想要修改的步数值,留空为随机步数20000至29999之间 step = "" user_list = user.split('#') passwd_list = passwd.split('#') setp_array = step.split('-') if len(user_list) == len(passwd_list): push = '' for line in range(0,len(user_list)): if len(setp_array) == 2: step = str(random.randint(int(setp_array[0]),int(setp_array[1]))) elif str(step) == '0': step = '' push += main(user_list[line], passwd_list[line], step) + '\n' telegram_bot("小米运动", push) else: print('用户名和密码数量不对')放到python的版本大于等于3.8的环境下运行:python3 xiaomiyundong.py;1.3 设置定时任务* 19 * * * /home/admin/miniconda3/bin/python3 /software/xmyd/xmyd-5775.py参考资料Python 小米运动修改脚本-python版
2022年09月03日
548 阅读
0 评论
0 点赞
2022-09-02
将PPT的图保持高分辨率粘贴到Word
0.背景写论文在使用到了PPT画图,需要将画好的图便捷的导入到Word中,并保持矢量图的分辨率,放大缩小不模糊。一般直接使用屏幕截图会使分辨率降低,图片质量很差。直接复制粘贴也会出现同样的问题1.解决方案将PPT中画好的图组合在一起,选择组合后的图复制(Ctrl+c)在Word中,选中左上角的粘贴选项--->选择性粘贴选中图片(增强型图元文件),即可在Word中得到矢量图。参考资料将PPT里的图形高质量保存至Word【小技巧】如何将PPT的图保持高分辨率导入到Word中
2022年09月02日
1,192 阅读
0 评论
0 点赞
2022-08-31
Selenium:Python爬虫进阶
1.简介1.1 什么是Selenium?官网: Selenium是一个用于Web应用程序测试的工具。真实:大量用于网络爬虫,相比requests爬虫,完全模拟真人使用浏览器的流程,对于动态JS加载的网页更容易爬取1.2 Selenium的功能框架底层使用JavaScript模拟真实用户对浏览器进行操作。测试脚本执行时,浏览器自动按照脚本代码做出点击,输入,打开,验证等操作,就像真实用户所做的一样,从终端用户的角度测试应用程序。可用于较难的爬虫:动态JS加载、登录验证、表单提交等使用简单,可使用Python、Java等多种语言编写用例脚本。1.3 为什么要学习Selenium?requests爬虫局限性较大,分析困难、被封禁概率高可用于较难的爬虫伪装成真实的浏览器,被封禁的概率更低动态JS加载登录验证表单提交等1.4 Selenium的缺点相比requests,性能比较差,爬取的慢1.5 Selenium运行框架2.Selenium环境搭建1.电脑安装谷歌Chrome浏览器(其他浏览器不推荐)需要看一下当前的Chrome版本号,下载对应ChromeDriver2.下载安装 ChromeDriverhttps://www.selenium.dev/documentation/getting_started/installing_browser_drivers/windowns 放到C:\WebDriver\bin目录,这个目录加入系统PATH3.Python安装selenium库pip install selenium3.Selenium实战案例3.1 爬取电影天堂的视频真实下载地址用到selenium加载页面渲染出m3u8文件的地址from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from bs4 import BeautifulSoup import re # 实例化一个浏览器对象(传入浏览器的驱动程序) 通过Options实现无可视化界面的操作 chrome_options = Options() chrome_options.add_argument('--headless') # 不显示浏览器在后台运行 chrome_service = Service("chromedriver.exe"); browser = webdriver.Chrome(service=chrome_service,options=chrome_options) # 封装通过selenium获取html的方法 def get_html_by_selenium(url): # 对url发起请求 browser.get(url) # 等待页面加载完成 wait = WebDriverWait(browser, 3); # 获取页面源代码 page_html = browser.page_source return page_html # 电视剧页面地址_base base_url = "https://www.dy10000.com/wplay/68599-2-{}.html" # 生成下载脚本 for i in range(42,48): url = base_url.format(i) html = get_html_by_selenium(url) soup = BeautifulSoup(html, features='lxml') script_all = soup.body.find_all("script") for script in script_all: m3u8_search = re.search(r"http.*?m3u8", str(script)) if m3u8_search: url_m3u8 = m3u8_search.group(0).replace("\\", "") print("ffmpeg -i ", url_m3u8, " -c copy -bsf:a aac_adtstoasc " + str(i) + ".mp4") break # 退出浏览器 browser.quit()ffmpeg -i https://new.iskcd.com/20220518/FhKxDhXk/index.m3u8 -c copy -bsf:a aac_adtstoasc 42.mp4 ffmpeg -i https://new.iskcd.com/20220518/2MSrEhUz/index.m3u8 -c copy -bsf:a aac_adtstoasc 43.mp4 ffmpeg -i https://new.iskcd.com/20220519/7o5nJxJ3/index.m3u8 -c copy -bsf:a aac_adtstoasc 44.mp4 ffmpeg -i https://new.iskcd.com/20220519/BB2x9BaG/index.m3u8 -c copy -bsf:a aac_adtstoasc 45.mp4 ffmpeg -i https://new.iskcd.com/20220520/AxB2XF4T/index.m3u8 -c copy -bsf:a aac_adtstoasc 46.mp43.2 爬取电影先生的视频真实下载地址用到selenium加载页面渲染出m3u8文件的地址from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from bs4 import BeautifulSoup import re # 实例化一个浏览器对象(传入浏览器的驱动程序) 通过Options实现无可视化界面的操作 chrome_options = Options() chrome_options.add_argument('--headless') # 不显示浏览器在后台运行 chrome_service = Service("chromedriver.exe"); browser = webdriver.Chrome(service=chrome_service,options=chrome_options) # 封装通过selenium获取html的方法 def get_html_by_selenium(url): # 对url发起请求 browser.get(url) # 等待页面加载完成 wait = WebDriverWait(browser, 5); # 获取页面源代码 page_html = browser.page_source return page_html # 电视剧页面地址_base base_url = "https://dyxs15.com/paly-222156-5-{}/" # 生成下载脚本 for i in range(15,41): url = base_url.format(i) html = get_html_by_selenium(url) soup = BeautifulSoup(html, features='lxml') td_all = soup.body.find_all("td") for td in td_all: m3u8_search = re.search(r"http.*?m3u8", str(td)) if m3u8_search: url_m3u8 = m3u8_search.group(0).replace("\\", "") print("ffmpeg -i ", url_m3u8, " -c copy -bsf:a aac_adtstoasc " + str(i) + ".mp4") break break # 退出浏览器 browser.quit()ffmpeg -i https://new.qqaku.com/20220526/t5C1cVna/index.m3u8 -c copy -bsf:a aac_adtstoasc 15.mp4 ······ ffmpeg -i https://new.qqaku.com/20220617/Wpf7uowm/index.m3u8 -c copy -bsf:a aac_adtstoasc 40.mp4参考资料https://www.bilibili.com/video/BV1WF411z7qB自动化爬虫selenium基础教程selenium如何不显示浏览器在后台运行Python selenium的这三种等待方式一定要会!
2022年08月31日
860 阅读
0 评论
0 点赞
2022-08-30
天若OCR对接百度文字识别
0.背景在使用文字识别工具天若OCR的时候遇到搜狗、腾讯、有道等接口崩溃导致无法识别的问题,因此考虑使用百度的付费接口进行识别。1.百度文字识别API Key和Secret Key申请打开百度图文识别网站:https://console.bce.baidu.com/ai/#/ai/ocr/overview/index,输入账号密码登录;领取免费尝鲜略然后点击创建应用填写应用名称、应用归属、应用描述点击立即创建然后点击查看应用详情即可看到申请到的API Key和Secret Key2.对接天若OCR$\color{red}{!!!然后发现天若OCR修改密钥是付费版的特权}$$\color{red}{!!!再然后又发现5.0.0版本的虽然在软件里修改无法生效,但是直接修改Data/config.ini下的相关参数可以生效,感觉我的智商受到了侮辱}$[密钥_百度] secret_id=87gTF7eSNwA9z7L2OGuyaxAA secret_key=G5Yp5sA6POKKrFuGhcub21sGvzDIHaw2使用测试-真香3.自行调用-以JavaScript为例3.1 图片转换成base64格式var path = "/sdcard/pic/test01.jpg"; var imag64 = images.toBase64(images.read(path));3.2 获取access_tokenvar getTokenUrl="https://aip.baidubce.com/oauth/2.0/token"; var token_Res = http.post(getTokenUrl, { grant_type: "client_credentials", client_id: API_Key, //API Key client_secret: Secret_Key, //Secret Key }); var access_token = token_Res.body.json().access_token;3.3 调用百度ocr通用文字识别APIvar ocrUrl = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic"; var ocr_Res = http.post(ocrUrl, { headers: { "Content-Type": "application/x-www-form-urlencoded" }, access_token: access_token, //生成的token image: imag64, //生成的base64编码 language_type:"CHN_ENG" }); var json = ocr_Res.body.json();3.4 得到json格式结果:{ "words_result": [ {"words": "小微"}, {"words": "测试"} ], "log_id": 2471272194, "words_result_num": 2 }参考资料百度文字识别API Key和Secret Key申请及接口调用
2022年08月30日
882 阅读
0 评论
0 点赞
2022-06-15
Prometheus+Grafana:Linux设备群监控系统
1.Prometheus1.1. Prometheus简介Prometheus 是一款基于时序数据库的开源监控告警系统,非常适合Kubernetes集群的监控。Prometheus的基本原理是通过HTTP协议周期性抓取被监控组件的状态,任意组件只要提供对应的HTTP接口就可以接入监控。不需要任何SDK或者其他的集成过程。这样做非常适合做虚拟化环境监控系统,比如VM、Docker、Kubernetes等。输出被监控组件信息的HTTP接口被叫做exporter 。目前互联网公司常用的组件大部分都有exporter可以直接使用,比如Varnish、Haproxy、Nginx、MySQL、Linux系统信息(包括磁盘、内存、CPU、网络等等)。Promethus有以下特点:支持多维数据模型:由度量名和键值对组成的时间序列数据内置时间序列数据库TSDB支持PromQL查询语言,可以完成非常复杂的查询和分析,对图表展示和告警非常有意义支持HTTP的Pull方式采集时间序列数据支持PushGateway采集瞬时任务的数据支持服务发现和静态配置两种方式发现目标支持接入Grafana1.2. Prometheus架构1.2.1. Prometheus Server主要负责数据采集和存储,提供PromQL查询语言的支持。包含了三个组件:Retrieval: 获取监控数据TSDB: 时间序列数据库(Time Series Database),我们可以简单的理解为一个优化后用来处理时间序列数据的软件,并且数据中的数组是由时间进行索引的。具备以下特点:大部分时间都是顺序写入操作,很少涉及修改数据删除操作都是删除一段时间的数据,而不涉及到删除无规律数据读操作一般都是升序或者降序HTTP Server: 为告警和出图提供查询接口1.2.2. 指标采集Exporters: Prometheus的一类数据采集组件的总称。它负责从目标处搜集数据,并将其转化为Prometheus支持的格式。与传统的数据采集组件不同的是,它并不向中央服务器发送数据,而是等待中央服务器主动前来抓取Pushgateway: 支持临时性Job主动推送指标的中间网关1.2.3. 服务发现Kubernetes_sd: 支持从Kubernetes中自动发现服务和采集信息。而Zabbix监控项原型就不适合Kubernets,因为随着Pod的重启或者升级,Pod的名称是会随机变化的。file_sd: 通过配置文件来实现服务的自动发现1.2.4. 告警管理通过相关的告警配置,对触发阈值的告警通过页面展示、短信和邮件通知的方式告知运维人员。1.2.5. 图形化展示通过PromQL语句查询指标信息,并在页面展示。虽然Prometheus自带UI界面,但是大部分都是使用Grafana出图。另外第三方也可以通过 API 接口来获取监控指标。2.Prometheus简单部署2.1 部署和配置prometheus(在监控中心布置)下载prometheus(网页下载地址:https://prometheus.io/download/)wget https://github.com/prometheus/prometheus/releases/download/v2.36.1/prometheus-2.36.1.linux-amd64.tar.gz tar -xvf prometheus-2.36.1.linux-amd64.tar.gz mv prometheus-2.36.1.linux-amd64 prometheus cd prometheus修改配置文件vim prometheus.yml# my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: "prometheus" # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ["localhost:9090"] # node_exporter 监控数据采集 - job_name: 'node' static_configs: - targets: - "3090.inat.top:9100" - "v100.inat.top:9100" - "raspberry.inat.top:9100" - "agx.inat.top:9100" - "nx.inat.top:9100" - "nano.inat.top:9100"检查配置文件./promtool check config prometheus.yml启动测试./prometheus配置开机自启动sudo vim /etc/systemd/system/prometheus.service[Unit] Description=prometheus service After=network.target [Service] ExecStart=/software/prometheus/prometheus --config.file=/software/prometheus/prometheus.yml Restart=always RestartSec=20 TimeoutSec=300 User=root Group=root StandardOutput=journal StandardError=journal WorkingDirectory=/software/prometheus/ [Install] WantedBy=default.targetsudo systemctl daemon-reload sudo systemctl start prometheus.service sudo systemctl enable prometheus.servicesudo systemctl status prometheus.service2.2 部署Node-Exporter(在被监控的机器上布置)下载Node-Exporter(网页下载地址:https://prometheus.io/download/)wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz tar -xvf node_exporter-1.0.1.linux-amd64.tar.gz mv node_exporter-1.0.1.linux-amd64 node_exporter cd node_exporter创建monitor用户和组sudo groupadd -g 9100 monitor sudo useradd -g 9100 -u 9100 -s /sbin/nologin -M monitor修改对应文件夹的权限sudo chown -R monitor.monitor /software/node_exporter启动测试./node_exporter配置开机自启动sudo vim /etc/systemd/system/node_exporter.service[Unit] Description=node-exporter service After=network.target [Service] User=monitor Group=monitor KillMode=control-group Restart=on-failure RestartSec=60 ExecStart=/software/node_exporter/node_exporter [Install] WantedBy=multi-user.targetsudo systemctl daemon-reload sudo systemctl start node_exporter.service sudo systemctl enable node_exporter.servicesudo systemctl status node_exporter.service3.部署Grafana(在监控中心部署)下载Grafana(网页下载地址:https://grafana.com/grafana/download)sudo apt-get install -y adduser libfontconfig1 wget https://dl.grafana.com/enterprise/release/grafana-enterprise_8.5.5_amd64.deb sudo dpkg -i grafana-enterprise_8.5.5_amd64.deb设置开机自启动 sudo /bin/systemctl daemon-reload sudo /bin/systemctl start grafana-server sudo /bin/systemctl enable grafana-server sudo /bin/systemctl status grafana-server访问测试(默认用户名和密码均为admin)添加数据源添加dashbord查看dashbord参考资料Prometheus看完这些,入门就够了Prometheus 重启失败的教训Prometheus(普罗米修斯)监控Prometheus(普罗米修斯)监控系统(一)https://grafana.com/grafana/downloadhttps://prometheus.io/download/
2022年06月15日
958 阅读
0 评论
0 点赞
2022-06-14
Bitwarden:搭建自己的密码管理服务器
0.应用背景各种杂七杂八的APP实在太多了,使用统一密码容易导致密码泄露,使用不同的密码容易记不住,将密码存在第三方也怕会发生数据泄露和服务商倒闭,因此自行考虑搭建密码管理工具1.搭建步骤1.1 安装docker宝塔在软件商店安装Docker管理器即可,其它使用命令行安装sudo apt update sudo apt install docker.io1.2 拉取 vaultwarden/server镜像[备注:老版bitwardenrs/server和手机APP不兼容]docker pull vaultwarden/server1.3 运行容器docker run -d --name vaultwarden -v /vw-data/:/data/ -p 60080:80 vaultwarden/server:latest备注:-v /vw-data/:/data/为必须,否则会出现如下 No persistent volume 报错:/--------------------------------------------------------------------\ | Starting Vaultwarden | | Version 1.30.5 | |--------------------------------------------------------------------| | This is an *unofficial* Bitwarden implementation, DO NOT use the | | official channels to report bugs/features, regardless of client. | | Send usage/configuration questions or feature requests to: | | https://github.com/dani-garcia/vaultwarden/discussions or | | https://vaultwarden.discourse.group/ | | Report suspected bugs/issues in the software itself at: | | https://github.com/dani-garcia/vaultwarden/issues/new | \--------------------------------------------------------------------/ [2024-03-21 13:46:40.290][vaultwarden][ERROR] No persistent volume! ######################################################################################## # It looks like you did not configure a persistent volume! # # This will result in permanent data loss when the container is removed or updated! # # If you really want to use volatile storage set `I_REALLY_WANT_VOLATILE_STORAGE=true` # 1.4 通过nginx创建网站1.5 开启SSL1.6 添加反向代理1.7 访问测试参考资料密码管理 Bitwarden服务端部署文档搭建自己的密码管理服务器 Bitwarden使用云服务器+docker搭建私有密码库Vaultwarden_docker安装vaultwarden-CSDN博客自建Vaultwarden (Bitwarden) 无法登陆问题的解决办法 - FREEZhao
2022年06月14日
719 阅读
0 评论
0 点赞
2022-05-13
cifs:Ubuntu 挂载 Samba 共享文件夹
1.安装cifs-utifssudo apt-get install cifs-utils2.列举指定IP地址所提供的共享文件夹列表sudo apt install smbclient smbclient -L ${ip_addr} -U ${username}%${password}3.挂载共享文件夹sudo mount -t cifs //指定SambaIP/文件夹名 /mnt/ -o username=${username},password=${password},iocharset=utf8,vers=1.04.实现开机自动挂载在/etc/fstab的末尾加入如下内容vim /etc/fstab//指定SambaIP/文件夹名 /mnt/ cifs defaults,username=${username},password=${password},iocharset=utf8,vers=1.0参考资料Ubuntu 挂载 Samba 共享文件夹Ubuntu 下挂载samba 服务
2022年05月13日
775 阅读
0 评论
0 点赞
2022-04-19
常用网站推荐
1.小说下载八零电子书:https://www.txt80.com/熊猫搜书:https://xmsoushu.com/2.百度文库下载在待下载的文档的链接里面把baidu换成baiduvvveg:https://wenku.baidu.com/view/108dccfc487302768e9951e79b89680202d86b3a.html换成https://wenku.baiduvvv.com/view/108dccfc487302768e9951e79b89680202d86b3a.html3.论文下载sci-hub:https://sci-hub.se/4.网盘资源搜索大圣盘:https://www.dashengpan.com/大力盘:https://www.dalipan.com/5.影视资源搜索人人电影网:https://www.rrdynb.com/index.html -- 支持百度网盘保存电影先生:http://dyxs12.com/ -- 可以结合m3u8工具下载BD影视:https://www.bd2020.co/ -- 支持百度网盘保存热点剧更新 -- 支持百度网盘保存6.PPT模板免费下载优品PPT:https://www.ypppt.com/PPT宝藏:http://www.pptbz.com/PPT超级市场:https://www.pptsupermarket.com/office plus:https://www.officeplus.cn/7.简历模板免费下载office plus:https://www.officeplus.cn/8.图像处理图片背景消除:https://www.remove.bg/zh在线ps:https://ps.gaoding.com/#/9.临时邮箱临时邮箱,邮箱有效不限时间 https://www.linshi-email.com/YOPmail 邮箱有效5日 http://www.yopmail.com/10分钟邮箱 邮箱有效10分钟[可无限续时10分钟] https://10minutemail.net/Guerrilla 邮箱有效60分钟 https://www.guerrillamail.comTempMail 邮箱有效不限时 https://temp-mail.org/crazymailing 邮箱有效30分钟 https://www.crazymailing.com/10.jetbrains破解码Pycharm 激活码:https://docs.qq.com/doc/DUWhnVEN4VlJEQmJ3?dver=IDEA 激活码:https://ma.qieit.com/idea.html
2022年04月19日
1,898 阅读
5 评论
2 点赞
2022-04-13
CommentToMail:给博客添加评论邮箱提醒功能
1.下载安装首先下载插件再上传到/usr/plugins目录解压,博客后台启用并配置插件。下载地址:CommentToMail2.配置邮箱smtp地址:smtp.qq.com(我用的QQ邮箱)SMTP端口:465SMTP用户:自己的邮箱账户SMTP密码:开启smtp时获取的授权码(QQ在设置-账户里面,其他百度)STMP验证:服务器需要验证、ssl加密全打勾3.美化代码3.1步骤一依次打开:博客后台 -> 控制台 -> 评论邮件提醒 -> 编辑邮件模板3.2步骤二将以下代码复制粘贴到guest.html<table style="width: 99.8%;height:99.8% "><tbody><tr><td style="background:#fafafa url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAy0lEQVQY0x2PsQtAYBDFP1keKZfBKIqNycCERUkMKLuSgZnRarIpJX8s3zfcDe9+794du+8bRVHQOI4wDAOmaULTNDDGYFkWMVVVQUTQdZ3iOMZxHCjLElVV0TRNYHVdC7ptW6RpSn3f4wdJkiTs+w6WJAl4DcOAbdugKAq974umaRAEARgXn+cRW3zfFxuiKCJZloXGHMeBbdv4Beq6Duu6Issy7iYB8Jbnucg8zxPLsggnj/zvIxaGIXmeB9d1wSE+nOeZf4HruvABUtou5ypjMF4AAAAASUVORK5CYII=')"> <div style="border-radius: 10px 10px 10px 10px;font-size:13px; color: #555555;width: 666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background: #ffffff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);"> <div style="width:100%;background:#49BDAD;color:#ffffff;border-radius: 10px 10px 0 0;background-image: -moz-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));background-image: -webkit-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));height: 66px;"> <p style="font-size:15px;word-break:break-all;padding: 23px 32px;margin:0;background-color: hsla(0,0%,100%,.4);border-radius: 10px 10px 0 0;">您在<a style="text-decoration:none;color: #ffffff;" href="https:"> {siteTitle} </a>上的留言有新回复啦! </p> </div> <div style="margin:40px auto;width:90%"> <p>{author_p} 您曾在文章《{title}》上发表评论:</p> <p style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">{text_p}</p> <p>{author} 给您的回复如下:</p> <p style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">{text}</p> <p>您可以点击 <a style="text-decoration:none; color:#12addb" href="{permalink}">查看回复的完整內容 </a>,欢迎再次光临 <a style="text-decoration:none; color:#12addb" href="https:"> {siteTitle} </a>。</p> <style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style> </div> </div> </td></tr></tbody></table>3.3步骤三接着将以下代码复制粘贴到owner.html<style> .wrap span { display: inline-block; } .w260{ width: 260px;} .w20{ width: 20px;} .wauto{ width: auto;} </style> <table style="width: 99.8%;height:99.8% "><tbody><tr><td style="background:#fafafa url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAy0lEQVQY0x2PsQtAYBDFP1keKZfBKIqNycCERUkMKLuSgZnRarIpJX8s3zfcDe9+794du+8bRVHQOI4wDAOmaULTNDDGYFkWMVVVQUTQdZ3iOMZxHCjLElVV0TRNYHVdC7ptW6RpSn3f4wdJkiTs+w6WJAl4DcOAbdugKAq974umaRAEARgXn+cRW3zfFxuiKCJZloXGHMeBbdv4Beq6Duu6Issy7iYB8Jbnucg8zxPLsggnj/zvIxaGIXmeB9d1wSE+nOeZf4HruvABUtou5ypjMF4AAAAASUVORK5CYII=')"> <div style="border-radius: 10px 10px 10px 10px;font-size:13px; color: #555555;width: 666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background: #ffffff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);"> <div style="width:100%;background:#49BDAD;color:#ffffff;border-radius: 10px 10px 0 0;background-image: -moz-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));background-image: -webkit-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));height: 66px;"> <p style="font-size:15px;word-break:break-all;padding: 23px 32px;margin:0;background-color: hsla(0,0%,100%,.4);border-radius: 10px 10px 0 0;">您的<a style="text-decoration:none;color: #ffffff;" href="https:"> {siteTitle} </a>上有新的评论啦! </p> </div> <div style="margin:40px auto;width:90%"> <p>{author} 在您文章《{title}》上发表评论:</p> <p style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">{text}</p> <p class="wrap" style="text-decoration:none"><span class="w260">时间:{time}</span><span class="w20"> </span><span class="wauto"> IP:{ip}</span></p> <p class="wrap" style="text-decoration:none"><span class="w260">邮箱:{mail}</span><span class="w20"> </span><span class="wauto">状态:{status}</span></p> <p><a style="text-decoration:none; color:#12addb" href="{permalink}" target='_blank'>[查看评论]</a> | <a style="text-decoration:none; color:#12addb" href="{manage}" target='_blank'>[管理评论] </a></p> <style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style> </div> </div> </td></tr></tbody></table>注意:要把里面的链接改为自己的哦3.4美化效果被评论:被回复:
2022年04月13日
588 阅读
0 评论
0 点赞
1
2
3
...
5