Black-Gold 6 years ago
parent 59e6ebc929
commit 433ef3f38a

313
Git.md

@ -1,313 +0,0 @@
# Git使用规范流程
```sh
安装后设置用户名和邮箱:
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
初始化仓库
git init
每次开发一个新功能,都应该建一个新的单独分支
1.新建分支
获取主干master代码
git checkout master
git pull
新建一个开发分支myfeature
git checkout -b myfeature
2.提交分支
git add --all 从git2.0后all参数是git add的默认参数
git add --all
git remore add origin [远程仓库路径]
git status
参数vervose会列出diff的结果
git commit --vervose
以空消息commit即不写commit message
git commit -a --allow-empty-message -m ''
设置记住密码默认15分钟
git config --global credential.helper cache
如果想自己设置时间,以秒为单位:
git config --global credential.helper 'cache --timeout=3600'
守护程序提前退出,请在超时之前忘记所有缓存的凭据
git credential-cache exit
长期存储密码:
git config --global credential.helper store
取消存储密码
git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper
3.写提交信息
提交commit时必须给出完整的提交信息。
第一行是不超过50个字的提要然后空一行罗列出改动原因、主要变动、以及需要注意的
问题。最后提供对应的网址比如Bug ticket
4.与主干同步-分支开发过程应经常与主干保持同步
git fetch origin
git rebase origin/master
5.合并commit
分支开发后可能很多commit合并到主干时最好只有一个或两三个commit-i参数表示互动(interactive)
git rebase -i origin/master
6.推送分支至远程仓库
git push --force origin myfeature
7.发送pull request
提交后发出pull request到master分支请求别人进行代码review确认可以合并到master
```
## 常用git命令
```sh
1.新建代码库
git init初始化
git clone [url]
git clone --depth 1
2.配置
# 显示当前的Git配置
git config --list
# 编辑Git配置文件
git config -e [--global]
# 设置提交代码时的用户信息
git config [--global] user.name "[name]"
git config [--global] user.email "[email address]"
3.增加/删除文件
# 添加指定文件到暂存区
git add [file1] [file2] ...
# 添加指定目录到暂存区,包括子目录
git add [dir]
# 添加当前目录的所有文件到暂存区
git add .
# 添加每个变化前,都会要求确认,对于同一个文件的多处变化,可以实现分次提交
git add -p
# 删除工作区文件,并且将这次删除放入暂存区
git rm [file1] [file2] ...
# 停止追踪指定文件,但该文件会保留在工作区
git rm --cached [file]
# 改名文件,并且将这个改名放入暂存区
git mv [file-original] [file-renamed]
4.代码提交
# 提交暂存区到仓库区
git commit -m [message]
# 提交暂存区的指定文件到仓库区
git commit [file1] [file2] ... -m [message]
# 提交工作区自上次commit之后的变化直接到仓库区
git commit -a
# 提交时显示所有diff信息
git commit -v
# 如果代码没有任何新变化则用来改写上一次commit的提交信息
git commit --amend -m [message]
# 重做上一次commit并包括指定文件的新变化
git commit --amend [file1] [file2] ...
5.分支
# 列出所有本地分支
git branch
# 列出所有远程分支
git branch -r
# 列出所有本地分支和远程分支
git branch -a
# 新建一个分支,但依然停留在当前分支
git branch [branch-name]
# 新建一个分支,并切换到该分支
git checkout -b [branch]
# 新建一个分支指向指定commit
git branch [branch] [commit]
# 新建一个分支,与指定的远程分支建立追踪关系
git branch --track [branch] [remote-branch]
# 切换到指定分支,并更新工作区
git checkout [branch-name]
# 切换到上一个分支
git checkout -
# 建立追踪关系,在现有分支与指定的远程分支之间
git branch --set-upstream [branch] [remote-branch]
# 合并指定分支到当前分支
git merge [branch]
# 选择一个commit合并进当前分支
git cherry-pick [commit]
# 删除分支
git branch -d [branch-name]
# 删除远程分支
git push origin --delete [branch-name]
git branch -dr [remote/branch]
6.标签
# 列出所有tag
git tag
# 新建一个tag在当前commit
git tag [tag]
# 新建一个tag在指定commit
git tag [tag] [commit]
# 删除本地tag
git tag -d [tag]
# 删除远程tag
git push origin :refs/tags/[tagName]
# 查看tag信息
git show [tag]
# 提交指定tag
git push [remote] [tag]
# 提交所有tag
git push [remote] --tags
# 新建一个分支指向某个tag
git checkout -b [branch] [tag]
7.查看信息
# 显示有变更的文件
git status
# 显示当前分支的版本历史
git log
# 显示commit历史以及每次commit发生变更的文件
git log --stat
# 搜索提交历史,根据关键词
git log -S [keyword]
# 显示某个commit之后的所有变动每个commit占据一行
git log [tag] HEAD --pretty=format:%s
# 显示某个commit之后的所有变动其"提交说明"必须符合搜索条件 git log [tag] HEAD --grep feature
# 显示某个文件的版本历史,包括文件改名
git log --follow [file]
git whatchanged [file]
# 显示指定文件相关的每一次diff
git log -p [file]
# 显示过去5次提交
git log -5 --pretty --oneline
# 显示所有提交过的用户,按提交次数排序
git shortlog -sn
# 显示指定文件是什么人在什么时间修改过
git blame [file]
# 显示暂存区和工作区的差异
git diff
# 显示暂存区和上一个commit的差异
git diff --cached [file]
# 显示工作区与当前分支最新commit之间的差异
git diff HEAD
# 显示两次提交之间的差异
git diff [first-branch]...[second-branch]
# 显示今天你写了多少行代码
git diff --shortstat "@{0 day ago}"
# 显示某次提交的元数据和内容变化
git show [commit]
# 显示某次提交发生变化的文件
git show --name-only [commit]
# 显示某次提交时,某个文件的内容 git show [commit]:[filename]
# 显示当前分支的最近几次提交
git reflog
8.远程同步
# 下载远程仓库的所有变动
git fetch [remote]
# 显示所有远程仓库
git remote -v
# 显示某个远程仓库的信息
git remote show [remote]
# 增加一个新的远程仓库,并命名
git remote add [shortname] [url]
# 取回远程仓库的变化,并与本地分支合并 git pull [remote] [branch]
# 上传本地指定分支到远程仓库
git push [remote] [branch]
# 强行推送当前分支到远程仓库,即使有冲突 git push [remote] --force
# 推送所有分支到远程仓库
git push [remote] --all
9.撤销
# 恢复暂存区的指定文件到工作区
git checkout [file]
# 恢复某个commit的指定文件到暂存区和工作区
git checkout [commit] [file]
# 恢复暂存区的所有文件到工作区
git checkout .
# 重置暂存区的指定文件与上一次commit保持一致但工作区不变
git reset [file]
# 重置暂存区与工作区与上一次commit保持一致
git reset --hard
# 重置当前分支的指针为指定commit同时重置暂存区但工作区不变
git reset [commit]
# 重置当前分支的HEAD为指定commit同时重置暂存区和工作区与指定commit一致 git reset --hard [commit]
# 重置当前HEAD为指定commit但保持暂存区和工作区不变
git reset --keep [commit]
# 新建一个commit用来撤销指定commit
# 后者的所有变化都将被前者抵消,并且应用到当前分支
git revert [commit]
# 暂时将未提交的变化移除,稍后再移入
git stash
git stash pop
10.其他
# 生成一个可供发布的压缩包
git archive
```

@ -1,85 +0,0 @@
# GooleTricks
```google
"" 双引号
- 排除字符
好: baidu.com 使用冒号搜索特定的网站
am*zing 使用星号通配符
related:amazon.com 找到与其他网站类似的网站
Black or red 合并搜索
filetype:pdf 找到特定文件
site:www.so.com 在360搜索引擎中寻找
allintitle: allinurl:
@twitter 搜索社交媒体
info: 获取有关网站的详细信息
cache: 查看Google的网站缓存版本
google.com/history 搜索历史
AND返回查询两端的结果。例growth hacks AND youtube
NOT返回除NOT之后的所有结果。例monty python NOT bbc
使用~搜索词的同义词
使用in的翻译和转换
process management inurl:forum|forums|discussion|viewthread|showthread|viewtopic|showtopic 论坛
google.com/ncr。NCR代表无国家/地区重定向
process automation filetype:pdf
搜索ftp
inurl:ftp:// -inurl:http:// -inurl:https://
-inurl(html|htm|php) intitle:”index of” +”last modified” +”parent directory” +description +size
-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(wmv|avi)
-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(jpg|gif)
-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(wma|mp3)
[-inurl:(htm|html|php) intitle:” index of” +” last modified” +” parent directory” +description +size +(jpg|gif) “britney spears”]
```
| Function | Execution |
| :------: | :------: |
| To search for an exact phrase, with the same words in the same order | Place quotation marks (“) around the phrase youd like to search for Ex: “to be, or not to be” |
| To exclude results that include a particular word or site when searching words with multiple meanings | Place a dash (-) before the word or site you want to omit Ex: phoenix -arizona |
| To search for Google+ pages or blood types | Place an addition sign (+) in front of the Google+ user or after the blood type Ex: +Chrome and AB+ |
| To search for social tags | Place the at symbol (@) before the social tag youd like to search Ex: @digitaltrends |
| To search for prices | Place a dollar sign ($) before the value Ex: canon $400 |
| To search for a phrase with missing words | Place an asterisk (*) within the search as a placeholder for any unknown terms Ex: if you give a * a * |
| To search for a range of numbers, usually pertaining to prices and measurements | Place two periods between the designated numbers you want to search between Ex: $75..$200 |
| To search popular hashtags for trending topics | Place a hashtag in front of the desired topicEx: #throwbackthursday |
| Function | Execution |
| :------: | :------: |
| To search for results from certain sites and domains | Place “site:” in front of the site or domain from which you want to pull results Ex: apple watch site:digitaltrends.com |
| To search for pages that link to a certain page | Place “link:” in front of the site or domain you want to find pages linking to Ex: link:digitaltrends.com |
| To search for sites that are similar to a designated site or domain | Place “related:” in front of the site or domain you want to find similar results of Ex: related:digitaltrends.com |
| To search for pages that just have one of several words | Place “OR” between the two words you are searching for Ex: world series 2013 OR 2014 |
| To search for designated information about a specific site or domain, including cached pages, and those linking to the site | Place “info:” in front of the site or domain you want information about Ex: info:digitaltrends.com |
| To search what a page looked like the last time Google crawled the site | Place “cache:” in front of the page housing the cache youd like to view Ex: cache:digitaltrends.com |
| To search for a specific file type | Place “filetype:” in front of the specific file type youre looking for Ex: matthew mcconaughey filetype:gif |
| Function | Execution |
| :------: | :------: |
| To search Google using voice commands | Click the microphone icon in the search bar and begin talking |
| To search Google for a specific image | Click the camera icon in the search bar and paste the image URL |
| To set a timer | Enter “set timer for” followed by the desired amount of time |
| To check the weather for a specific area | Enter “weather” followed by a zipcode or city |
| To search for the sunrise and sunset times for a specific area | Enter “sunrise” or “sunset” followed by a zipcode or city |
| To look up the definition for a given word | Enter “define” followed by your desired term |
| To look up the origins for a given word | Enter “etymology” followed by your desired word |
| To look up the time for a specific region | Enter “time” followed by the particular region |
| To look up your IP address | Enter “ip address” in the search bar |
| To check the status of a flight | Enter the flight number in the search bar |
| To look up stock quotes | Enter the desired stock symbol in the search bar |
| To look up the date for a specific holiday | Enter the name of the holiday in the search bar |
| To track a package | Enter the tracking number in the search bar |
| To use the calculator | Enter the equation in the search bar |
| To define a word | Enter “define” followed by your desired word |
| To convert currency or measurements | Enter the first amount and unit, type “to”, and then enter the second unit |
| To look up film showings | Enter “movies” followed by your zipcode or city |
| To look up sports scores | Enter the sports team in the search bar |
| To look up nutritional facts about an item, or compare nutritional facts | Enter the name of the product, or enter “compare” followed by the items you want to compare |
| To look up a celebritys Bacon Number | Enter “bacon number” followed by the name of the celebrity |
| To roll a six-sided die | Enter [roll a dice] in the search bar |

@ -1,4 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-

@ -1,2 +0,0 @@
#!/bin/bash

@ -1,30 +1,265 @@
mysql
===
# **mysql**
MySQL服务器客户端工具
## 用法
## 补充说明
```sh
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?
--auto-rehash Enable automatic rehashing. One doesn't need to use
'rehash' to get table and field completion, but startup
and reconnecting may take a longer time. Disable with
--disable-auto-rehash.
(Defaults to on; use --skip-auto-rehash to disable.)
-A, --no-auto-rehash
No automatic rehashing. One has to use 'rehash' to get
table and field completion. This gives a quicker start of
mysql and disables rehashing on reconnect.
--auto-vertical-output
Automatically switch to vertical output mode if the
result is wider than the terminal width.
-B, --batch Don't use history file. Disable interactive behavior.
(Enables --silent.)
--bind-address=name IP address to bind to.
--binary-as-hex Print binary data as hex
--character-sets-dir=name
Directory for character set files.
--column-type-info Display column type information.
-c, --comments Preserve comments. Send comments to the server. The
default is --skip-comments (discard comments), enable
with --comments.
-C, --compress Use compression in server/client protocol.
-#, --debug[=#] This is a non-debug version. Catch this and exit.
--debug-check This is a non-debug version. Catch this and exit.
-T, --debug-info This is a non-debug version. Catch this and exit.
-D, --database=name Database to use.
--default-character-set=name
Set the default character set.
--delimiter=name Delimiter to be used.
--enable-cleartext-plugin
Enable/disable the clear text authentication plugin.
-e, --execute=name Execute command and quit. (Disables --force and history
file.)
-E, --vertical Print the output of a query (rows) vertically.
-f, --force Continue even if we get an SQL error.
--histignore=name A colon-separated list of patterns to keep statements
from getting logged into syslog and mysql history.
-G, --named-commands
Enable named commands. Named commands mean this program's
internal commands; see mysql> help . When enabled, the
named commands can be used from any line of the query,
otherwise only from the first line, before an enter.
Disable with --disable-named-commands. This option is
disabled by default.
-i, --ignore-spaces Ignore space after function names.
--init-command=name SQL Command to execute when connecting to MySQL server.
Will automatically be re-executed when reconnecting.
--local-infile Enable/disable LOAD DATA LOCAL INFILE.
-b, --no-beep Turn off beep on error.
-h, --host=name Connect to host.
-H, --html Produce HTML output.
-X, --xml Produce XML output.
--line-numbers Write line numbers for errors.
(Defaults to on; use --skip-line-numbers to disable.)
-L, --skip-line-numbers
Don't write line number for errors.
-n, --unbuffered Flush buffer after each query.
--column-names Write column names in results.
(Defaults to on; use --skip-column-names to disable.)
-N, --skip-column-names
Don't write column names in results.
--sigint-ignore Ignore SIGINT (CTRL-C).
-o, --one-database Ignore statements except those that occur while the
default database is the one named at the command line.
--pager[=name] Pager to use to display results. If you don't supply an
option, the default pager is taken from your ENV variable
PAGER. Valid pagers are less, more, cat [> filename],
etc. See interactive help (\h) also. This option does not
work in batch mode. Disable with --disable-pager. This
option is disabled by default.
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
-P, --port=# Port number to use for connection or 0 for default to, in
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/services, built-in default (3306).
--prompt=name Set the mysql prompt to this value.
--protocol=name The protocol to use for connection (tcp, socket, pipe,
memory).
-q, --quick Don't cache result, print it row by row. This may slow
down the server if the output is suspended. Doesn't use
history file.
-r, --raw Write fields without conversion. Used with --batch.
--reconnect Reconnect if the connection is lost. Disable with
--disable-reconnect. This option is enabled by default.
(Defaults to on; use --skip-reconnect to disable.)
-s, --silent Be more silent. Print results with a tab as separator,
each row on new line.
-S, --socket=name The socket file to use for connection.
--ssl-mode=name SSL connection mode.
--ssl Deprecated. Use --ssl-mode instead.
(Defaults to on; use --skip-ssl to disable.)
--ssl-verify-server-cert
Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.
--ssl-ca=name CA file in PEM format.
--ssl-capath=name CA directory.
--ssl-cert=name X509 cert in PEM format.
--ssl-cipher=name SSL cipher to use.
--ssl-key=name X509 key in PEM format.
--ssl-crl=name Certificate revocation list.
--ssl-crlpath=name Certificate revocation list path.
--tls-version=name TLS version to use, permitted values are: TLSv1, TLSv1.1
-t, --table Output in table format.
--tee=name Append everything into outfile. See interactive help (\h)
also. Does not work in batch mode. Disable with
--disable-tee. This option is disabled by default.
-u, --user=name User for login if not current user.
-U, --safe-updates Only allow UPDATE and DELETE that uses keys.
-U, --i-am-a-dummy Synonym for option --safe-updates, -U.
-v, --verbose Write more. (-v -v -v gives the table output format).
-V, --version Output version information and exit.
-w, --wait Wait and retry if connection is down.
--connect-timeout=# Number of seconds before connection timeout.
--max-allowed-packet=#
The maximum packet length to send to or receive from
server.
--net-buffer-length=#
The buffer size for TCP/IP and socket communication.
--select-limit=# Automatic limit for SELECT when using --safe-updates.
--max-join-size=# Automatic limit for rows in a join when using
--safe-updates.
--secure-auth Refuse client connecting to server if it uses old
(pre-4.1.1) protocol. Deprecated. Always TRUE
--server-arg=name Send embedded server this as a parameter.
--show-warnings Show warnings after every statement.
-j, --syslog Log filtered interactive commands to syslog. Filtering of
commands depends on the patterns supplied via histignore
option besides the default patterns.
--plugin-dir=name Directory for client-side plugins.
--default-auth=name Default authentication client-side plugin to use.
--binary-mode By default, ASCII '\0' is disallowed and '\r\n' is
translated to '\n'. This switch turns off both features,
and also turns off parsing of all clientcommands except
\C and DELIMITER, in non-interactive mode (for input
piped to mysql or loaded using the 'source' command).
This is necessary when processing output from mysqlbinlog
that may contain blobs.
--connect-expired-password
Notify the server that this client is prepared to handle
expired password sandbox mode.
**mysql命令** 是MySQL数据库服务器的客户端工具它工作在命令行终端中完成对远程MySQL数据库服务器的操作。
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file,
except for login file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
Also read groups with concat(group, suffix)
--login-path=# Read this path from the login file.
### 语法
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
auto-rehash FALSE
auto-vertical-output FALSE
bind-address (No default value)
binary-as-hex FALSE
character-sets-dir (No default value)
column-type-info FALSE
comments FALSE
compress FALSE
database (No default value)
default-character-set utf8
delimiter ;
enable-cleartext-plugin FALSE
vertical FALSE
force FALSE
histignore (No default value)
named-commands FALSE
ignore-spaces FALSE
init-command (No default value)
local-infile FALSE
no-beep FALSE
host (No default value)
html FALSE
xml FALSE
line-numbers TRUE
unbuffered FALSE
column-names TRUE
sigint-ignore FALSE
port 3306
prompt mysql>
quick FALSE
raw FALSE
reconnect TRUE
socket /var/run/mysqld/mysqld.sock
ssl TRUE
ssl-verify-server-cert FALSE
ssl-ca (No default value)
ssl-capath (No default value)
ssl-cert (No default value)
ssl-cipher (No default value)
ssl-key (No default value)
ssl-crl (No default value)
ssl-crlpath (No default value)
tls-version (No default value)
table FALSE
user (No default value)
safe-updates FALSE
i-am-a-dummy FALSE
connect-timeout 0
max-allowed-packet 16777216
net-buffer-length 16384
select-limit 1000
max-join-size 1000000
secure-auth TRUE
show-warnings FALSE
plugin-dir (No default value)
default-auth (No default value)
binary-mode FALSE
connect-expired-password FALSE
```
mysql(选项)(参数)
```
### 选项
## 安装mysql
### centos
```sh
yum安装
https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.38-1.el6.src.rpm
rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
yum localinstall platform-and-version-specific-package-name.rpm # 例如mysql57-community-release-el6-11.noarch.rpm
yum install -y mysql-community-server
MySQL 5.7.6 and later:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
防火墙的3306端口默认没有开启若要远程访问需要开启这个端口
打开/etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
mysql -u root -p xxxx -h 127.0.0.1
ALTER USER USER() IDENTIFIED BY '123456';
flush privileges
从任何主机上使用root用户密码youpassword你的root密码连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
```
-hMySQL服务器的ip地址或主机名
-u连接MySQL服务器的用户名
-e执行mysql内部命令
-p连接MySQL服务器的密码。
```
### 参数
## 升级和降级mysql
数据库:指定连接服务器后自动打开的数据库。
```sh
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->
```
## 其他记录
Loading…
Cancel
Save