Mac工具篇(二)

我们害怕的不是宿敌,而是未知。 ——烈酒不醉

基本操作

1、设置iCloud链接

ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs iCloud

2、安装 lrzsz

2.1、安装
brew install lrzsz
# 安装完后检查 /usr/local/bin/sz 是否存在
2.2、在 usr/local/bin/ 创建脚本
2.2.1、iterm2-send-zmodem.sh
#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi
if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    /usr/local/bin/sz "$FILE" -e -b
    sleep 1
    echo
    echo \# Received $FILE
fi
2.2.2、iterm2-recv-zmodem.sh
#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script
# licensed under cc-wiki with attribution required 
# Remainder of script public domain

osascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; then
    FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
else
    FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"`
fi

if [[ $FILE = "" ]]; then
    echo Cancelled.
    # Send ZModem cancel
    echo -e \\x18\\x18\\x18\\x18\\x18
    sleep 1
    echo
    echo \# Cancelled transfer
else
    cd "$FILE"
    /usr/local/bin/rz -E -e -b
    sleep 1
    echo
    echo
    echo \# Sent \-\> $FILE
fi
2.3、关联trigger

打开iterm2—— 同时按 command和,键 ——-Profiles ———- Default ——- Advanced —— Triggers的Edit按钮

Regular expression: /*/*B0100
Action: Run Silent Coprocess
Parameters:/usr/local/bin/iterm2-send-zmodem.sh


Regular expression: /*/*B00000000000000
Action: Run Silent Coprocess
Parameters:/usr/local/bin/iterm2-recv-zmodem.sh

3、安装 Hexo

npm install -g hexo-cli

4、安装 Sshpass

4.1、编译安装

wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz  
tar xvzf sshpass-1.05.tar.gz  
./configure --prefix=/usr/local/Cellar/sshpass/1.05  
make  
sudo make install

4.2、配置映射

参见Mac工具篇(一)文章


文章作者: HoldDie
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 HoldDie !
评论
 上一篇
Mac-IDEA快捷键(三) Mac-IDEA快捷键(三)
快捷键:缩进缩进代码:command - 展开代码:command + 全部缩进代码:shift command - 全部展开代码:shift command + 多选同时选择相同代码(单个):control G 回退选中相同的代码:shi
2018-10-17
下一篇 
Kafka-核心组件(五) Kafka-核心组件(五)
胜利只是暂时的,你该警醒,敌人在黑暗中嘲笑自己。 ——真弓·麒麟 3 协调器 Kafka 提供了消费者协调器(ConsumerCoordinator)、组协调器(GroupCoordinator)和任务管理协调器(WorkCoordin
2018-10-15
  目录