Skip to content

Instantly share code, notes, and snippets.

View xkniu's full-sized avatar
👻
Curiosity

Xuekai Niu xkniu

👻
Curiosity
View GitHub Profile
@xkniu
xkniu / ssh-login-on-new-server.sh
Created September 2, 2018 17:00
Create user on sever and set ssh login
# Add a new user if needed
useradd foo
passwd foo
# Create ssh directory in new user home
# Add your publish key to it
cd ~ && mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys
# Set ssh directory permissions (http://www.openssh.org/faq.html#3.14)
chmod 700 ~/.ssh
@xkniu
xkniu / avoid-mac-auto-sleep.md
Created June 13, 2017 11:53
阻止 Mac 自动休眠(Caffeinate)

有时候需要 mac 做一些事情,不希望它一段时间后自动休眠,又不想修改默认的休眠设置(临时起意,平时还是需要它尽快休眠省电)。可以用过 caffeinate 命令来阻止 mac 休眠。

使用方法:

# 阻止机器休眠(后台跑程序、听歌等,屏幕过段时间后会自动关闭)
caffeinate

# 阻止屏幕(-d display)休眠
caffeinate -d