自动化运维-检测Linux服务器CPU、内存、负载、IO读写、机房带宽和服务器类型等信息脚本

前言:以上脚本为今年8月1号发布的,当时是没有任何问题,但现在脚本里网络速度测试py文件获取不了了,测速这块功能目前无法实现,后面我会抽时间来研究,大家如果有建议也可以分享下。在这里插入图片描述

脚本内容:

#!/usr/bin/env bash
#
#
#
#RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
SKYBLUE='\033[0;36m'
PLAIN='\033[0m'about() {echo ""echo " ========================================================= "echo " \                 Superbench.sh  Script                 / "echo " \       Basic system info, I/O test and speedtest       / "echo " \                   v1.1.7 (7 Apr 2024)                 / "echo " \                   Created by Oldking                  / "echo " ========================================================= "echo ""echo " Intro: https://www.oldking.net/350.html"echo " Copyright (C) 2024 Oldking oooldking@gmail.com"echo ""
}cancel() {echo ""next;echo " Abort ..."echo " Cleanup ..."cleanup;echo " Done"exit
}trap cancel SIGINTbenchinit() {if [ -f /etc/redhat-release ]; thenrelease="centos"elif cat /etc/issue | grep -Eqi "debian"; thenrelease="debian"elif cat /etc/issue | grep -Eqi "ubuntu"; thenrelease="ubuntu"elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; thenrelease="centos"elif cat /proc/version | grep -Eqi "debian"; thenrelease="debian"elif cat /proc/version | grep -Eqi "ubuntu"; thenrelease="ubuntu"elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; thenrelease="centos"fi[[ $EUID -ne 0 ]] && echo -e "${RED}Error:${PLAIN} This script must be run as root!" && exit 1if  [ ! -e '/usr/bin/python' ]; thenecho " Installing Python ..."if [ "${release}" == "centos" ]; thenyum update > /dev/null 2>&1yum -y install python > /dev/null 2>&1elseapt-get update > /dev/null 2>&1apt-get -y install python > /dev/null 2>&1fifiif  [ ! -e '/usr/bin/curl' ]; thenecho " Installing Curl ..."if [ "${release}" == "centos" ]; thenyum update > /dev/null 2>&1yum -y install curl > /dev/null 2>&1elseapt-get update > /dev/null 2>&1apt-get -y install curl > /dev/null 2>&1fifiif  [ ! -e '/usr/bin/wget' ]; thenecho " Installing Wget ..."if [ "${release}" == "centos" ]; thenyum update > /dev/null 2>&1yum -y install wget > /dev/null 2>&1elseapt-get update > /dev/null 2>&1apt-get -y install wget > /dev/null 2>&1fifiif  [ ! -e './speedtest-cli/speedtest' ]; thenecho " Installing Speedtest-cli ..."wget --no-check-certificate -qO speedtest.tgz https://cdn.jsdelivr.net/gh/oooldking/script@1.1.7/speedtest_cli/ookla-speedtest-1.0.0-$(uname -m)-linux.tgz > /dev/null 2>&1fimkdir -p speedtest-cli && tar zxvf speedtest.tgz -C ./speedtest-cli/ > /dev/null 2>&1 && chmod a+rx ./speedtest-cli/speedtestif  [ ! -e 'tools.py' ]; thenecho " Installing tools.py ..."wget --no-check-certificate https://cdn.jsdelivr.net/gh/oooldking/script@1.1.7/tools.py > /dev/null 2>&1fichmod a+rx tools.pyif  [ ! -e 'fast_com.py' ]; thenecho " Installing Fast.com-cli ..."wget --no-check-certificate https://cdn.jsdelivr.net/gh/sanderjo/fast.com@master/fast_com.py > /dev/null 2>&1wget --no-check-certificate https://cdn.jsdelivr.net/gh/sanderjo/fast.com@master/fast_com_example_usage.py > /dev/null 2>&1fichmod a+rx fast_com.pychmod a+rx fast_com_example_usage.pysleep 5start=$(date +%s) 
}get_opsy() {[ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return[ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return[ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
}next() {printf "%-70s\n" "-" | sed 's/\s/-/g' | tee -a $log
}speed_test(){if [[ $1 == '' ]]; thenspeedtest-cli/speedtest -p no --accept-license > $speedLog 2>&1is_upload=$(cat $speedLog | grep 'Upload')result_speed=$(cat $speedLog | awk -F ' ' '/Result/{print $3}')if [[ ${is_upload} ]]; thenlocal REDownload=$(cat $speedLog | awk -F ' ' '/Download/{print $3}')local reupload=$(cat $speedLog | awk -F ' ' '/Upload/{print $3}')local relatency=$(cat $speedLog | awk -F ' ' '/Latency/{print $2}')temp=$(echo "$relatency" | awk -F '.' '{print $1}')if [[ ${temp} -gt 50 ]]; thenrelatency="(*)"${relatency}filocal nodeName=$2temp=$(echo "${REDownload}" | awk -F ' ' '{print $1}')if [[ $(awk -v num1=${temp} -v num2=0 'BEGIN{print(num1>num2)?"1":"0"}') -eq 1 ]]; thenprintf "${YELLOW}%-18s${GREEN}%-18s${RED}%-20s${SKYBLUE}%-12s${PLAIN}\n" " ${nodeName}" "${reupload} Mbit/s" "${REDownload} Mbit/s" "${relatency} ms" | tee -a $logfielselocal cerror="ERROR"fielsespeedtest-cli/speedtest -p no -s $1 --accept-license > $speedLog 2>&1is_upload=$(cat $speedLog | grep 'Upload')if [[ ${is_upload} ]]; thenlocal REDownload=$(cat $speedLog | awk -F ' ' '/Download/{print $3}')local reupload=$(cat $speedLog | awk -F ' ' '/Upload/{print $3}')local relatency=$(cat $speedLog | awk -F ' ' '/Latency/{print $2}')local nodeName=$2temp=$(echo "${REDownload}" | awk -F ' ' '{print $1}')if [[ $(awk -v num1=${temp} -v num2=0 'BEGIN{print(num1>num2)?"1":"0"}') -eq 1 ]]; thenprintf "${YELLOW}%-18s${GREEN}%-18s${RED}%-20s${SKYBLUE}%-12s${PLAIN}\n" " ${nodeName}" "${reupload} Mbit/s" "${REDownload} Mbit/s" "${relatency} ms" | tee -a $logfielselocal cerror="ERROR"fifi
}print_speedtest() {printf "%-18s%-18s%-20s%-12s\n" " Node Name" "Upload Speed" "Download Speed" "Latency" | tee -a $logspeed_test '' 'Speedtest.net'speed_fast_comspeed_test '27377' 'Beijing 5G   CT'speed_test '26352' 'Nanjing 5G   CT'speed_test '17145' 'Hefei 5G     CT'speed_test '27594' 'Guangzhou 5G CT'speed_test '27154' 'TianJin 5G   CU'speed_test '24447' 'Shanghai 5G  CU'speed_test '26678' 'Guangzhou 5G CU'speed_test '17184' 'Tianjin 5G   CM'speed_test '26850' 'Wuxi 5G      CM'speed_test '27249' 'Nanjing 5G   CM'speed_test '26404' 'Hefei 5G     CM'speed_test '28491' 'Changsha 5G  CM'rm -rf speedtest*
}print_speedtest_fast() {printf "%-18s%-18s%-20s%-12s\n" " Node Name" "Upload Speed" "Download Speed" "Latency" | tee -a $logspeed_test '' 'Speedtest.net'speed_fast_comspeed_test '27377' 'Beijing 5G   CT'speed_test '24447' 'ShangHai 5G  CU'speed_test '27249' 'Nanjing 5G   CM'rm -rf speedtest*
}speed_fast_com() {temp=$(python fast_com_example_usage.py 2>&1)is_down=$(echo "$temp" | grep 'Result') if [[ ${is_down} ]]; thentemp1=$(echo "$temp" | awk -F ':' '/Result/{print $2}')temp2=$(echo "$temp1" | awk -F ' ' '/Mbps/{print $1}')local REDownload="$temp2 Mbit/s"local reupload="0.00 Mbit/s"local relatency="-"local nodeName="Fast.com"printf "${YELLOW}%-18s${GREEN}%-18s${RED}%-20s${SKYBLUE}%-12s${PLAIN}\n" " ${nodeName}" "${reupload}" "${REDownload}" "${relatency}" | tee -a $logelselocal cerror="ERROR"firm -rf fast_com_example_usage.pyrm -rf fast_com.py}io_test() {(LANG=C dd if=/dev/zero of=test_file_$$ bs=512K count=$1 conv=fdatasync && rm -f test_file_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'
}calc_disk() {local total_size=0local array=$@for size in ${array[@]}do[ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`[ "`echo ${size:(-1)}`" == "K" ] && size=0[ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' )[ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' )[ "`echo ${size:(-1)}`" == "G" ] && size=${size_t}total_size=$( awk 'BEGIN{printf "%.1f", '$total_size' + '$size'}' )doneecho ${total_size}
}power_time() {result=$(smartctl -a $(result=$(cat /proc/mounts) && echo $(echo "$result" | awk '/data=ordered/{print $1}') | awk '{print $1}') 2>&1) && power_time=$(echo "$result" | awk '/Power_On/{print $10}') && echo "$power_time"
}install_smart() {if  [ ! -e '/usr/sbin/smartctl' ]; thenecho "Installing Smartctl ..."if [ "${release}" == "centos" ]; thenyum update > /dev/null 2>&1yum -y install smartmontools > /dev/null 2>&1elseapt-get update > /dev/null 2>&1apt-get -y install smartmontools > /dev/null 2>&1fi      fi
}ip_info4(){ip_date=$(curl -4 -s http://api.ip.la/en?json)echo $ip_date > ip_json.jsonisp=$(python tools.py geoip isp)as_tmp=$(python tools.py geoip as)asn=$(echo $as_tmp | awk -F ' ' '{print $1}')org=$(python tools.py geoip org)if [ -z "ip_date" ]; thenecho $ip_dateecho "hala"country=$(python tools.py ipip country_name)city=$(python tools.py ipip city)countryCode=$(python tools.py ipip country_code)region=$(python tools.py ipip province)elsecountry=$(python tools.py geoip country)city=$(python tools.py geoip city)countryCode=$(python tools.py geoip countryCode)region=$(python tools.py geoip regionName)	fiif [ -z "$city" ]; thencity=${region}fiecho -e " ASN & ISP            : ${SKYBLUE}$asn, $isp${PLAIN}" | tee -a $logecho -e " Organization         : ${YELLOW}$org${PLAIN}" | tee -a $logecho -e " Location             : ${SKYBLUE}$city, ${YELLOW}$country / $countryCode${PLAIN}" | tee -a $logecho -e " Region               : ${SKYBLUE}$region${PLAIN}" | tee -a $logrm -rf tools.pyrm -rf ip_json.json
}virt_check(){if hash ifconfig 2>/dev/null; theneth=$(ifconfig)fivirtualx=$(dmesg) 2>/dev/nullif  [ $(which dmidecode) ]; thensys_manu=$(dmidecode -s system-manufacturer) 2>/dev/nullsys_product=$(dmidecode -s system-product-name) 2>/dev/nullsys_ver=$(dmidecode -s system-version) 2>/dev/nullelsesys_manu=""sys_product=""sys_ver=""fiif grep docker /proc/1/cgroup -qa; thenvirtual="Docker"elif grep lxc /proc/1/cgroup -qa; thenvirtual="Lxc"elif grep -qa container=lxc /proc/1/environ; thenvirtual="Lxc"elif [[ -f /proc/user_beancounters ]]; thenvirtual="OpenVZ"elif [[ "$virtualx" == *kvm-clock* ]]; thenvirtual="KVM"elif [[ "$cname" == *KVM* ]]; thenvirtual="KVM"elif [[ "$cname" == *QEMU* ]]; thenvirtual="KVM"elif [[ "$virtualx" == *"VMware Virtual Platform"* ]]; thenvirtual="VMware"elif [[ "$virtualx" == *"Parallels Software International"* ]]; thenvirtual="Parallels"elif [[ "$virtualx" == *VirtualBox* ]]; thenvirtual="VirtualBox"elif [[ -e /proc/xen ]]; thenvirtual="Xen"elif [[ "$sys_manu" == *"Microsoft Corporation"* ]]; thenif [[ "$sys_product" == *"Virtual Machine"* ]]; thenif [[ "$sys_ver" == *"7.0"* || "$sys_ver" == *"Hyper-V" ]]; thenvirtual="Hyper-V"elsevirtual="Microsoft Virtual Machine"fifielsevirtual="Dedicated"fi
}power_time_check(){echo -ne " Power time of disk   : "install_smartptime=$(power_time)echo -e "${SKYBLUE}$ptime Hours${PLAIN}"
}freedisk() {freespace=$( df -m . | awk 'NR==2 {print $4}' )if [[ $freespace == "" ]]; then$freespace=$( df -m . | awk 'NR==3 {print $3}' )fiif [[ $freespace -gt 1024 ]]; thenprintf "%s" $((1024*2))elif [[ $freespace -gt 512 ]]; thenprintf "%s" $((512*2))elif [[ $freespace -gt 256 ]]; thenprintf "%s" $((256*2))elif [[ $freespace -gt 128 ]]; thenprintf "%s" $((128*2))elseprintf "1"fi
}print_io() {if [[ $1 == "fast" ]]; thenwritemb=$((128*2))elsewritemb=$(freedisk)fiwritemb_size="$(( writemb / 2 ))MB"if [[ $writemb_size == "1024MB" ]]; thenwritemb_size="1.0GB"fiif [[ $writemb != "1" ]]; thenecho -n " I/O Speed( $writemb_size )   : " | tee -a $logio1=$( io_test $writemb )echo -e "${YELLOW}$io1${PLAIN}" | tee -a $logecho -n " I/O Speed( $writemb_size )   : " | tee -a $logio2=$( io_test $writemb )echo -e "${YELLOW}$io2${PLAIN}" | tee -a $logecho -n " I/O Speed( $writemb_size )   : " | tee -a $logio3=$( io_test $writemb )echo -e "${YELLOW}$io3${PLAIN}" | tee -a $logioraw1=$( echo $io1 | awk 'NR==1 {print $1}' )[ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' )ioraw2=$( echo $io2 | awk 'NR==1 {print $1}' )[ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' )ioraw3=$( echo $io3 | awk 'NR==1 {print $1}' )[ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' )ioall=$( awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}' )ioavg=$( awk 'BEGIN{printf "%.1f", '$ioall' / 3}' )echo -e " Average I/O Speed    : ${YELLOW}$ioavg MB/s${PLAIN}" | tee -a $logelseecho -e " ${RED}Not enough space!${PLAIN}"fi
}print_system_info() {echo -e " CPU Model            : ${SKYBLUE}$cname${PLAIN}" | tee -a $logecho -e " CPU Cores            : ${YELLOW}$cores Cores ${SKYBLUE}$freq MHz $arch${PLAIN}" | tee -a $logecho -e " CPU Cache            : ${SKYBLUE}$corescache ${PLAIN}" | tee -a $logecho -e " OS                   : ${SKYBLUE}$opsy ($lbit Bit) ${YELLOW}$virtual${PLAIN}" | tee -a $logecho -e " Kernel               : ${SKYBLUE}$kern${PLAIN}" | tee -a $logecho -e " Total Space          : ${SKYBLUE}$disk_used_size GB / ${YELLOW}$disk_total_size GB ${PLAIN}" | tee -a $logecho -e " Total RAM            : ${SKYBLUE}$uram MB / ${YELLOW}$tram MB ${SKYBLUE}($bram MB Buff)${PLAIN}" | tee -a $logecho -e " Total SWAP           : ${SKYBLUE}$uswap MB / $swap MB${PLAIN}" | tee -a $logecho -e " Uptime               : ${SKYBLUE}$up${PLAIN}" | tee -a $logecho -e " Load Average         : ${SKYBLUE}$load${PLAIN}" | tee -a $logecho -e " TCP CC               : ${YELLOW}$tcpctrl${PLAIN}" | tee -a $log
}print_end_time() {end=$(date +%s) time=$(( $end - $start ))if [[ $time -gt 60 ]]; thenmin=$(expr $time / 60)sec=$(expr $time % 60)echo -ne " Finished in  : ${min} min ${sec} sec" | tee -a $logelseecho -ne " Finished in  : ${time} sec" | tee -a $logfiprintf '\n' | tee -a $logbj_time=$(curl -s http://cgi.im.qq.com/cgi-bin/cgi_svrtime)if [[ $(echo $bj_time | grep "html") ]]; thenbj_time=$(date -u +%Y-%m-%d" "%H:%M:%S -d '+8 hours')fiecho " Timestamp    : $bj_time GMT+8" | tee -a $logecho " Results      : $log"
}get_system_info() {cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )corescache=$( awk -F: '/cache size/ {cache=$2} END {print cache}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )tram=$( free -m | awk '/Mem/ {print $2}' )uram=$( free -m | awk '/Mem/ {print $3}' )bram=$( free -m | awk '/Mem/ {print $6}' )swap=$( free -m | awk '/Swap/ {print $2}' )uswap=$( free -m | awk '/Swap/ {print $3}' )up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days %d hour %d min\n",a,b,c)}' /proc/uptime )load=$( w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' )opsy=$( get_opsy )arch=$( uname -m )lbit=$( getconf LONG_BIT )kern=$( uname -r )disk_size1=$( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|overlay|shm|udev|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' )disk_size2=$( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|overlay|shm|udev|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' )disk_total_size=$( calc_disk ${disk_size1[@]} )disk_used_size=$( calc_disk ${disk_size2[@]} )tcpctrl=$( sysctl net.ipv4.tcp_congestion_control | awk -F ' ' '{print $3}' )virt_check
}print_intro() {printf ' Superbench.sh -- https://www.oldking.net/350.html\n' | tee -a $logprintf " Mode  : \e${GREEN}%s\e${PLAIN}    Version : \e${GREEN}%s${PLAIN}\n" $mode_name 1.1.7 | tee -a $logprintf ' Usage : wget -qO- sb.oldking.net | bash\n' | tee -a $log
}sharetest() {echo " Share result:" | tee -a $logecho " · $result_speed" | tee -a $loglog_preuploadcase $1 in'ubuntu')share_link="https://paste.ubuntu.com"$( curl -v --data-urlencode "content@$log_up" -d "poster=superbench.sh" -d "syntax=text" "https://paste.ubuntu.com" 2>&1 | \grep "Location" | awk '{print $3}' );;'haste' )share_link=$( curl -X POST -s -d "$(cat $log)" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}' );;'clbin' )share_link=$( curl -sF 'clbin=<-' https://clbin.com < $log );;'ptpb' )share_link=$( curl -sF c=@- https://ptpb.pw/?u=1 < $log );;esacecho " · $share_link" | tee -a $lognextecho ""rm -f $log_up}log_preupload() {log_up="$HOME/superbench_upload.log"true > $log_up$(cat superbench.log 2>&1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > $log_up)
}cleanup() {rm -f test_file_*rm -rf speedtest*rm -f fast_com*rm -f tools.pyrm -f ip_json.json
}bench_all(){mode_name="Standard"about;benchinit;clearnext;print_intro;next;get_system_info;print_system_info;ip_info4;next;print_io;next;print_speedtest;next;print_end_time;next;cleanup;sharetest ubuntu;
}fast_bench(){mode_name="Fast"about;benchinit;clearnext;print_intro;next;get_system_info;print_system_info;ip_info4;next;print_io fast;next;print_speedtest_fast;next;print_end_time;next;cleanup;
}log="./superbench.log"
true > $log
speedLog="./speedtest.log"
true > $speedLogcase $1 in'info'|'-i'|'--i'|'-info'|'--info' )about;sleep 3;next;get_system_info;print_system_info;next;;'version'|'-v'|'--v'|'-version'|'--version')next;about;next;;'io'|'-io'|'--io'|'-drivespeed'|'--drivespeed' )next;print_io;next;;'speed'|'-speed'|'--speed'|'-speedtest'|'--speedtest'|'-speedcheck'|'--speedcheck' )about;benchinit;next;print_speedtest;next;cleanup;;'ip'|'-ip'|'--ip'|'geoip'|'-geoip'|'--geoip' )about;benchinit;next;ip_info4;next;cleanup;;'bench'|'-a'|'--a'|'-all'|'--all'|'-bench'|'--bench' )bench_all;;'about'|'-about'|'--about' )about;;'fast'|'-f'|'--f'|'-fast'|'--fast' )fast_bench;;'share'|'-s'|'--s'|'-share'|'--share' )bench_all;is_share="share"if [[ $2 == "" ]]; thensharetest ubuntu;elsesharetest $2;fi;;'debug'|'-d'|'--d'|'-debug'|'--debug' )get_ip_whois_org_name;;
*)bench_all;;
esacif [[  ! $is_share == "share" ]]; thencase $2 in'share'|'-s'|'--s'|'-share'|'--share' )if [[ $3 == '' ]]; thensharetest ubuntu;elsesharetest $3;fi;;esac
fi

脚本执行结果:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/474212.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

H.265流媒体播放器EasyPlayer.js网页直播/点播播放器WebGL: CONTEXT_LOST_WEBGL错误引发的原因

EasyPlayer无插件直播流媒体音视频播放器属于一款高效、精炼、稳定且免费的流媒体播放器&#xff0c;可支持多种流媒体协议播放&#xff0c;无须安装任何插件&#xff0c;起播快、延迟低、兼容性强&#xff0c;使用非常便捷。 EasyPlayer.js能够同时支持HTTP、HTTP-FLV、HLS&a…

OCRSpace申请free api流程

0.OCRSpace概述 OCR.Space是一款功能强大的在线光学字符识别&#xff08;OCR&#xff09;工具。 格式与语言支持广泛&#xff1a;支持多种图片格式&#xff0c;如 JPG、PNG、GIF、PDF 等作为输入。在语言方面&#xff0c;它支持英语、中文、法语、德语等20多种语言的文字识别…

Linux Kernel Programming 2

目录 书写内核框架 起手我们需要理解的是&#xff1a;用户态和内核态 库和系统调用 API 内核空间组件 探索 LKM&#xff08;Linux Kernel Module体系&#xff09; LKM 框架 内核源代码树中的内核模块 modinfo 动手&#xff01;写年轻人的第一个内核模块程序 先试试看&…

机器学习基础04

目录 1.朴素贝叶斯-分类 1.1贝叶斯分类理论 1.2条件概率 1.3全概率公式 1.4贝叶斯推断 1.5朴素贝叶斯推断 1.6拉普拉斯平滑系数 1.7API 2.决策树-分类 2.1决策树 2.2基于信息增益的决策树建立 2.2.1信息熵 2.2.2信息增益 2.2.3信息增益决策树建立步骤 2.3基于基…

ChatGPT学术专用版,一键润色纠错+中英互译+批量翻译PDF

ChatGPT academic项目是由中科院团队基于ChatGPT专属定制。论文润色、语法检查、中英互译、代码解释等可一键搞定&#xff0c;堪称科研神器。 功能介绍 我们以3.5版本为例&#xff0c;ChatGPT学术版总共分为五个区域&#xff1a;输入控制区、输出对话区、基础功能区、函数插件…

fpga 同步fifo

FIFO 基础知识 FIFO&#xff08;First In First Out&#xff0c;即先入先出&#xff09;&#xff0c;是一种数据缓存器&#xff0c;用来实现数据先入先出 的读写方式。在 FPGA 或者 ASIC 中使用到的 FIFO 一般指的是对数据的存储具有先入先出 特性的缓存器&#xff0c;常被用于…

模式:每个服务一个数据库

Pattern: Database per service。 背景 如用微服务架构模式开发一个在线商店应用程序。大多数服务需要在某种数据库中持久化数据。如&#xff0c;订单服务存储订单信息&#xff0c;而客户服务存储客户信息。 问题 微服务应用程序中的数据库架构是什么&#xff1f; 驱动力…

Java 全栈知识体系

包含: Java 基础, Java 部分源码, JVM, Spring, Spring Boot, Spring Cloud, 数据库原理, MySQL, ElasticSearch, MongoDB, Docker, k8s, CI&CD, Linux, DevOps, 分布式, 中间件, 开发工具, Git, IDE, 源码阅读&#xff0c;读书笔记, 开源项目...

WebRTC实现双端音视频聊天(Vue3 + SpringBoot)

目录 概述 相关概念 双端连接整体实现步骤概述 文章代码实现注意点 STUN和TURN服务器的搭建 开发过程描述 后端开发流程 前端开发流程 效果演示 Gitee源码地址 概述 文章描述使用WebRTC技术实现一对一音视频通话。 由于设备摄像头限制&#xff08;一台电脑作测试无法…

机器学习3

六、朴素贝叶斯分类 背景知识&#xff1a;第三大点的第4点&#xff1a;概率 基础定义_数学概率中事件的定义-CSDN博客 1、条件概率 &#x1d443;(&#x1d434;|&#x1d435;)&#x1d443;(&#x1d434;∩&#x1d435;)/&#x1d443;(&#x1d435;) &#xff1a;A事件在…

SpringBoot Data Redis连接Redis-Cluster集群

使用SpringBoot Data Redis无法连接Redis-Cluster集群 最近在研究系统高并发下的缓存架构&#xff0c;因此自己在自己买的云服务器上搭建好Redis 5.0 版本的集群后&#xff0c;使用springboot的 RedisTemplate连接是发现总是访问不到集群节点。上网百度了发现没有好的解决办法&…

网页作业9

<!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>服务中心</title><style>* {margin:…

基于yolov8、yolov5的行人检测识别系统(含UI界面、训练好的模型、Python代码、数据集)

摘要&#xff1a;行人检测在交通管理、智能监控和公共安全中起着至关重要的作用&#xff0c;不仅能帮助相关部门实时监控人群动态&#xff0c;还为自动化监控系统提供了可靠的数据支撑。本文介绍了一款基于YOLOv8、YOLOv5等深度学习框架的行人检测模型&#xff0c;该模型使用了…

递归(3)----力扣40组合数2,力扣473火柴拼正方形

给定一个候选人编号的集合 candidates 和一个目标数 target &#xff0c;找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的每个数字在每个组合中只能使用 一次 。 注意&#xff1a;解集不能包含重复的组合。 示例 1: 输入: candidates [10,1,2,7,6,1…

1Panel 推送 SSL 证书到阿里云、腾讯云

本文首发于 Anyeの小站&#xff0c;点击链接 访问原文体验更佳 前言 都用 CDN 了还在乎那点 1 年证书钱么&#xff1f; 开句玩笑话&#xff0c;按照 Apple 的说法&#xff0c;证书有效期不该超过 45 天。那么证书有效期的缩短意味着要更频繁地更新证书。对于我这样的“裸奔”…

通过shell脚本分析部署nginx网络服务

通过shell脚本分析部署nginx网络服务 1.接收用户部署的服务名称 [rootlocalhost xzy]# vim 1.sh [rootlocalhost xzy]# chmod x 1.sh [rootlocalhost xzy]# ./1.sh2.判断服务是否安装 已安装&#xff1b;自定义网站配置路径为/www&#xff1b;并创建共享目录和网页文件&…

tcp 超时计时器

在 TCP&#xff08;传输控制协议&#xff09;中有以下四种重要的计时器&#xff1a; 重传计时器&#xff08;Retransmission Timer&#xff09; 作用&#xff1a;用于处理数据包丢失的情况。当发送方发送一个数据段后&#xff0c;就会启动重传计时器。如果在计时器超时之前没有…

华为云租户网络-用的是隧道技术

1.验证租户网络是vxlan 2.验证用OVS 2.1控制节点VXLAN 本端ip&#xff08;local ip&#xff09;192.168.31.8 2.2计算节点VXLAN 本端ip&#xff08;local ip&#xff09;192.168.31.11 计算节点用的是bond0做隧道网络 2.3查看bond文件是否主备模式

【AI+教育】一些记录@2024.11.11

《清华发布工具学习框架&#xff0c;让ChatGPT操控地图、股票查询&#xff0c;贾维斯已来&#xff1f;》 清华发布工具学习框架&#xff0c;让ChatGPT操控地图、股票查询&#xff0c;贾维斯已来&#xff1f;工具学习&#xff0c;清华天团让 ChatGPT 拿起专业工具https://mp.we…

day-17 反转字符串中的单词

利用split()函数和substring函数 code: class Solution {public String reverseWords(String s) {int m0;while(s.charAt(m) ){m;}ss.substring(m);String arr[]s.split("[\\s]");int narr.length;String ss"";for(int in-1;i>1;i--){ssssarr[i]"…