A plug-in that enhances various previews

  • Preview to see image resolution & size
  • Code syntax highlighted
  • Quickly preview the zip package
  • A quick preview of markdown format content
brew cask install qlcolorcode betterzipql qlimagesize qlmarkdown
Copy the code

Second, the iTerm2

There are a lot of specific configurations on the Internet. Post a personal knife operation of the tutorial

Programmers often work with Terminal operations, so many commands are made in command line mode, where the native Terminal command is stored in.bash_profile, and iterm2 is used with Oh my ZSH, in which case the command is stored in.zshrc.

So we saved and edited a lot of commands. Here is also to share my personal commonly used configuration. Constantly updated, like students can take to use directly

#Enter your usual commands
#Finder related instructions
alias co='code ./'
alias fo='open ./'

#Pod and Xcode project related instructions
alias o='open *.xcodeproj'
alias po='open *.xcworkspace'
alias pru='pod repo update'
alias pi='pod install'
alias pu='pod update'
alias piu='pod install --repo-update'
alias repoanalysis='specbackwarddependency /Users/liubinpeng/.cocoapods/repos/XXCompany_specs'
alias plint='pod lib lint --sources=git@git.***-inc.com:client/App-Specs.git,git@git.***-inc.com:client/CocoaPods-Specs.git --allow-warnings --verbose --use-libraries'
alias errorShow=' >1.log 2>&1'
#Git Instructions
alias gck='git checkout'
alias gm='git merge'
alias gb='git branch'
alias gbr='git branch -a'
alias gs='git status'
alias gc='git clone'
alias gl='git log'
alias ga='git add .'
alias gpull='git pull'
alias gpush='git push'
alias gcm='git commit -m'
alias glocalbranchPush='git push --set-upstream origin '
alias glg="git log --graph --pretty=format:'%Cred%h%Crest -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
#NPM related instructions
alias ns='npm start'
alias ni='npm install'
alias nb='npm run build'
alias nig='npm install -g '
alias nt='npm test'

#Vue related commandsAlias vc='vue-init webpack' # (vue-init webpack test1
# ReactAlias rc='create-react-app' #(create-react-app todolist
#The React Native commandRNC todolist alias RNRelease=' React-native bundle 'RNC todolist alias RNRelease=' React-native bundle --entry-file index.js --platform ios --dev false --bundle-output release_ios/main.jsbundle --assets-dest release_iOS --sourcemap-output release_ios/index.ios.map; '# RN on Release
#The terminal opens the application
## Open the browser
alias OpenWithSafari='open -a "/Applications/Safari.app" '
alias OpenWithChrome='open -a "/Applications/Google Chrome.app" '
#Open the MarkDown file with Typora to preview the writing effect.
alias OpenMDPreview='open -a "/Applications/Typora.app" '
#Open DB file with DB Browser for SQLite
alias OpenDB='open -a "/Applications/DB Browser for SQLite.app" '
#Open the project with SourceTree
alias openSourceTree='open -a "/Applications/Sourcetree.app/" '
#Environmental variables Flutter

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/liubinpeng/flutter/bin:$PATH


#The Android SDK path

export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/emulator
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools


#IOS Emulator enabled
alias iOSSimulator='open -a Simulator'

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion


# Node Version Manager
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.Export N_PREFIX=/usr/local/bin/node # export N_PREFIX= $N_PREFIX/bin:$PATH export PATH=/Users/liubinpeng/Desktop/Github/GitWorkflow/bin:$PATH

#Exploration of Chrome source code
# export PATH=/Users/liubinpeng/Desktop/Tech-Research/iOS/depot_tools:$PATH


#Specify the Pyhton version
# Setting PATH for Python 2.7PATH = "/ System/Library/Frameworks/Python framework Versions / 2.7 / bin: ${PATH}" the export PATH# Setting PATH for Python 3.7.4PATH = "/ usr/local/Cellar/python / 3.7.4 / bin: ${PATH}" alias Python = '/ System/Library/Frameworks/python framework Versions / 2.7 / bin/python2.7' alias Python3 = '/ usr/local/Cellar/python / 3.7.4 / bin/python3'


#Disable automatic updates when terminals install plug-ins using Homebrew

alias disableHomebrewUpdate="export HOMEBREW_NO_AUTO_UPDATE=true"


#Settings related to terminal search (slightly delayed after switch on)Function proxy_off(){unset ALL_PROXY echo -e "learning mode is closed"} function proxy_on(){export ALL_PROXY=socks5://127.0.0.1:1081 Echo -e "learning mode enabled"}
 
#PHP package management tool, Composer
export PATH="~/.composer/vendor/bin:$PATH"

#Python version switching tool, which takes effect globally 
export PYENV_ROOT=~/.pyenv
export PATH=$PYENV_ROOT/shims:$PATH


#The efficiency of
#Count the number of files in the current folder
alias showFilesCount='ls -l |grep "^-"|wc -l'
Copy the code

Exit editing and run source.zshrc

Verify: Type in the terminal in the directory where your Git project is locatedglg

Add common shortcut keys for your terminal

We often do some pure instructions in the terminal, every day, every month to knock this time is a waste of time, save 5 minutes a day, a year to save 365*5/60 = 30H. A calculate is startled. We waste so much time each year on some terminal instructions. Note how to add shortcuts to your Mac terminal today.

If it is ZSH, you can edit the contents of the.zshrc file. The built-in terminal will edit the bash_profile script.

1. Output the file directory structure

brew install tree
Copy the code

Usage:

  1. We can specify the traversal hierarchy during directory traversal using the -l argument

    tree -L 2
    Copy the code
  2. If you want to export the tree of a directory to the file readme.md, do so

    tree -L 2> readme.md // Then we look at the readme.md file in the current directoryCopy the code
  3. Show only folders

    tree -d 
    Copy the code
  4. Displays the level of the item, with n for the number of levels. Example: Display a three-tier project structure, tree-L 3

    tree -L n 
    Copy the code
  5. The tree -i pattern is used to filter files or folders that do not want to be displayed. For example, to filter the node_modules folder in a project

    tree -I"Node_modules"Copy the code

2. Browser related

  1. search

    Search under the specified site for inURL: jobbole.com intitle:Hybrid

Baidu cloud disk cracking

  1. Membership experience is generally 60 seconds, through this code can always be downloaded at the speed of the member.
git clone https://github.com/CodeTips/BaiduNetdiskPlugin-macOS.git && ./BaiduNetdiskPlugin-macOS/Other/Install.sh
Copy the code
  1. Baidu net disk download at full speed
  • First copy the address you want to download into your browser
  • Then join WP after the domain name Baidu
  • Press enter. Visit the page, select download address 1 to download at full speed.
After before / / https://pan.baidu.com/s/1ubcQH34m69hIjYu3CD2S2g / / https://pan.baiduwp.com/s/1ubcQH34m69hIjYu3CD2S2gCopy the code

4. Common shortcut keys

In many cases, we will edit the file at the terminal, and we have the following shortcut keys for submission efficiency.

  • ESC + DD: deletes the data in the current row

Iv. “Security and Privacy” system does not display “from any source”

Execute the following command on the terminal

sudo spctl --master-disable
Copy the code

5. Centralized display of system error information

pod spec lint *** 2>&1|tee 1.log
Copy the code

Operations are often performed on the terminal, and one of the cases is to check for validity during iOS component library maintenance. You’ll find information all over the screen, even several pages, but in fact when we go to the wrong page and we find it very difficult to locate the problem, so the idea is to print out any output from this process in one place and look at it. The code is above.

Several concepts:

  • 0 stdin, 1 stdout, 2 stderr
  • | : pipeline. The purpose of a pipe is to provide a channel that redirects the standard output of the previous program to the standard input of the next program.
  • Tee: Reads from standard input and writes to standard output and to a file.

Terminal search files

  1. The terminal searches for files ending in ‘.log ‘
find . -name '*.log'
Copy the code
  1. Install the ACK package.
brew install ack
Copy the code

It is simple to use, such as ack + the keyword you are looking for, which displays the results below, with the full file path.

Terminal will be updated every time brew install is executed, very time-consuming, how to prohibit update.

export HOMEBREW_NO_AUTO_UPDATE=true
Copy the code

7. How to find information on Mac terminals

Amway is one of the fastest, cheapest and most cost-effective search tools I’ve ever used. Link personal use is less than 120 yuan a year, a month 60G traffic is enough, open some websites seconds open.

In addition, many development needs terminal download some resources, but the terminal and the browser to go to the channel is not the same, so the browser can find information, terminal or not, so you can add the following script in.zshrc or.bash_profile

Function proxy_off(){unset ALL_PROXY echo -e "learning mode is closed"} function proxy_on(){export ALL_PROXY=socks5://127.0.0.1:1081 Echo -e "learning mode enabled"}Copy the code

Use proxy_on to enable the terminal search mode and proxy_off to disable the terminal search mode.

8. Cloud Server Usage Scenarios

As a big front-end developer, I often use the cloud to deploy personal App services, personal blog deployments, automated scheduled tasks, and more.

Personal blog local deployment can share my practice:

I was going to write it in Markdown and submit it to a Github repo as a blog, but it wasn’t convenient enough, so I wrote a deployment script using Nodejs.

HEXO is used to facilitate the processing of MD files. Your own written style; The Node script was developed to migrate the knowledge-kit blog files from the repo to the hexo Source directory in the desired format. Need to directly download clone, modify the code path. There are comments in the code. See the Repo for details

Cloud server Individuals use Tencent Cloud and can deploy their own HTTPS certificates. Various GUI panels are convenient.

Continuing updates…