杂记[Archives]

在Hexo中发布一篇带图片的文章

发布文章

到博客目录:

cd /var/www/i99939/hexo_blog/

创建博客:

hexo new "MAC mouse moving speed"

在source/_posts/下可以看见:

ls -l source/_posts/

将写好的博客文件拷贝覆盖hexo创建的文件:

cp your-blog.md /var/www/i99939/hexo_blog/source/_posts/MAC-mouse-moving-speed.md

目录结构类似:

-rw-r--r-- 1 root root  911 Mar  9 07:52 Mac-mouse-moving-speed.md
drwxr-xr-x 2 root root 4096 Mar 9 14:52 config-ssh-key-login-linux
-rw-r--r-- 1 root root 1680 Mar 10 14:48 config-ssh-key-login-linux.md

在博文中添加图片

将_config.yml文件中的配置项post_asset_folder设为true

post_asset_folder: true

这样,在输入命令时:

hexo new "config ssh key login linux"

在source/_posts目录下会创建存放图片文件的目录:

source/_posts/config-ssh-key-login-linux

将图片hacking.png拷贝:

source/_posts/config-ssh-key-login-linux/hacking.png

在config-ssh-key-login-linux.md文件中需要显示图片的地方,插入:

{% asset_img hacking.png "blogs image" %}

这样图片在文章和首页中可以同时显示

发布

cd /var/www/i99939/hexo_blog/
hexo clean
hexo d -g

在Mac上设置密钥(SSH KEY)登录Linux

Linux服务器,输入以下命令:

lastb | less

你会看到非常多的类似以下的记录:

这些都是在不停尝试登陆你服务器的记录;

生成秘钥

使用ssh-keygen生成,输入以下命令:

ssh-keygen -t rsa

运行结果:

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/bstardev/.ssh/id_rsa):
/Users/bstardev/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~/.ssh/id_rsa.pub.

其中id_rsa是私钥,id_rsa.pub是公钥,分别保存以备用。

上传生成的公钥

登陆需要配置密钥登陆的服务器,将公钥内容填入~/.ssh/authorized_keys文件中:

cd ~/.ssh/
vi authorized_keys

保存后,对.ssh目录和其中的authorized_keys公钥文件设置相应的权限:

chown -R 0700  ~/.ssh
chown -R 0644 ~/.ssh/authorized_keys

配置ssh服务以使用密钥登陆

接着修改ssh配置文件:

vi /etc/ssh/sshd_config

对以下内容去掉注释:

StrictModes no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no

保存后重启sshd服务:

systemctl restart sshd

退出重新登陆服务器,这次使用密钥登陆,测试是否成功。

这样就完成了密钥登陆的配置。

MAC鼠标速度

Mac 中跟鼠标有关的默认选项有以下三个,不用第三方软件也可以改动效果

鼠标双击阈值:

defaults read -g com.apple.mouse.doubleClickThreshold

鼠标加速度:

defaults read -g com.apple.mouse.scaling

滚动速度:

defaults read -g com.apple.scrollwheel.scaling

如果鼠标使用有异常,可以再终端中读以上三个参数,并根据自己的需要适当调高调低

鼠标双击阈值:

defaults write -g com.apple.mouse.doubleClickThreshold 0.75

鼠标加速度:

defaults write -g com.apple.mouse.scaling 5

滚动速度:

defaults write -g com.apple.scrollwheel.scaling 0.75

三个选项数值范围未验证,自己根据需要调低调高,系统重启后生效。