Lruihao

Lruihao's Note

不怕萬人阻擋,只怕自己投降

Lruihao's Github chart

hexo next 主题添加字数统计(2018)

警告

2018/11/1 说明 next 主题好像更新了,现在自带的可以用了,如果可以用了,以下教程可以忽略!!!

最近有几个小伙伴问我博客的字数统计怎么实现的,怎么网上的教程不管用啊?一开始我搭建博客的时候也遇到了类似的问题,按照 github 上 wordcount 的 readme 操作后,并没有什么用,我打开 post 相关配置文件并没有发现发现 wordcount 这个关键词,next 本身似乎也并没有在主题配置文件提供选项(或许是个人原因),所以只好自己动手加一个了。为了不重复回答问题,先做个原创记录。转载请注明出处。在此抛转引玉,如果有更好的方法请在留言区提出,我会及时更改。同时也希望小伙伴多发扬折腾精神,多专研,少提问,毕竟还是 RTFSC 大法好!(Read the fucking source code)

hexo d 出错

搭建这个博客以来,隔一段时间就出现一次部署失败的错误,每次都差不多,莫名其妙地出现的。前几次不知道怎么瞎搞就好了。
现在做一下记录,防止以后出错用。
错误如下

hexo 个性化 - next 主题动态显示 subtitle

本文适合我这种纯小白。 目前为止,全网也就只有一个博主写到过这样动态显示 subtitle 的文章。传送门(关键词:js, 后加载)
但是嘞,该博写的不怎么详细,17 年底写的。当然更大的可能是 next 更新了一些文件结构,所以不适合现在使用了。以前我按原博的流程配置了一下没成功就搁在那里了,今天突然心血来潮。翻了翻原博主博客的源码,再与自己的对比了一下,发现了一些端倪。稍作调整后如下:

git index.lock

在 git 没有运行完成之前强制关闭,下次提交的时候会产以下生错误,或者类似的。 1 2 3 4 5 fatal: Unable to create '/xxx/xx/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. 原因是在你进行某些比较费时的 git 操作时自动生成,操作结束后自动删除,相当于一个锁定文件,目的在于防止对一个目录同时进行多个操作。 有时强制关

在 Android 上搭建 hexo 博客

暑假刚开始的时候放假回家没带电脑,只能玩手机,想折腾一下博客都没有条件,在一个发现一个 app, 卧槽 😱,termux 真的强大!(初始化需要科学上网)安卓手机上的 linux 简直了,在手机就可以搭了一个 hexo 博客,只要在 github 上实现分支管理就可以多终端同步更新了。恕我学疏才浅,还只想到这些!一开始想回校后,折腾一下 hexo-admin 实现类似动态博客一样的多终端管理(手动滑稽),现在发现 termux 这样子的操作也不错嘛,挺装哔 hhhhhh**部署后的效果**

石子阵列(组合数学)

链接:https://www.nowcoder.com/acm/contest/157/A 来源:牛客网 1 题目描述xb 有 m 种石子,每种无限个,Ta 想从这些石子中取出 n 个,并按顺序排列起来,为了好看,相邻的石子不能相同。xb 想知道有多少种排列的方法。 2 输入描述第一行有两个正整数 n,m。 3 输出描述第一行一

Dreamoon and Stairs

题目链接 Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move. Dreamoon wants the number of moves to be a multiple of an integer m. What is the minimal number of moves making him climb to the top of the stairs that satisfies his condition? 1 InputThe single line contains two space separated integers n, m (0 < n ≤ 10000, 1 < m ≤ 10). 2 OutputPrint a single integer — the minimal number of moves being a multiple of m. If there is no way he can climb satisfying condition print - 1 instead. 3 Examples 3.1 input110 2 3.2 output16 3.3 input23 5 3.4 output2-1 3.5 NoteFor the first sample, Dreamoon could climb in 6 moves with following sequence of steps: {2, 2, 2, 2, 1, 1}. For the second sample, there are only
0%