Skip to content

Instantly share code, notes, and snippets.

View wizardforcel's full-sized avatar
🐲

布客飞龙 wizardforcel

🐲
View GitHub Profile
@wizardforcel
wizardforcel / psyco.md
Last active April 13, 2022 09:57
编程随想::心理学书籍 IPFS 备份

https://ipfs.io/ipfs/{hash}

user@ubuntu:~/Downloads/心理学$ ipfs add -r .
added QmerE4f5kabqmMunMwGu5UsUS347bcr7wDEhF1wHANh3ck 心理学/(其它)/丹·艾瑞里:怪诞行为学 (扫描版).pdf
added QmRbvAnZ6qAhDozFjc9wxmMhK1Gv4QecUXhtbd5K3Dxw1r 心理学/(其它)/丹·艾瑞里:怪诞行为学.epub
added Qmeq2MfRYrRDrXiwfFtjcz1kGC2gVPY7sqoxQLonJuTCcS 心理学/(其它)/丹·艾瑞里:怪诞行为学2.epub
added QmfQc7G8pLbBtzkNk5gNhCrkaYVd2tGioNrZJTXFxviwQP 心理学/(其它)/基思·斯坦诺维奇:与众不同的心理学——如何正视心理学 (第7版 扫描版).pdf
added QmVoSP6JmrGTP3KWE9onL6ygqhenHFjbeyFTzDVe1GumfP 心理学/(其它)/基思·斯坦诺维奇:对伪心理学说不 (第8版 扫描版).pdf
added QmP6pcyNv4eFdfitk6H8krde6RBAFyteCHfHZYhsDpAWjK 心理学/(其它)/基思·斯坦诺维奇:对伪心理学说不 (第8版).epub
@wizardforcel
wizardforcel / HeapUtil.cs
Last active September 26, 2017 06:36
HeapUtil.cs
//HeapUtil.heapSort(arr)
class HeapUtil
{
public static void swap<T>(IList<T> list, int i, int j)
{
T tmp = list[i];
list[i] = list[j];
list[j] = tmp;
}
@wizardforcel
wizardforcel / yiibai.js
Created November 22, 2016 01:57
Yiibai
// $ = cheerio.load(html);
var cheerio = require('cheerio');
// request(method, url, options).getBody().toString()
var request = require('sync-request');
var fs = require('fs');
var process = require('process');
var headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
@wizardforcel
wizardforcel / content.ejs
Last active July 5, 2017 13:36
make epub
<?xml version="1.0" encoding="utf-8" ?>
<package unique-identifier="BookId" version="2.0" xmlns="http://www.idpf.org/2007/opf">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:identifier id="BookId" opf:scheme="UUID">urn:uuid:<%- uuid %></dc:identifier>
<meta content="1.0.0" name="jianhelper"/>
<dc:language>zh-CN</dc:language>
<dc:date opf:event="modification" xmlns:opf="http://www.idpf.org/2007/opf"><%- date %></dc:date>
</metadata>
<manifest>
<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml"/>
@wizardforcel
wizardforcel / runoob.js
Last active July 5, 2017 13:37
runoob crawler for html
var cheerio = require('cheerio');
var request = require('sync-request');
var fs = require('fs');
var process = require('process');
var url = process.argv[2];
if(!url)
{
console.log('请指定页面。');
process.exit(0);
tokenRE = /^[A-Za-z_]\w{0,31}/;
numeralRE = /^\d+/;
function matchAndReturn(str, re) {
var r = str.match(re);
return r? r[0]: null;
}
isToken = s => matchAndReturn(s, tokenRE);
isNumeral = s => matchAndReturn(s, numeralRE);
@wizardforcel
wizardforcel / splitmd.js
Last active February 5, 2019 14:40
split a md file & convert html to md
var fs = require('fs');
try {fs.mkdirSync('out');}
catch(ex){}
var co = fs.readFileSync('a.md', 'utf-8');
var files = co.split(/<split>123<\/split>/g);
var summary = '';
@wizardforcel
wizardforcel / img.js
Last active July 5, 2017 13:40
download img in html files
var fs = require('fs');
var request = require('sync-request');
var crypto = require('crypto');
var cheerio = require('cheerio');
var dirname = process.argv[2];
if(!dirname)
{
console.log('请指定目录。');
process.exit(0);
@wizardforcel
wizardforcel / split.js
Last active July 5, 2017 13:41
split a html file
var fs = require('fs');
try {fs.mkdirSync('out');}
catch(ex){}
var co = fs.readFileSync('out.html', 'utf-8');
var files = co.split(/<!\-\-split\-\->/g);
//var summary = '';
@wizardforcel
wizardforcel / genList.js
Created April 30, 2016 02:24
Generate archive for my ebook blog
var fs = require('fs');
var path = 'D:\\it-ebooks\\source\\_posts';
var files = fs.readdirSync(path);
var result = '# 计算机开放电子书汇总\n\n' +
'+ [站点](http://it-ebooks.flygon.net/)\n' +
'+ [站点源码](https://github.com/it-ebooks/blog)\n\n';