提交
This commit is contained in:
parent
ecd0dc9969
commit
d0f84de859
42
source/_posts/Git.md
Normal file
42
source/_posts/Git.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Git
|
||||
|
||||
## Git 全局设置:
|
||||
|
||||
```shell
|
||||
git config --global user.name "wenyongda"
|
||||
git config --global user.email "bmdzh11713@163.com"
|
||||
```
|
||||
|
||||
## 创建 git 仓库:
|
||||
|
||||
```shell
|
||||
mkdir aaa
|
||||
cd aaa
|
||||
git init
|
||||
touch README.md
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin https://gitee.com/wenyongda/aaa.git
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
## 已有仓库
|
||||
|
||||
```shell
|
||||
cd existing_git_repo
|
||||
git remote add origin https://gitee.com/wenyongda/aaa.git
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
## 查看作者名称、作者邮箱
|
||||
|
||||
```shell
|
||||
git config user.name
|
||||
git config user.email
|
||||
git config --list
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -221,6 +221,21 @@ systemctl restart network
|
||||
ip addr
|
||||
```
|
||||
|
||||
## 端口映射
|
||||
|
||||
```shell
|
||||
# 将 80 端口 映射到 8080端口上 dport为目标端口 to-port为来源端口
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80
|
||||
# 查看iptables规则
|
||||
iptables -t nat -L -n -v
|
||||
|
||||
##
|
||||
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
|
||||
pkts bytes target prot opt in out source destination
|
||||
12925 4377K DOCKER all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
|
||||
0 0 REDIRECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 redir ports 80
|
||||
```
|
||||
|
||||
## 软件安装
|
||||
|
||||
rpm 本地安装
|
||||
|
||||
@ -504,3 +504,29 @@ SELECT DECODE(AMOUNT, 0, NULL, 1, 1, AMOUNT) FROM T_PO_ORDERDETAIL;
|
||||
```
|
||||
|
||||
如果**AMOUNT**等于**0**,则返回**NULL**,否则如果AMOUNT等于1,则返回1,否则返回**AMOUNT**
|
||||
|
||||
### DECODE替换NVL
|
||||
|
||||
在Oracle中,DECODE函数通常可以替换使用NVL函数。DECODE函数可以在字段值满足多个条件时返回不同的结果值,语法如下:
|
||||
|
||||
```
|
||||
DECODE(expr, search, result, default)
|
||||
```
|
||||
|
||||
其中,expr是要进行条件判断的表达式,search是需要匹配的条件值,result是匹配成功后返回的结果值,default是在没有匹配成功时返回的默认值。
|
||||
|
||||
使用DECODE函数来替换NVL函数的示例如下:
|
||||
|
||||
使用NVL函数处理NULL值:
|
||||
|
||||
```
|
||||
SELECT NVL(name, '未知') AS name FROM user;
|
||||
```
|
||||
|
||||
使用DECODE函数替换NVL函数:
|
||||
|
||||
```
|
||||
SELECT DECODE(name, NULL, '未知', name) AS name FROM user;
|
||||
```
|
||||
|
||||
以上语句中,使用DECODE函数将name参数的NULL值替换为“未知”字符串。当name不为NULL时,返回它本身的值。
|
||||
Loading…
x
Reference in New Issue
Block a user