安装了梅林固件的路由器开启SSH以及超频

部分路由器可以通过安装Merlin梅林固件来实现更多的自定义功能。安装更多第三方插件来让路由器变得更强大。在软件自定义的时候不妨试试将路由器进行硬件超频来使其拥有更强劲的性能。实现起来也非常简单,不过需要注意的是,超频可能会造成不可恢复的硬件损害,俗称变砖。超频前要三思,也不要妄图过分超频来让路由器硬件性能达到其不可能达到的等级。要超频需要先登入路由器命令行。推荐使用SSH。Windows下使用puttty等你熟悉的SSH工具,macOS则直接用终端即可。首先梅林默认是不开启SSH的。需要进入路由器管理界面——系统管理——SSH Daemon来开启。 设置如下:其中选项都非常清楚明白,按照个人所需设置即可。SSH key 可以让你登录的时候不用输入密码。也就是你登录路由器管理页面设置的密码。然后在putty或者终端里输入如下命令来登入路由器命令行。命令里的`用户名`是你在浏览器中登录路由器管理页面的用户名。``` ssh 用户名@192.168.50.1 ```一般梅林的默认路由器ip有两个,`192.168.2.1`或者`192.168.50.1`。根据你自己路由器的ip来更改以上命令登入。如果你没设置SSH key的话,接下来需要输入密码了。密码正确就进入路由器命令行了, 你会看到类似以下文字:``` ASUSWRT-Merlin [路由器型号] [梅林版本] Tue Sep 25 12:04:55 UTC 2018 [用户名]@[路由器型号]:/tmp/home/root# ```其中没有中文字的,这里只是说明这里字符代表的意思,你应该能看到你自己路由器的型号、版本、用户名等信息。接下来运行以下命令:``` nvram set clkfreq=1000,800 ```这里的1000是设置CPU频率,800是设置内存频率(800相当于1600)。不要改太大。一般建议CPU频率设置数值为默认频率加200就比较安全。性能也能得到较好提升。否则变砖甚至烧机得不偿失。然后运行以下命令来提交更改。``` nvram commit ```最后运行`reboot`来重启路由器。如果没什么问题,重启完成后路由器就超频成功了。有时候会遇到路由器亮两个红灯无法正常启动的情况,不要慌,这不是变砖,只是启动失败。刷了梅林之后会经常遇到启动失败的问题。这时候只要给路由器断电,等几秒,再次按电源键启动即可。如果还是启动不了就再重启一次。多试几次一般都能成功启动。实在不行只能重置。拿笔戳重置按钮30秒,然后继续按着重置按钮不动,重置电源启动30秒,再关闭电源30秒,最后再启动。传说中的`30-30-30`大法,重置成功就代表没变砖。

Read More

Use Husky to manage git hooks

[Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) is a powerful tool to make your life easier.It fires off custom scripts when certain important actions occur. one common scene like: you want to lint your code every time when you commit changes, so that your code has a good style and following your team's code specification. Or you want to run test before pushing your code/> Like many other Version Control Systems, Git has a way to fire off custom scripts when certain important actions occur. There are two groups of these hooks: client-side and server-side. Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits. You can use these hooks for all sorts of reasons.With git hooks, you can make these actions automatically.While [**husky**](https://www.npmjs.com/package/husky) is a tool to make Git hooks easier to use. To use it is very easyFirst you install it as a development dependency with npm:```bash npm install husky --save-dev ```OR **yarn**:```bash yarn add husky -D ```Then in your `package.json` , add:```json { "husky": { "hooks": { "pre-commit": "yarn lint", "pre-push": "yarn test", "...": "..." } } } ```In the example, we added 2 hooks, `pre-commit` and `pre-push`, they are meant what they named.- **pre-commit** means, every time you run `git commit`, it will run `yarn lint` first, and commit the code if `yarn lint` passes without error. - **pre-push** run command `yarn test` when you run `git push` - `yarn lint` and `yarn test` are commands that you define in your `scripts` in package.json. normally those commands that you runs manually, like `yarn start` or `yarn dev`, etc. you can add any command you want and run the, in the hooks.Pretty straight forward and easy :)

Read More

How to trigger click event in Gmail

If you want to hack Gmail UI, to build web extension or any other similar tool that works on top of Gmail, you always want or need to trigger some DOM events in Gmail UI, like you want to click on some buttons/icons, to send out email, to make the compose window pop out, etc.You can't do it by simply use `click` function, either by Vanilla JS or jQuery, either `click` or `trigger` function can not achieve your goal.You need to do this by using [`Document.createEvent()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent).Take `click` for example, you want to click an `icon`:```javascript const mouseDown = document.createEvent('MouseEvents') mouseDown.initEvent('mousedown', true, false) icon.dispatchEvent(mouseDown)const mouseUp = document.createEvent('MouseEvents') mouseUp.initEvent('mouseup', true, false) icon.dispatchEvent(mouseUp) ```You may want to make it as a function so that you can use it click any element.

Read More

Boost your Frontend development speed in China

Waiting for something is wasting time, especially when development, you always need to wait for compiling, wait for install dependencies...And if you are in China, this waiting time will be much longer because of some well known reason.Here are some changes that will save you some time in China if you are doing frontend development.## Ruby and Railschange your gem source to China mirror, source: https://ruby-china.org/```bash gem source -a https://gems.ruby-china.com ```## npmchange your npm source to China mirror, source , source: https://developer.aliyun.com/mirror/NPM```bash npm config set registry https://registry.npm.taobao.org ```or you can also install a `cnpm`, use `cnpm` rather than `npm`, to avoid change the source url permanently.```bash $ npm install -g cnpm --registry=https://registry.npm.taobao.org ```## yarnSame as npm.```bash yarn config set registry https://registry.npm.taobao.org --global ```there is no `cyarn` though## ubuntuchange sourcelist, check [this post](/change-ubuntu-18-04-source-to-china-mirror)## homebrewchange homebrew core source and repo to USTC (University of Science and Technology of China) [Mirror](https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git).- change brew.git: ```bash cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git ```- change homebrew-core.git ```bash cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git ```- change homebrew bottles source for `bash` user ```bash echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile ``` for `zsh` user ```bash echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc ```

Read More

RIP, Kobe Bryant

RIP![RIP, Kobe Bryant](https://s3.amazonaws.com/ogden_images/www.adirondackdailyenterprise.com/images/2020/01/26152959/BryantKobe05wiki-563x840.jpg 'RIP, Kobe Bryant')

Read More