#### 安裝expect
```shell
brew install expect
```
#### 編寫expect腳本
例如在`~/.ssh`下新建`login.exp`文件。
```shell
#!/usr/bin/expect -f
# 第一個參數為目標server的ip
set ip [lindex $argv 0 ]
# 第二個參數為目標server的用戶名
set username [lindex $argv 1 ]
# 第三個參數是端口號,默認22、
set port [lindex $argv 2]
# 第四個參數為目標server的密碼
set mypassword [lindex $argv 3 ]
set timeout 10
spawn ssh $username@$ip -p $port
expect {
# 如果返回的內容里面有'yes/no',則輸入yes
"*yes/no" { send "yes\r"; exp_continue}
# 如果返回的內容里面有assword(我們的server有些返回'password', 有些返回'Password')的文本, 則輸入密碼
"*assword:" { send "$mypassword\r" }
}
send_user "It's OK\r"
interact
```
#### 在iTerm2中新建profile
例如profile叫`bl`,在`profile->general->command`中,輸入
```sh
~/.ssh/login.exp {地址} {username} {password}
```
之后,如需登陸,`command+o`,打開profile界面,選擇`bl`即可。
- Welcome
- fzf使用
- git回滾
- 安裝gollum使用github作為wiki端
- 使用github的issue
- linux的腳本
- git沖突解決
- sphinx生成python文檔
- 使用aria2作為下載客戶端
- tmux使用
- anaconda的虛擬環境構建
- git commit message
- tensorflow指定GPU,限制顯存
- pycharm professional
- 好用的命令行工具
- lrzsz使用
- 使用iTerm2的profile免密登陸遠程主機
- quicklook 插件
- docker基本使用
- jupyter notebook轉html和pdf
- jupyter-notebook幾個有用命令
- mongodb安裝
- pytorch載入與訓練模型
- git覆蓋分支
- Jetson TX2資源
- GitHub上fork的repo和上游分支保持一致的方法
- vscode調試前端代碼
- github hosts
- git添加遠程倉庫
- 其它語言好用的庫/包
- git強制拉取和強制提交
- chrome擴展發布
- mac的CPP lib
- vscode遠程