Skip to content

Instantly share code, notes, and snippets.

@yuanliwei
yuanliwei / grovvy decode.md
Created May 6, 2019 04:37
grovvy decode.md

def author=new String(IOGroovyMethods.getBytes("git config --get user.name".execute().getInputStream()), 'utf-8').trim()

@yuanliwei
yuanliwei / adb shell monkey --port 1080.md
Created April 22, 2019 03:38
adb shell monkey --port 1080
/*
adb shell monkey --port 1080
adb forward tcp:1080 tcp:1080
telnet 127.0.0.1 1080

sleep 300
quit
done
type string
@yuanliwei
yuanliwei / 阿里云镜像仓库.gradle
Created April 3, 2019 03:51
阿里云镜像仓库
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
@yuanliwei
yuanliwei / 获取小说名列表.js
Created March 27, 2019 01:41
获取小说名列表.js
```javascript
var request = require('request')
var cheerio = require('cheerio')
async function get(page) {
return new Promise((resolve) => {
request.get(`https://www.80txt.com/sort3/${page}.html`, {
encoding: 'utf-8',
gzip: true
}, (err, resp, body) => {
@yuanliwei
yuanliwei / javascript.json.md
Created February 15, 2019 10:17
AppData/Roaming/Code/User/snippets/javascript.json
{
	// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// "body": [
@yuanliwei
yuanliwei / vscode tasks run js.md
Created February 15, 2019 07:31
vscode tasks run js.md
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "run js file",
            "type": "shell",
 "command": "node ${file}",
@yuanliwei
yuanliwei / 统计Git代码行数,js
Created January 23, 2019 17:35
统计Git代码行数,js
let fs = require('fs')
let path = require('path')
// git log --stat > stat.txt
let content = fs.readFileSync(path.join(__dirname,'stat.txt'), 'utf-8')
let lines = content.split('\n')
let commits = []
let item = {}
lines.forEach((l)=>{
if(l.startsWith('commit ')){
@yuanliwei
yuanliwei / androidx.recyclerview.widget.DiffUtil.md
Created January 16, 2019 15:38
androidx.recyclerview.widget.DiffUtil
            DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new DiffUtil.Callback() {
                @Override
                public int getOldListSize() {
                    return mCommentList.size();
                }

                @Override
                public int getNewListSize() {
                    return comments.size();
@yuanliwei
yuanliwei / 小说爬虫.js
Created December 5, 2018 14:09
小说爬虫.js
var request = require('request')
var cheerio = require('cheerio')
var iconv = require('iconv-lite');
async function get(url) {
return new Promise((resolve) => {
request.get(url, {
encoding: null,
gzip: true
}, (err, resp, body) => {
@yuanliwei
yuanliwei / 小说列表爬虫.js
Created December 3, 2018 10:47
小说列表爬虫.js
var request = require('request')
var cheerio = require('cheerio')
async function get(page) {
return new Promise((resolve) => {
request.get(`https://www.80txt.com/sort3/${page}.html`, {
encoding: 'utf-8',
gzip: true
}, (err, resp, body) => {
let $ = cheerio.load(body)