2019年9月20日
此问题是由于升级 macos sonoma 14.2.1 引起的
解决办法,重新安装xcode
rm -rf /Library/Developer/CommandLineTools
xcode-select --install
posted @
2024-02-04 13:57 一凡 阅读(42) |
评论 (0) |
编辑 收藏
# Springboot
整合activiti
源代码:
https://gitee.com/yifan88899/acttest
## 版本说明
- springboot 2.4.2
- activiti 7.1.0.M6
- mysql 8.0.28
## 插件安装
- Activiti BPMN visualizer
## Bpmn
流程图位置
- 流程图xml
和png
需放在resources/processes
下
## Test
- Test Case
都可执行,包括:
- 流程查询
- 流程部署
- 流程启动
- 流程拾取、完成操作
## Mysql
- 需要启动Mysql8
- 数据库名Activiti7
- activiti
会版建表
posted @
2023-11-10 15:56 一凡 阅读(88) |
评论 (0) |
编辑 收藏
1、打开my.cnf 加入 skip-grant-tables2、mysql.service stop && mysql.service start
3、清空root密码 并 退出
update mysql.user set authentication_string='' where user='root';
4、mysql.service stop && mysql.service start
5、mysql -root 免密登录并修改root密码
alter user 'root'@
'%' identified
by 'pass$123';
alter user 'root'@
'localhost' identified
by 'pass$123';
确定是否支持远程登录,host中有%的记录即支持
select host, user, authentication_string, plugin from user;
posted @
2021-08-05 18:06 一凡 阅读(190) |
评论 (0) |
编辑 收藏
posted @
2021-06-22 17:46 一凡 阅读(72) |
评论 (0) |
编辑 收藏
#!/usr/bin/expect
####################
set pass xxxx
set user yyyy
####################
spawn ssh -p 35000 -o StrictHostKeyChecking=no "${user}@xgrelay.xxxx.com"
expect {
-re ".*Dkey.*" { gets stdin dkey; send "$dkey\r"; exp_continue}
-re "Option>:" { send "1\r" ;}
-re "Password>:" { send "$pass\r" ; exp_continue }
-re "password:" { send "$pass\r" ; exp_continue }
}
posted @
2021-01-18 11:35 一凡 阅读(148) |
评论 (0) |
编辑 收藏
-- data export csv 其中 $1=$1 如果不加指定分隔符不生效mysql -uadmin -ptest -h127.0.0.1 -P3306 -e "select * from test where create_time > unix_timestamp('2020-09-10 00:00:00') and status = 99" | awk '{OFS=","}{$1=$1;print $0}'#csv中文转码
tmpfn="exempt-update-3.30.csv";iconv -c -s -f UTF-8 -t GBK $tmpfn > /tmp/$tmpfn && mv /tmp/$tmpfn .
posted @
2020-09-10 22:08 一凡 阅读(175) |
评论 (0) |
编辑 收藏
#!/bin/bash
for f in "$@"; do
if [ -f "$f" ]; then
iconv -s -c -f UTF8 -t GBK "$f" > /tmp/$f.tmp
mv /tmp/$f.tmp "$f"
fi
done
posted @
2020-04-20 10:03 一凡 阅读(174) |
评论 (0) |
编辑 收藏
# -*- coding: utf-8 -*-
#!/usr/bin/python
import re
import io
import sys
# obj = re.compile(r'(?P<ip>.*?)- - \[(?P<time>.*?)\] "(?P<request>.*?)" (?P<status>.*?) (?P<bytes>.*?) "(?P<referer>.*?)" "(?P<ua>.*?)"')
# example:xxxx"id":2640914,"orderId":144115188137125591xxxx"state":10xxxxx"
# 日志整行都需要匹配,需要用的用具体正则匹配,如(\d{7}),不需要的用(.*)匹配,总之所有需要或不需要部分都用()括起来
obj = re.compile(r'(.*"id":)(\d{7})(.*"orderId":)(\d{18})(.*"state":)(\d{2})(.*)')
def load_log(path):
# 读取文件
with io.open(path, mode="r", encoding="utf-8") as f:
for line in f:
line = line.strip()
parse(line)
def stdin():
# 读取管道输入
for line in sys.stdin:
parse(line)
def parse(line):
# 解析单行nginx日志
try:
result = obj.match(line)
print(result.group(2,4,6))
except:
pass
if __name__ == '__main__':
# load_log("/tmp/227.log")
stdin()
posted @
2020-02-29 02:10 一凡 阅读(283) |
评论 (0) |
编辑 收藏
- 新增中间件cors
func Cors() gin.HandlerFunc {
return func(c *gin.Context) {
method := c.Request.Method
c.Header("Access-Control-Allow-Origin", "*") //必选
c.Header("Access-Control-Allow-Headers", "*") //可选 如果request有header, 必选
//c.Header("Access-Control-Allow-Credentials", "true") //可选
//c.Header("Access-Control-Allow-Methods", "*") //可选
//c.Header("Access-Control-Expose-Headers", "*") //可选
//放行所有OPTIONS方法
if method == "OPTIONS" {
c.AbortWithStatus(http.StatusOK)
}
// 处理请求
c.Next()
}
}
- 在router里增加cors,必须在group之前,全局设置
r.Use(gin.Logger(), gin.Recovery(), cors.Cors())
- 测试代码,header设置不能多于cors设置
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<link type="test/css" href="css/style.css" rel="stylesheet">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#cors").click(
function(){
$.ajax({
headers:{
"Content-Type":"application/json;charset=UTF-8",
"Access":"adsad",
"Access-Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJwYXNzd29yZCI6InRlc3QxMjM0NTYiLCJleHAiOjE1NzczMzY3MTIsImlzcyI6Imdpbi1ibG9nIn0.wMlQXqZO2V0LR-FIgDh45LWI0OYMYi6an_NvRmF0Nug"
},
url:"http://127.0.0.1:8000/api/v1/articles",
success:function(data){
console.log("start");
console.log(data);
}
})
});
});
</script>
<body>
<input type="button" id="cors" value="core跨域测试">
</body>
</html>
- 请求的headers数量、名称与cors里的设置需要严格对应,不然报错如下
Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/v1/articles' from origin 'http://localhost:9999' has been blocked by CORS policy: Request header field access is not allowed by Access-Control-Allow-Headers in preflight response.
posted @
2019-12-26 11:17 一凡 阅读(316) |
评论 (0) |
编辑 收藏
1、在main函数中增加全局配置,其中@name就是你确定的鉴权参数名,我的是token, @
in header 说明参数放在header,你的鉴权代码需要从header中获取
// @title gin-blog API
// @version 0.0.1
// @description This is a gin blog example
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name token
// @BasePath /
2、在具体的handler里添加如下注释,此处的ApiKeyAuth和main中的apike对应,切记不要修改
// @Security ApiKeyAuth
3、swagger页面如下:
4、添加token后,后续所有有鉴权接口的header里自动携带token
posted @
2019-12-23 16:08 一凡 阅读(1934) |
评论 (0) |
编辑 收藏
posted @
2019-11-19 16:41 一凡 阅读(140) |
评论 (0) |
编辑 收藏
处理1W条复杂json数据性能对比
- golang
./go_extract_json 0.95s user 0.12s system 99% cpu 1.081 total
- shell
bash segment.sh 0.64s user 0.07s system 101% cpu 0.695 total
- perl
perl extract.pl 39.57s user 0.54s system 98% cpu 40.579 total
posted @
2019-09-20 18:13 一凡 阅读(216) |
评论 (0) |
编辑 收藏