Skip to content

Instantly share code, notes, and snippets.

@biaocy
biaocy / ca.js
Last active January 8, 2018 13:35
coinmarketcap.com crytocurrency change analyze
var count = document.querySelectorAll('#currencies-all > tbody > tr').length;
var data = document.querySelectorAll('#currencies-all > tbody > tr > td:nth-last-child(-n+3)');
var h1 = {'up': 0, 'down': 0, 'zero': 0}; //1 hour change
var h24 = {'up': 0, 'down': 0, 'zero': 0}; //24 hours change
var d7 = {'up': 0, 'down': 0, 'zero': 0}; //7 days change
for (let i = 0; i < data.length; i+=3) {
let a = Number(data[i].dataset.usd), b = Number(data[i+1].dataset.usd), c = Number(data[i+2].dataset.usd);
if (a > 0) h1.up++;
else if (a < 0) h1.down++;
@biaocy
biaocy / How_Spring_MVC_Work
Created March 27, 2018 03:25
how spring mvc work
Blog about "How Spring Mvc Work"
1.how request url match? Hint: With namespace <mvc:annotation-driven />, it's use of RequestMappingHandleMapping.
A.With "WebMVC" enabled, it will register a couple of HandleMapping and HandleAdapter
当 "WebMVC" enabled 时,Spring 默认会注册一些 HandleMapping 和 HandleAdapter
By default:
1.RequestMappingHandleMapping
2.RequestMappingHandlerAdapter
@biaocy
biaocy / extract_download_url_from_rss.sh
Last active August 19, 2018 06:39
extract download url from zimuzu rss
#!/bin/bash
#zimuzu video id
vid="$1"
#season: S01 etc
season="$2"
#output file name
fname="${3-$vid}.$season.`date +%Y%m%d`.json"
@biaocy
biaocy / resources.md
Created January 18, 2019 05:08 — forked from lamont-granquist/resources.md
Three Ways to Write Correct Chef Resources

This has been moved into the official Chef docs:

https://docs.chef.io/custom_resources_notes.html

12.5 style custom resources

This is by far the most recommended way of writing resources for all users. There are two gotchas which we're working through:

  1. For helper functions that you used to write in your provider code or used to mixin to your provider code, you have to use an action_class do ... end block.
@biaocy
biaocy / queryToObj.js
Created December 9, 2019 09:35
Parse query string to object
function getQueryObj(url) {
let re = /[?&]+(\w+)(?:=([\w%\.]*))*/g;
let results, ret = {};
while ((results = re.exec(url)) !== null) {
let [m, k, v] = results; // array destructuring
ret[k] = v;
}
return ret;
}
@biaocy
biaocy / NERDTree.mkd
Created January 3, 2020 02:41 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@biaocy
biaocy / v2ray_swtich.sh
Created November 20, 2020 06:06
Switch v2ray configuration
#!/bin/bash
# fail fast
set -e
# Symbolic file
LINK_CONF="config.json"
if [ ! -h "$LINK_CONF" ]
then
echo "'$LINK_CONF' is not a symbolic file or not exist"
@biaocy
biaocy / restore_last_git_modified_time.sh
Last active November 25, 2020 17:43 — forked from HackingGate/restore_last_git_modified_time.sh
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462
#!/bin/sh -e
OS=${OS:-`uname`}
if [ "$OS" = 'Darwin' ]; then
get_touch_time() {
date -r ${unixtime} +'%Y%m%d%H%M.%S'
}
else
# default Linux

知识点

语言

基础
  • 面向对象特性:封装、继承、多态
  • 集合: List、Set、Map
  • 异常:
    • Checked Exception
    • Unchecked Exception: RuntimeException, Error, and their subclasses
@biaocy
biaocy / rime-dependencies.sh
Last active December 21, 2020 13:14
Rime build dependencies
sudo apt install libboost-dev libboost-system-dev libboost-filesystem-dev\
libboost-regex-dev libboost-locale-dev libgtest-dev libgoogle-glog-dev\
libibus-1.0-dev libnotify-dev libleveldb-dev libmarisa-dev libopencc-dev\
libyaml-cpp-dev cmake capnproto