MAC使用技巧
- Command+Shift+. 可以显示隐藏文件、文件夹,再按一次,恢复隐藏;
- finder下使用Command+Shift+G 可以前往任何文件夹,包括隐藏文件夹;
- 恢复备份时的默认密码是:0000
More than 10 years backend development experience in e-commerce field. More than 3 years tech leader and frontend development experience. Proficient practical experience in DDD,Cloud-Native Development and DevOps。Focusing on ML&AI. Interested in web3 and metaverse.

最终效果!

iTerm2 是 MAC 下最好的终端工具。
可以使用Homebrew来安装:
$ brew cask install iterm2
iTerm2 的一些特色功能如下。
iTerm2的tab会通过变色来提示当前tab下的任务有新活动,有新的输出时tab会变成洋红色,新的输出长时间没看,tab会变成红色。
在 iTerm2 中,双击选中,三击选中整行,四击智能选中(智能规则可配置),可以识别网址,引号引起的字符串,邮箱地址等。(很多时候双击的选中就已经很智能了)
在 iTerm2 中,选中即复制。即任何选中状态的字符串都被放到了系统剪切板中。
使用CMD+F打开搜索,然后输入需要复制的内容开头关键字,如IP的第一节,搜到后按Tab键,智能选中需要复制的内容并且已经拷贝到剪贴板。
按住⌘键:
⌘+←, ⌘+→, ⌘+{, ⌘+}。⌘+数字直接定位到该tab;⌘+t;⌘+[, ⌘+];⌘+d水平切分,⌘+shift+d 垂直切分;⌘+Option+方向键;⌘+f;⌘+/⌘+shift+M标记,⌘+shift+J跳回标记,⌘+shift+up/down在标记间切换⌘+shift+H⌘+option+BiTerm2可以自动补齐命令,输入若干字符,按⌘+;弹出自动补齐窗口,列出曾经使用过的命令。
你可以自由定制喜欢的配色,这里收集了大量iTerm2的主题。在其github repo里下载对应的xxx.itermcolors文件安装,安装方法如下:
⌘+iColorstabLoad PresetsImport.itermcolors文件Load Presets选择刚刚导入的主题但是最理想的配色方案在这里https://github.com/altercation/solarized
$ git clone https://github.com/altercation/solarized.git
Solarized Dark.itermcolors和Solarized Light.itermcolors两个文件就可以把明暗两种配置文件导入到iTerm2里
MAC默认自带终极shell!
修改默认bash
$ chsh -s /bin/zsh

Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout...
“Oh My ZSH!”
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
agnoster是一个zsh主题,特别为使用iTerm2 + Solarized Dark主题,又经常使用Git的用户定制。
$ git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git
执行工程里的install脚本,主题将安装到~/.oh-my-zsh/themes目录下
打开~/.zshrc文件,然后将ZSH_THEME后面的字段改为agnoster。
指令高亮效果作用是当用户输入正确命令时指令会绿色高亮,错误时命令红色高亮
$ git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
$ echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
$ pip install powerline-status --user
使用zsh主题需要配合Powerline字体
安装完成后提示所有字体均已下载到/Users/{username}/Library/Fonts路径下
具体的操作是iTerm2 -> Preferences -> Profiles -> Text,在Font区域选中Change Font,选择for Powerline的字体
Maybe you also want to try this
brew install wgetbrew cask install chrome$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew search /wge*/ # 搜索软件,后面是正则表达式
$ brew info wget # 查看软件信息
$ brew install wget # 安装 wget
$ brew list wget # 列出该软件安装后的文件
$ brew uninstall wget # 卸载 wget
$ brew tap caskroom/cask
# brew cask 和 brew 的命令基本一致,search, info, list, install, uninstall 子命令都一样
$ brew cask install java # 安装 Java
$ brew cask uninstall java # 卸载 Java
$ brew cask install --force $(brew cask outdated | awk '{print $1}' | xargs) # 更新Cask
$ brew cleanup # 卸载旧版本软件,Homebrew升级时是全新安装,不卸载旧版,需要手动卸载旧版本软件
$ brew update # 更新Homebrew
$ brew upgrade # 更新所有过期软件
$ brew doctor # brew自检
$ brew outdated # 列出所有过期软件
$ brew --cache # 打印brew下载包存放位置
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)
Download the uninstall script and run ./uninstall --help to view more uninstall options.
pm2 install pm2-logrotate
The following is an example of configuring pm2-logrotate. Other configuration items are similar to being configured. Please check current configuration or pm2 official documentation for detailed configuration items.
pm2 set pm2-logrotate:max_size 100M
pm2 list
If this module is working you should be able to see its status in the "Module" section.

pm2 conf pm2-logrotate

pm2 logs pm2-logrotate
pm2 reload pm2-logrotate
当一个请求到达时,nginx通过如下算法确定最终用哪一个block来serve这次请求。
yarn add nodemon --devyarn add expressyarn add cookie-parseryarn add helmetimport helmet from 'helmet';const app = express();app.use(helmet());yarn add passportyarn add mongooseyarn add mongoose-aggregate-paginate-v2yarn add winstonKafka作者之一Jay Kreps曾经谈及过命名的原因:
因为 Kafka 系统的写性能很强,所以找了个作家的名字来命名似乎是一个好主意。大学期间我上了很多文学课,非常喜欢 Franz Kafka 这个作家,另外为开源软件起这个名字听上去很酷。
Kafka 是 LinkedIn 公司内部孵化的项目。
Kafka 在设计之初就旨在提供三个方面的特性:
Kafka既是消息引擎系统,也是一个分布式流处理平台。

设置环境变量,提高JVM堆大小,业界公认最佳配置为6G,修改GC算法
$> export KAFKA_HEAP_OPTS=--Xms6g --Xmx6g
$> export KAFKA_JVM_PERFORMANCE_OPTS= -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true
$> bin/kafka-server-start.sh config/server.properties