脚本基础

"记录一些常用的脚本"

Posted by yueLng on 2019-12-13

Script

#随手记

:w !sudo tee % VIM sudo 命令
for line in $(cat twitter.env)
do
export $line
done

这种写法主要是为了让你的程序在不同的系统上都能适用。

1
#!/usr/bin/env perl

不管你的perl是在/usr/bin/perl还是/usr/local/bin/perl,#!/usr/bin/env perl会自动的在你的用户PATH变量中所定义的目录中寻找perl来执行的。

1
2
3
4
5
6
SELECT d.userId, d.userPhoNum, a.orderId, a.productType, b.courseId, b.courseName, c.payJe
FROM bskgk.order_info_detail a
JOIN bskgk.course_info b ON a.productId = b.courseId
JOIN bskgk.order_info c ON c.orderId = a.orderId
JOIN bskgk.user_info d ON d.userId = c.userId
WHERE a.payJe > 0; #as可以省略
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//sha1
h := sha1.New()
io.WriteString(h, "aaaaaa")
fmt.Printf("%x\n", h.Sum(nil))
//hmac ,use sha1
key := []byte("123456")
mac := hmac.New(sha1.New, key)
// mac := hmac.New(md5.New, key)
mac.Write([]byte("aaaaaa"))
fmt.Printf("%x\n", mac.Sum(nil))
rawIn := json.RawMessage(in)
bytes, err := rawIn.MarshalJSON()
if err != nil {
panic(err)
}

mysqldump -h10.19.197.93 -ugodman -pq2DNZYn13LfLFzCx commission commission_balance_history >commission_balance_history.sql;
git diff master develop –stat |grep “rproject” |awk ‘BEGIN{FS=”/“}{print $2}’|uniq
git diff $branch $oldVaule –stat |grep “rproject”|awk ‘BEGIN {FS=”/“} {print $2}’ | uniq

touch Cartfile
github “vikmeup/SCLAlertView-Swift” “master”
carthage update –platform iOS

Error 1062: Duplicate entry
failure access ssdb error
把数据库错误标成 注册出错

基本上来自手机注册
从 14.40 开始
tz1 或者tz—1 tz2
netstat -anp|grep 80
lsof -I

prometheus grafana

bombardier 压测工具
– show variables like ‘%max_connections%’; 查看最大连接数
set global max_connections=1000 重新设置
SHOW FULL PROCESSLIST
show status like ‘Threads%’;
show variables like ‘max_connections’;
show global status like ‘Max_used_connections’;
Max_used_connections / max_connections * 100% ≈ 85%