mac osx 锁屏方法

1. mission control => 触发角 => 启用屏幕保护程序 or 将显示器置入睡眠状态
2. 安全性与隐私 => 进入睡眠或开始屏幕保护程序 立即 要求输入密码

接下来使用触发角就可以立即锁屏了

kafka修改 topic retention

查看所有的 topic

bin/kafka-topics.sh --list --zookeeper localhost:2181

修改为 60s


# bin/kafka-configs.sh --zookeeper localhost:2181 --alter --entity-name provider-service --entity-type topics --add-config retention.ms=60000

查看

# bin/kafka-configs.sh --zookeeper localhost:2181 --describe --entity-name provider-service --entity-type topics
Configs for topics:provider-service are retention.ms=60000

bash countdown

输入 countdown + 秒数,就开始倒计时了

gnu date

function countdown(){  
    local now=$(date +%s)
    local end=$((now + $1))
    while (( now < end )); do   
        printf "%s\r" "$(date -u -d @$((end - now)) +%T)"  
        sleep 0.25  
        now=$(date +%s)
    done  
    echo
}

osx date

function countdown(){  
    echo $2
    local now=$(date +%s)
    local end=$((now + $1))
    while (( now < end )); do   
        printf "%s\r" "$(date -u -j -f %s $((end - now)) +%T)"  
        sleep 0.25  
        now=$(date +%s)
    done
}

参考:https://superuser.com/questions/850368/osx-bash-command-line-countdown-timer?answertab=votes#tab-top