Skip to content

Instantly share code, notes, and snippets.

View kaidiren's full-sized avatar
🍒
🍎🍓🍑🍅🍉

kaidiren kaidiren

🍒
🍎🍓🍑🍅🍉
View GitHub Profile
### Keybase proof
I hereby claim:
* I am kaidiren on github.
* I am kaidiren (https://keybase.io/kaidiren) on keybase.
* I have a public key ASArVcj39KMoU9722ofzcmPjM9tXXbkRXMSsUHypJvq8sAo
To claim this, I am signing this object:
@kaidiren
kaidiren / bilibili.ini
Created March 9, 2019 14:07
supervisor config example
[program:bilibili]
directory=/root/bilibili # 程序目录
command=/root/B/bili/bin/python3 -u run.py # 运行命令
stdout_logfile=/root/B/bili/bilibili-live-record-and-upload/run.log # 日志输出文件
redirect_stderr=true #重定向错误到标准输出
stopwaitsecs=600 #进程停止的等待时间
startretries=60 #重启尝试次数
autostart=true #是否自启动
autorestart=true #是否进程重启
stopasgroup=true #是否使用群组模式,包含有子进程的建议开启
@kaidiren
kaidiren / vite-send-VTT-by-pow.js
Last active February 19, 2019 04:12
vite send VTT by pow
// node version v10.15.0
// "@vite/vitejs": "^1.1.4",
// "sleep-promise": "^8.0.1"
// output example
// generate account from: vite_b91c215ee845e80744c7d3536c5246724d9bd8938b710e96e9
// generate account to: vite_2118b87c74c01abee0b95e160b4d0e615cc5a22a96e23d50c7
// get some VTT to vite_b91c215ee845e80744c7d3536c5246724d9bd8938b710e96e9
// https://explorer.vite.net/transaction/17fbe92009a549b332930c9a532076e90caa6bc2bcadab9ac95840bb4b66d8a3
// send some VTT to vite_2118b87c74c01abee0b95e160b4d0e615cc5a22a96e23d50c7
@kaidiren
kaidiren / README-Template.md
Created December 26, 2018 03:07 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@kaidiren
kaidiren / fault
Created August 27, 2018 07:13
fault
0xee6b81553fd32370865c74b05e0731b0404d523d
const urls = [1, 2, 3];
async function download(urls) {
return urls.map(async (url) => {
const content = await Promise.resolve(url);
console.log(content);
return content;
});
}
(async () => {
@kaidiren
kaidiren / wait-until-all-es6-promises-complete-even-rejected-promises
Created June 2, 2017 12:35
Wait until all ES6 promises complete, even rejected promises
// https://stackoverflow.com/questions/31424561/wait-until-all-es6-promises-complete-even-rejected-promises/36115549#36115549
var a = () => Promise.resolve(1);
var b = () => Promise.reject(new Error(2));
var c = () => Promise.resolve(3);
Promise.all([a(), b(), c()].map(p => p.catch(e => e)))
.then(results => console.log(results)) // 1,Error: 2,3
.catch(e => console.log(e));
@kaidiren
kaidiren / sequelize-transaction-sample.js
Created March 14, 2017 04:59
sequelize transaction sample
'use strict';
const ruo = require('ruo');
exports.complete = function *(id) {
const t = yield ruo.transaction({autocommit: false});
let bill;
try {
bill = yield ruo.models.Bill.findOne({
where: {
@kaidiren
kaidiren / .vimrc
Last active March 14, 2017 05:00
vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@kaidiren
kaidiren / Google_Authenticator_code_check.py
Last active December 31, 2015 00:29
Google Authenticator code check (just use for check the code) 谷歌身份验证器上产生的代码验证。不用于产生验证码,只进行验证码验证。
# -*- coding:utf-8 -*-
'''
python 2.7
quote from the next url
https://github.com/yurri/py3_google_authenticator/blob/master/google_authenticator.py (python3.X)
大部分的代码都来自与上边的一个url
由于不需要全部的功能而且是用2.7所以简单做了一下精简
只用了totp的模式所以别的模式也还啊没验证
敬请见谅
不过很容易根据自己的需要修改