-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathordertools.sh
More file actions
95 lines (77 loc) · 2.7 KB
/
ordertools.sh
File metadata and controls
95 lines (77 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
ordertoolsfun() {
beforeMenu(){
_blue "> --- 当前目录: [ $(pwd) ] ---- < v:${branch}-$selfversion"
echo
_yellow "当前菜单: $menuname "
echo
}
#安装git便捷提交
igitcommiteasy() {
check_and_install git
if _exists 'sgit'; then
_red '系统已存在sgit程序,停止安装,请检查!'
exit
else
touch /bin/sgit
chmod +x /bin/sgit
echo 'git add . && git commit -m "`date +%y%m%d%H%M%S`" && git push' >/bin/sgit
_blue '安装完成'
echo
echo '如卸载删掉/bin/sgit 即可'
echo '现在使用sgit命令 完成git add commit +时间字符串 push 提交'
echo
fi
}
siegetest() {
check_and_install siege
read -rp "输入被测试的url:" -e url
read -rp "输入并发数1-255: " -e -i 10 erupt
read -rp "输入测试时间: " -e -i 10 time
echo
_yellow '-c 并发数 -t 时间 -b 禁用请求之间的延迟(暴力模式)'
echo "siege -c $erupt -t $time $url"
echo
waitinput
_blue '开始测试...'
siege -c $erupt -t $time $url
}
Fillupownmemory() {
#!/bin/bash
check_and_install python3
# 定义 Python 代码块
python_code=$(
cat <<EOF
import sys
big_list = []
while True:
big_list.append('a' * 1024 * 1024)
print(f"当前列表元素数量: {len(big_list)}, 已使用内存: {sys.getsizeof(big_list)} 字节", end='\r')
EOF
)
# 运行 Python 代码
python3 -c "$python_code"
trap 'echo "停止填充内存。"; exit' INT
}
#杀死vscode进程
killvscode() {
#仅杀掉占用最大的进程
killtopvscode() {
ps -uxa | grep '\.vscode-server' | sort -k3 -nr | head -n 1 | awk '{print $2}' | xargs kill -9
}
#杀死所有vscode进程
killallvscode() {
ps uxa | grep .vscode-server | awk '{print $2}' | xargs kill -9
}
menuname='首页/其他工具/杀死vscode进程'
echo "ordertoolsfun" >$installdir/config/lastfun
options=("仅杀掉占用最大的进程" killtopvscode "杀死所有vscode进程" killallvscode)
menu "${options[@]}"
}
gitfilemodefalse(){
git config --add core.filemode false
}
menuname='首页/其他工具'
echo "ordertoolsfun" >$installdir/config/lastfun
options=("安装git便捷提交" igitcommiteasy "git忽略文件权限改动" gitfilemodefalse "杀死vscode进程" killvscode "Siege-web压力测试" siegetest "打满自身内存" Fillupownmemory )
menu "${options[@]}"
}