tonglin0325的个人主页

Goland中config.go文件无法被正常识别

在使用Goland开发go项目的时候,突然有一次遇到有些包下面的类无法被引用的情况,排查下来发现是这些包下面的config.go文件无法被正常识别成go代码文件

从而导致下面无法引用其他包中的所有config.go文件中的类

kratos无法正常引用

gorm的gen无法正常引用

解决方法是去File Type下面的File type auto-detected by file content下面将config.go配置删除,就可以解决这个问题

 

全文 >>

go学习笔记——配置

1.读取命令行参数

1
2
3
4
func main() {
println("Hello ", os.Args[1])
}

配置arg

输出

1
2
Hello World

注意arg[0]是go程序的运行目录

2.使用flag加载环境变量

golang内置的标准库flag,可以用来读取配置文件的路径

1
2
3
4
5
6
7
func main() {

var configFilePath = flag.String("conf", "./", "config file path") // flag也支持flag.Bool,flag.Int等用法
flag.Parse()
println(*configFilePath)
}

配置

全文 >>

sublime插件使用

sublime软件支持安装插件来增强功能

Tool->Command Palette->install package

1.sqlbeautifier SQL格式化

command+K,然后command+F,格式化SQL

2.添加行号或者递增的数字

先选中对应的文本,然后按command+shift+L,并command+左箭头 把光标移动行首,如下

再按command+option+N

1:1表示从1开始,每次递增+1,也可以修改成1:2

全文 >>

unblock netease music配置

yaml配置

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
96
97
98
99
100
port: 7890
socks-port: 7891
allow-lan: false
mode: Rule
log-level: silent
external-controller: 127.0.0.1:9090
secret: ""
dns:
enable: true
ipv6: false
nameserver:
- https://dns.rubyfish.cn/dns-query
- https://223.5.5.5/dns-query
- https://dns.pub/dns-query
- https://119.29.29.29/dns-query
fallback:
- https://1.0.0.1/dns-query
- https://public.dns.iij.jp/dns-query
- https://dns.twnic.tw/dns-query
fallback-filter:
geoip: true
ipcidr:
- 240.0.0.0/4
- 0.0.0.0/32
- 127.0.0.1/32
domain:
- +.google.com
- +.facebook.com
- +.youtube.com
- +.xn--ngstr-lra8j.com
- +.google.cn
- +.googleapis.cn
- +.gvt1.com
proxies:
- name: "UnblockMusic"
type: http
server: localhost
port: xx
proxy-groups:
-
name: "Netease Music"
type: select
proxies:
- UnblockMusic
- DIRECT
rules:
# Unblock Netease Music
- DOMAIN,api.iplay.163.com,Netease Music
- DOMAIN,apm3.music.163.com,Netease Music
- DOMAIN,apm.music.163.com,Netease Music
- DOMAIN,interface3.music.163.com,Netease Music
- DOMAIN,interface.music.163.com,Netease Music
- DOMAIN,music.163.com,Netease Music
- DOMAIN,interface.music.163.com.163jiasu.com,Netease Music
- DOMAIN,interface3.music.163.com.163jiasu.com,Netease Music
- DOMAIN,music.126.net,Netease Music
- DOMAIN-SUFFIX,163yun.com,Netease Music
- DOMAIN-SUFFIX,mam.netease.com,Netease Music
- DOMAIN-SUFFIX,hz.netease.com,Netease Music

# CIDR规则
- IP-CIDR,39.105.63.80/32,Netease Music
- IP-CIDR,45.254.48.1/32,Netease Music
- IP-CIDR,47.100.127.239/32,Netease Music
- IP-CIDR,59.111.160.195/32,Netease Music
- IP-CIDR,59.111.160.197/32,Netease Music
- IP-CIDR,59.111.181.35/32,Netease Music
- IP-CIDR,59.111.181.38/32,Netease Music
- IP-CIDR,59.111.181.60/32,Netease Music
- IP-CIDR,101.71.154.241/32,Netease Music
- IP-CIDR,103.126.92.132/32,Netease Music
- IP-CIDR,103.126.92.133/32,Netease Music
- IP-CIDR,112.13.119.17/32,Netease Music
- IP-CIDR,112.13.122.1/32,Netease Music
- IP-CIDR,115.236.118.33/32,Netease Music
- IP-CIDR,115.236.121.1/32,Netease Music
- IP-CIDR,118.24.63.156/32,Netease Music
- IP-CIDR,193.112.159.225/32,Netease Music
- IP-CIDR,223.252.199.66/32,Netease Music
- IP-CIDR,223.252.199.67/32,Netease Music
- IP-CIDR,59.111.21.14/31,Netease Music
- IP-CIDR,59.111.179.214/32,Netease Music
- IP-CIDR,59.111.238.29/32,Netease Music

# Advertising
- DOMAIN,admusicpic.music.126.net,REJECT
- DOMAIN,iadmat.nosdn.127.net,REJECT
- DOMAIN,iadmusicmat.music.126.net,REJECT
- DOMAIN,iadmusicmatvideo.music.126.net,REJECT

- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
- IP-CIDR,17.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT
- GEOIP,CN,DIRECT
- MATCH,DIRECT

如果使用yt-dlp音源需要额外安装

R3300L电视盒子刷机

1.先线刷当贝安卓系统到EMMC

  1. 打开USB_Burning_Tool, 打开img文件, Erase flash 和 Erase bootloader 默认勾选. 等着
  2. R3300L断开电源, 开关关上(弹出状态), 顶住AV口内的小开关, 连上USB线,
  3. 等待几秒, 会看到USB_Burning_Tool界面显示Connect success, 然后点击Start
  4. 然后就等进度条一直写到100%
  5. 完成后点击Stop, 关闭USB_Burning_Tool

拔掉USB线, 重新连上HDMI, 加电, 系统开机就是新的安卓系统了

使用的系统是20180123-S905L-R3300L-V12C-root-qlzy

参考:R3300L运行CoreELEC, EmuELEC和Armbia

2.再刷armbian系统到TF卡

双系统不用把armbian系统刷进emmc,需要在安卓系统中安装Reboot to LibreELEC的apk来启动TF卡系统,装上TF卡就自动进行armbian系统

参考:魔百盒R3300L、CM101H以及中兴ZX10 B860AV1.2刷armbian跑甜糖

使用的系统版本是Armbian_20.10_Arm-64_buster_current_5.9.0.img

3.armbian换源

1
2
cp /etc/apt/sources.list /etc/apt/sources.list.bak

换成清华源

1
2
3
4
5
6
7
8
9
10
11
12
deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free

全文 >>

各开放平台账号登录API对接文档

当我们开发的系统想要使用第三方账号系统(比如微信,微博,facebook)进行登录的时候,就需要使用第三方平台的登录能力,下面是各第三方平台的对接文档

关于oauth和oauth2.0:理解OAuth 2.0

關於OAuth 2.0-以Facebook為例

1.微信

https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html

2.微信小程序

https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html

3.微博

web端

app移动端,可以使用refresh token

全文 >>

Python爬虫——使用selenium和chrome爬取js动态加载的网页

1.使用docker镜像运行selenium+chrome环境

官方镜像仓库selenium/standalone-chrome,只支持amd64

拉取镜像

1
2
docker pull selenium/standalone-chrome:120.0

启动

1
2
docker run -d -p 4444:4444 -p 15900:5900 selenium/standalone-chrome:120.0

其他参数

1
2
docker run -d -p 4444:4444 -p 15900:5900 -e SE_NODE_MAX_SESSIONS=5 --shm-size=2g selenium/standalone-chrome:120.0

参考:https://hub.docker.com/r/selenium/standalone-chrome

访问 localhost:4444/ui 可以查看selenium的运行状态

全文 >>

MySQL学习笔记——多表连接和子查询

多表连接查询

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
# 返回的是两张表的乘积
SELECT * FROM tb_emp,tb_dept
SELECT COUNT(*) FROM tb_emp,tb_dept

# 标准写法,每个数据库都能这么写
SELECT * FROM tb_emp CROSS JOIN tb_dept

# 内连接 只列出这些连接表中与连接条件相匹配的数据行
SELECT * FROM tb_emp e,tb_dept d WHERE e.NAME = d.NAME

SELECT * FROM tb_emp INNER JOIN tb_dept
ON tb_emp.NAME = tb_dept.NAME

# 外链接 不仅列出与连接条件相匹配的行,还列出左表(左外连接),右表(右外连接)或两个表(全外连接)中所有符合where过滤条件的数据行
# 左外连接 在外连接中,某些不满足条件的列也会显示出来,也就是说,只限制其中一个表的行,而不限制另一个表的行
# 左边的表作为主表,左边的表会全部显示
SELECT * FROM tb_emp LEFT JOIN tb_dept
ON tb_emp.NAME = tb_dept.NAME

#oracle语法,左连接加号在左边
SELECT * FROM tb_emp e,tb_dept d WHERE e.NAME=d.NAME(+)

#右外连接
SELECT * FROM tb_emp RIGHT JOIN tb_dept
ON tb_emp.NAME = tb_dept.NAME

#全外连接 MySQL不支持 OUTER

#自连接
SELECT c.NAME '部门名字',c2.NAME '其他部门'
FROM tb_dept c LEFT JOIN tb_dept c2
ON c.description=c2.id<br /><br /># rollup<br />SELECT orderYear, productLine, SUM(orderValue) totalOrderValue <br />FROM sales <br />GROUP BY orderYear, productline <br />WITH ROLLUP;

参考:https://www.begtut.com/mysql/mysql-rollup.html

 

子查询

 某些情况下,当运行查询的时候,需要的条件是另外一个select语句的结果,这个时候,就要用到子查询

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
#子查询
SELECT * FROM tb_emp

#查询年龄是22的人名
SELECT age FROM tb_emp WHERE sex='男'
SELECT * FROM tb_emp WHERE age>23

SELECT *
FROM tb_emp
WHERE age> (
SELECT age
FROM tb_emp
WHERE NAME='Tom'
)

#IN 与列表中的任一成员相等
SELECT *
FROM tb_emp
WHERE age IN (
SELECT age
FROM tb_emp
WHERE sex='男'
)

#ANY 与列表中的每一成员比较,小于最大的
SELECT *
FROM tb_emp
WHERE age < ANY (
SELECT age
FROM tb_emp
WHERE sex='男'
)

 

HTML学习笔记——基础知识

1.标签

1.title标签、网站关键词、网站描述、实现网页的跳转、单标签、对标签、p标签

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!-- title标签 -->
<title>我是title</title>

<!-- 网站关键词 -->
<meta name='keywords' content="切糕,卖切糕,卖切糕"/>

<!-- 网站描述 -->
<meta name='description' content="本网站介绍,要有可读性,100-200字"/>

<!-- 5秒钟后跳转到百度网 -->
<meta http-equiv='refresh' content="5;url='http://www.baidu.com'"/>
</head>



<body>

<!-- 单标签 -->
<img src="/images///images//images/dog.jpg" width="100" height="150" title="图片"/>

<!-- 对标签 -->
[百度](http://www.baidu.com)

**我是strong标签**
<p>我是p标签</p>

</body>
</html>

2.h1标签、h2标签、font标签、加粗文字、下划线、嵌套

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- h1文章标题/只能用一次 -->
<h1>我是p标签</h1>

<!-- h2文章标题/可以用多次/权重较低 -->
<h2>我是p标签</h2>

<!-- font/color可以是英文或00ff00/size从1到7 -->
<font color="red" size="7">我是font标签</font>

<!-- 加粗文字 -->
**我是strong标签**

<!-- 嵌套 -->
<font color="red"><u><del>红色文字加下划线</del></u></font>

</body>
</html>

 

3.pre标签、实体

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- pre标签 -->
床前明月光
疑是地上霜
举头望明月
低头思故乡
<pre>
兰陵美酒郁金香
玉碗盛来琥珀光
但使主人能醉客
不知何处是他乡
</pre>

<!-- 实体 -->
ha标签的写法是这样的:&amp;lt;h1&amp;gt;h1实例&amp;lt;/h1&amp;gt;

</body>
</html>

2.锚链接

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<!-- 从新的页面打开 -->
<!-- [百度首页](http://www.baidu.com) -->

<!-- 锚链接用法 -->

<a href="#first">第一章节</a>
<a href="#second">第二章节</a>

<h2 id="first">第一章节</h2>
<p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p>

<h2 id="second">第二章节</h2>
<p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p>

<a href="#top">回到顶部</a>
</body>
</html>

3.图片

1.显示图片、用a标签实现点击图片跳转、地图标签/点击图片上固定区域跳转

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- 图片 -->
<img src="/images///images//images/dog.jpg" title="一只狗" alt"这是一只狗" usemap="#dogmap" />

<!-- 用a标签实现点击图片跳转 -->
[<img src="/images///images//images/dog.jpg" width="300" height="500" title="一只狗" alt"这是一只狗"/>](http://www.baidu.com)

<!-- 地图标签/点击图片上固定区域跳转 -->
<map name="dogmap">
<area shape="circle" coords="185,198,69" href="http://www.baidu.com" target="_blank" />
<area shape="circle" coords="385,198,69" href="http://www.sina.com" target="_blank" />
<area shape="rect" coords="50,50,100,100" href="http://www.sina.com" target="_blank" />
<!-- 依次写各个点的坐标 -->
<area shape="poly" coords="0,0,0,50,50,0" href="http://www.hao123.com" />

</map>


</body>
</html>

2.index图片相对路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- ../代表往上反一层 -->
<img src="/images//images/cat.jpg" />

<!-- 相对路径 -->
<img src="images//images///images//images/dog.jpg" />
</body>
</html>

4.列表和table

1.有序列表、无序列表和自定义列表

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- 有序列表 -->
<ol type="a">
<li>有序列表1</li>
<li>有序列表2</li>
<li>有序列表3</li>
<li>有序列表4</li>
<li>有序列表5</li>
</ol>

<!-- 无序列表 -->
<ul type="circle">
<li>无序列表1</li>
<li>无序列表2</li>
<li>无序列表3</li>
<li>无序列表4</li>
<li>无序列表5</li>
</ul>

<!-- 自定义列表 -->
<dl>
<dt>第一大段</dt>
<dd>第1小段</dd>
<dd>第2小段</dd>
<dd>第3小段</dd>
<dd>第4小段</dd>
</dl>
</body>
</html>

2.table

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<!-- border为边框的粗细 -->
<!-- tr为行,td为列 -->
<table border='1' width='600' bordercolor="blue" bgcolor="grey" align="center">

<caption><font color='blue'>课程表</font></caption>

<tr width="600" height="50" align='center' valign='top'>
<td rowspan='3'>abc</td>
<td colspan='2'>123</td>

<td>123</td>
<td>abc</td>
</tr>
<tr>

<td>123</td>
<td>abc</td>
<td rowspan='2'>123</td>
<td>abc</td>
</tr>
<tr>

<td>123</td>
<td>abc</td>

<td>abc</td>
</tr>

</table>

</body>
</html>

5.post表单

1.form1

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>

<form action="">
<input type="text" /><!-- 单行文本 -->
<input type="password" /><!-- 密码框 -->
<input type="radio" /><!-- 单选框 -->
<input type="checkbox" /><!-- 复选框 -->
<input type="hidden" /><!-- 隐藏域 -->
<input type="submit" /><!-- 提交按钮 -->
<input type="file" /><!-- 文件域 -->
<input type="reset" value="" /><!-- 重置按钮 -->
<input type="button" value="" /><!-- 按钮 -->
<textarea></textarea><!-- 文本区域 -->
<select>
<option></option>
</select><!-- 下拉框 -->
</form>


</body>
</html>

全文 >>

chrome插件ModHeader使用

ModHeader全名modify header,这是一款可以对HTTP请求header进行修改的插件,其支持添加模式Mod过滤器Filter

Mod可以支持对request的header,response的header进行修改,对请求进行重定向redirect等;

Filter支持对特定的URL生效这面的这些Mod