Skip to content

Instantly share code, notes, and snippets.

@knownothingsnow
Last active July 13, 2020 20:01
Show Gist options
  • Save knownothingsnow/e3525de854effe266317ae8b152dbb3b to your computer and use it in GitHub Desktop.
Save knownothingsnow/e3525de854effe266317ae8b152dbb3b to your computer and use it in GitHub Desktop.

前端开发常用命令和配置

Sass

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ gem sources -l

确保只有 gems.ruby-china.org,遇到ssl证书问题,改用http

安装node-sass失败时,打开~/.npmrc,添加

SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/

Puppeteer 同理:

PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org

npm

  • nvm安装最新版node.js同时迁移旧版本的npm module

nvm install node --reinstall-packages-from=node

  • 修改源地址为淘宝 NPM 镜像

npm config set registry http://registry.npm.taobao.org

  • 修改源地址为官方源

npm config set registry https://registry.npmjs.org/

  • 淘宝源参数

--registry=https://registry.npm.taobao.org

  • 一些常用工具

npm i -g browser-sync cooking eslint font-spider webpack vue-cli bower generator-gulp-angular gitbook gitbook-cli grunt-cli gulp lambda-view less rollup standard yo electron

  • 彻底删除node.js

#查看已经安装在全局的模块,以便删除这些全局模块后再按照不同的 node 版本重新进行全局安装
npm ls -g --depth=0
#删除全局 node_modules 目录
sudo rm -rf /usr/local/lib/node_modules   #删除 node
sudo rm /usr/local/bin/node
#删除全局 node 模块注册的软链
cd /usr/local/bin && ls -l | grep "../lib/node_modules/" | awk '{print $9}'| xargs rm

Git

  • 设置用户名和邮箱

git config --global user.name ""
git config --global user.email ""

Shell

Generating Ed25519 Key

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "john@example.com"

安装zsh

  • 查看最新zsh信息

brew info zsh

  • 安装zsh

brew install --disable-etcdir zsh

  • 添加shell路径至/etc/shells文件中,将 /usr/local/bin/zsh 添加到下面文件中

sudo vim /etc/shells

  • 更换默认shell

chsh -s /usr/local/bin/zsh

添加 curl 代理

  • 编辑 ~/.curlrc

socks5 = "127.0.0.1:1086"

macOS

  • finder显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

  • 重置 Launchpad

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

  • TouchID 授权 sudo 指令

sudo vim /etc/pam.d/sudo
添加 "auth sufficient pam_tid.so"

  • 彻底删除 Firefox

/Applications/Firefox.app
/Users/Username/Library/Application Support/Firefox/
/Users/Username/Library/Caches/Firefox
/Users/ Username /Library/Preferences/org.mozilla.firefox.plist

alias

# shell & quick start
alias zshconfig="code ~/.zshrc"
alias ohmyzsh="code ~/.oh-my-zsh"
eval $(thefuck --alias)
alias kao="fuck"
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
alias chrome-canary="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
alias chromium="/Applications/Chromium.app/Contents/MacOS/Chromium"

# network
alias goproxy="export http_proxy=socks5://127.0.0.1:1080 https_proxy=socks5://127.0.0.1:1080"
alias disproxy="unset http_proxy https_proxy"
alias show_current_ip="curl -i http://ip.cn"

# node.js
alias npm_registry_global="npm config set registry https://registry.npmjs.org/"
alias npm_registry_cn="npm config set registry http://registry.npm.taobao.org/"

alias yarn_registry_global="yarn config set registry 'https://registry.yarnpkg.com'"
alias yarn_registry_cn="yarn config set registry 'https://registry.npm.taobao.org'"

alias npm_please="rm -rf node_modules/ && rm -f package-lock.json yarn.lock && npm i"
alias yarn_please="rm -rf node_modules/ && rm -f package-lock.json yarn.lock && yarn"

# macOS
alias reset_launchpad="defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock"

良心云

/usr/local/qcloud/stargate/admin/uninstall.sh
/usr/local/qcloud/YunJing/uninst.sh
/usr/local/qcloud/monitor/barad/admin/uninstall.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment