Linux-Nginx代理配置Https证书

安装Nginx

1
sudo yum install nginx

启动/关闭

1
2
3
4
5
sudo systemctl start nginx.service   # 启动Nginx
sudo systemctl stop nginx.service # 停止Nginx
sudo systemctl restart nginx.service # 重启Nginx
sudo systemctl enable nginx.service # 设置Nginx开机自启
sudo systemctl disable nginx.service # 禁止Nginx开机自启

Linux-服务器SSH连接和文件管理

重装系统老是忘记常用工具的下载地址,干脆记录一下

一、Windows 系统

1. SSH登录

下载putty

2. 文件管理

下载filezilla

二、MacOS

1. SSH登录

直接使用终端-Shell-新建远程连接

2. 文件管理

可以去APP Store下载一个ForkLift

MySQL-druid连接报错问题

报错问题

1
com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx?useUnicode=true&characterEncoding=UTF-8, errorCode 0, state 08S01

SpringBoot配置

  • application.properties
1
2
3
4
5
6
7
spring.application.name=xxx
server.port=8080
spring.datasource.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

Git常见问题-子目录是submodule无法add问题

问题

目录A里面有个目录B,目录B也是一个仓库。

现在目录A也有一个仓库,想将目录B的仓库取消,直接加入到目录A的仓库里。

直接git add 目录B,是没有任何反应的。

解决方案

1
2
3
4
5
6
cd 目录B
rm -rf .git

cd 目录A
git rm --cached 目录B
git add 目录B

知识扩展

Git查看已被排除的文件及目录

1
git status --ignored
Git

RxJava2-监听EditText变化并查询数据库并更新UI

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
Disposable subscription = RxTextView.textChangeEvents(etSearch)
.debounce(200, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.toFlowable(BackpressureStrategy.BUFFER)
.switchMap(new Function<TextViewTextChangeEvent, Publisher<RealmResults<Note>>>() {
@Override
public Publisher<RealmResults<Note>> apply(TextViewTextChangeEvent event) throws Exception {
String etContent = event.getText().toString();
if (etContent.length() > 0) {
mLv.setVisibility(View.VISIBLE);
} else {
mLv.setVisibility(View.GONE);
}
if (etContent.length() > 0) {
mLv.setVisibility(View.VISIBLE);
} else {
mLv.setVisibility(View.GONE);
}
finalMAdapter.setSearchStr(etContent);
if (dirId == MyApplication.DEFAULT_DIR_ID) {
return Realm.getDefaultInstance().where(Note.class)
.contains("title", etContent)
.sort("timeMills", Sort.DESCENDING).findAllAsync().asFlowable();
} else {
return Realm.getDefaultInstance().where(Note.class)
.equalTo("dirId", dirId)
.contains("title", etContent)
.sort("timeMills", Sort.DESCENDING).findAllAsync().asFlowable();
}
}
})
.filter(new Predicate<RealmResults<Note>>() {
@Override
public boolean test(RealmResults<Note> notes) throws Exception {
return notes.isLoaded();
}
})
.subscribe(new Consumer<RealmResults<Note>>() {
@Override
public void accept(RealmResults<Note> notes) throws Exception {
mNotes = notes;
if (notes != null && notes.size() > 0) {
llNoResult.setVisibility(View.GONE);
} else {
llNoResult.setVisibility(View.VISIBLE);
}
finalMAdapter.updateAll(mNotes);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
}
});

Linux-编辑器vi的使用

进入vi编辑器

1
vi filename

插入

i

保存

ESC键 跳到命令模式,然后:
:w 保存文件但不退出vi
:w file 将修改另外保存到file中,不退出vi
:w! 强制保存,不推出vi
:wq 保存文件并退出vi
:wq! 强制保存文件,并退出vi
q: 不保存文件,退出vi
:q! 不保存文件,强制退出vi
:e! 放弃所有修改,从上次保存文件开始再编辑