開發資料大全(個人整理,長期維護)

Mike617發表於2018-09-25

訪問地址:傳送門

Handy Note

DB

Use navicat11 client to connect localhost mysql database and get Client does not support authentication protocol requested by server; consider upgrading MySQL client

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpass';
複製程式碼

IDE

idea2018 active code

http://idea.lanyus.com/
複製程式碼

use zsh as the default shell in vscode

  1. Open User Settings and search terminal.integrated.shell.osx

  2. Set it to /bin/zsh

use code command to open a project with vscode quickly in shell

  1. Command+Shift+P and search shell command

  2. Choose Install 'code' command in PATH

preview markdown file real time in vscode

  1. Command+Shift+P and search markdown

  2. Choose Open locked preview to the side

Maven

環境變數

vim ~/.bash_profile
export M2_HOME=/Users/username/Documents/maven #這裡是你maven的路徑
export PATH=$PATH:$M2_HOME/bin
source ~/.bash_profile

mvn -v
複製程式碼

外掛使用

外掛問題

Linux

檢視Linux系統版本

lsb_release -a
複製程式碼

lsb = Linux Standard Base

CPU使用情況

top
複製程式碼

CPU資訊

cat /proc/cpuinfo |more
複製程式碼

檢視記憶體

free -m
複製程式碼

檢視磁碟

df -h
複製程式碼
fdisk -l
複製程式碼

命令解讀

which&where

/usr/bin和/usr/local/bin區別

MacOS

use zsh as the default shell

  1. See the shells you already installed with the command
cat /etc/shells
複製程式碼
  1. Set zsh as the default shell
chsh -s /usr/local/bin/zsh
複製程式碼
  1. (Optional)If you want to configure zsh mannually, use
vim ~/.zshrc
複製程式碼
  1. After change .zshrc, do remember to source it to make it work
source ~/.zshrc
複製程式碼
  1. (Restore default shell)
chsh -s /bin/bash
複製程式碼

Git

初始化git

  1. 檢視配置
git config --list
複製程式碼
  1. 初始化使用者和郵箱
git config --global user.name "your name"
git config --global user.email your email
複製程式碼

本地生成ssh key並放在遠端以實現SSH訪問

  1. Generate a ssh key locally
ssh-keygen -o
複製程式碼
  1. Catch your key just generated before
cat ~/.ssh/id_rsa.pub
複製程式碼
  1. Put it into your ssh keys in your romote repository

解決使用vs code開啟從github上git clone下來的專案,修改後並做git remote關聯,在git push時每次都要輸入賬號和密碼

儲存全域性賬號

git config --global credential.helper wincred
複製程式碼

git全域性配置使用者名稱,因誤操作產生多條配置,導致無法修改

產生背景

使用如下錯誤命令及引數修改配置

git config --global user.name = "M1kewang"
複製程式碼

首先修改配置項user.name並不需要等號,也不需要引號

這樣配置的結果就是產生了兩條user.name,如下

git config -l

user.name=magi
user.name==
複製程式碼

即產生了一條user.name值為一個等號的記錄

此時再去對user.name這個屬性操作即會報錯,因為存在兩條同屬性名的屬性,git會混亂,而不知道你要操作的是哪個屬性配置

具體報錯

warning: user.name has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --replace-all to change user.name.
複製程式碼

解決方案

先看一下git存在哪些配置引數

git config
複製程式碼

發現裡面有個--unset引數,用於remove一個variable(在git中,配置被當做全域性變數被儲存,這和MySQL很像)

但是嘗試這樣修改,並不理想,會提示你要修改的屬性存在多條記錄

warning: user.name has multiple values
複製程式碼

正確的方法應該是對這個屬性進行批量操作,即對所有同名的屬性值進行修改

git config --global --replace-all user.name M1kewang
複製程式碼

這樣就git會把修改後的兩條相同屬性合併為一條,恢復正常

Github

上傳本地專案到github

  1. Get into your project folder and git init, then a .git folder was created.

  2. Add your files to git.

git add .
複製程式碼
  1. Commit your added files to the stage area.
git commit -m "write your comment"
複製程式碼
  1. Link your local git project with your GitHub repository.
git remote add origin https://github.com/youraccount/yourrepository.git
複製程式碼
  1. Pull the existed files of your current GitHub repository.
git pull origin master
複製程式碼
  1. Fix the conflicts if there exist.

  2. Push your local project managed by git to your remote GitHub repository.

git push -u origin master
複製程式碼
  1. Done.

Gitlab

Terminal

  • nslookup 域名相關

TODO

  • [ ] nslookup

相關文章