​​​​ npm命令行工具收集 | 苏生不惑的博客

npm命令行工具收集

安装node

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
yum install -y node npm
安装node版本管理工具'n';

$ sudo npm install n -g
$ sudo n stable (安装node最新版本)

$ sudo n 8.9.4 (安装node指定版本8.9.4
$ vim /etc/profile
将node安装的路径(这里为:/usr/local/n/versions/node/8.9.4)添加到文件末尾;

#set node path

export NODE_HOME=/usr/local/n/versions/node/8.9.4

export PATH=$NODE_HOME/bin:$PATH
wq退出保存文件,编译/etc/profile;

$ source /etc/profile

npm install -g cnpm --registry=https://registry.npm.taobao.org

显示npm命令行包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
命令行工具安装目录which pinyin: /c/Users/xxx/AppData/Roaming/npm/pinyin
npm ls -g --depth=0 #对应的有web版 https://q-nick.github.io/npm-gui/ https://720kb.github.io/ndm/
npm ls -g # 查看全局安装的模块

#node 包网站地址 https://www.npmjs.com/package/fanyi
$ npm ls -g --depth=0
d:\nodejs
+-- @vue/cli@3.0.0-alpha.5
+-- admin-mongo@0.0.23
+-- adr@1.0.7
+-- airing-translator@1.0.4
+-- anyproxy@4.0.6
+-- anywhere@1.4.0
+-- apidoc@0.17.6
+-- asciify@1.3.5
+-- babel@5.6.23
+-- error: ENOENT: no such file or directory, open 'd:\nodejs\node_modules\babel-cli\package.json
+-- baidu-ocr-api@2.0.5
+-- bash-handbook@2.9.7
+-- bower@1.2.8
+-- browser-sync@2.18.8
+-- brunch@1.7.14
+-- btc@0.0.4
+-- bugfreejs@1.2.0
+-- caniuse-cmd@1.3.1
+-- cash@0.8.0
+-- cellocate@0.1.4
+-- clean-scripts@1.2.1
+-- cli-scraper@1.0.2
+-- cloc@2.2.0
+-- cnpm@4.2.0
+-- codedog@0.0.4
+-- coffee-script@1.7.1
+-- component@1.1.0
+-- cortex@5.4.6
+-- cqc@0.1.3
+-- crawl-pet@0.0.3
+-- diffchecker@0.1.4
+-- docsify-cli@4.2.1
+-- domain-cli@0.1.10
+-- doubanfm@0.1.4
+-- doxmate@0.2.5
+-- electron-pdf@1.2.0
+-- everblog@1.1.0
+-- express@3.4.8
+-- fanyi@2.0.1
+-- fe-interview@4.10.2
+-- figlet@1.2.0
+-- fis@1.7.14
+-- fjpublish@2.0.0
+-- forever@0.15.3
+-- fund@1.0.0
+-- fx@3.1.0
+-- generator-generator@0.4.2 -> e:\node\generator-kissy-gallery
+-- gifify@2.4.0
+-- girlcrawler@1.1.0
+-- git-recall@1.2.4
+-- gitbook@3.2.2
+-- gitbook-cli@2.3.0
+-- google-cli@0.1.0
+-- grank@1.0.18
+-- grunt-cli@0.1.13
+-- gtop@0.1.6
+-- gulp@3.8.10
+-- helloshell@0.0.1
+-- hexo@2.8.2
+-- hexo-cli@1.1.0
+-- html-pdf@2.1.0
+-- http-proxy-to-socks@1.0.1
+-- http-server@0.9.0
+-- idoc@0.1.2
+-- irest-cli@1.0.5
+-- jscpd@0.6.17
+-- jsdoc@3.3.0-alpha10
+-- json-server@0.9.6
+-- jsonplaceholder@0.2.4
+-- juejin@1.0.14
+-- error: ENOENT: no such file or directory, open 'd:\nodejs\node_modules\karma\package.json
+-- koy@0.0.7
+-- laravel-echo-server@1.3.8
+-- learnyounode@0.4.1
+-- leetcode-cli@0.9.0
+-- lighthouse@2.3.0
+-- lint-md@0.0.4
+-- livepool@0.7.9
+-- livereloadx@0.3.6
+-- liyu@0.1.2
+-- localtunnel@1.9.0
+-- lyric-dl@0.1.4
+-- m-console@0.1.0
+-- mailit@0.0.3
+-- manet@0.4.19
+-- mapscii@0.1.7
+-- markdown-it@8.3.1
+-- markdown-pdf@7.0.0
+-- measure-export-cli@0.5.2
+-- mpspider@1.0.1
+-- nativefier@7.5.4
+-- node-cube@0.1.0
+-- node-inspector@0.7.3
+-- node-reveal@1.2.2
+-- nodemon@1.0.17
+-- nodeppt@0.8.9-1
+-- npm@3.10.10
+-- oji@1.0.7
+-- page2image@1.7.1
+-- parcel-bundler@1.3.0
+-- pdf-bot@0.3.3
+-- pinyin@2.3.3
+-- pm2@3.0.0
+-- ppt-cli@1.2.9
+-- puer@1.1.4
+-- purify-css@1.2.5
+-- qrcode-terminal@0.12.0
+-- rdoc@1.3.4
+-- requirejs@2.1.15
+-- rocket-cli@0.0.5
+-- runtime-cli@3.2.0
+-- serve@6.3.1
+-- server-mock@1.0.5
+-- sharemd-cli@0.0.2
+-- simpler-paper@0.1.5
+-- socket-pipe@2.4.0
+-- speed-test@2.0.0
+-- spm@2.2.5
+-- sqlpad@2.3.2
+-- stacks-cli@0.1.44
+-- suoxie@0.6.0
+-- t-get@1.1.0
+-- terminal-translate@1.0.4
+-- tianshu@0.9.1
+-- tldr@1.6.0
+-- todo-live@0.1.3
+-- translator-cli@0.3.0
+-- truffle@4.1.13
+-- u.nu@0.0.2
+-- uncss@0.8.1
+-- v2ex-cli@0.2.6
+-- error: ENOENT: no such file or directory, open 'd:\nodejs\node_modules\vian\package.json
+-- vue-cli@2.5.1
+-- webpack@1.14.0
+-- webtorrent-cli@1.10.1
+-- weinre@2.0.0-pre-HZO3BMNG
+-- whay@1.1.0
+-- whistle@1.12.0
+-- world-cup-cli-dashboard@1.6.0
+-- wtfjs@1.3.0
+-- wtfpython@1.2.4
+-- xmocker-cli@1.0.2
+-- xmysql@0.1.8
+-- xxb@0.0.2
+-- yddict@1.0.2
+-- yo@1.1.2
+-- your-name@1.0.1
+-- yrm@1.0.6
+-- commitizen@2.10.1
`-- zan-proxy@4.0.17

文件比较

1
2
3
npm install -g diffchecker
diffchecker file1.js file2.js
diffchecker --expire day file1.js file2.js

录制 CLI

1
2
3
npm install -g svg-term-cli
svg-term --cast=113643 --out examples/parrot.svg --window
#https://github.com/marionebl/svg-term-cli

gitbook-cli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//https://www.omybug.com/2016/07/06/GitBook%E4%BD%BF%E7%94%A8/
cnpm install -g gitbook-cli
gitbook -V
新建目录mybook,在目录中输入新建文件夹SUMMARY.md,先建立一个目录,输入一下内容

* [简介](README.md)
* [第一章](chapter1/README.md)
- [第一节](chapter1/section1.md)
- [第二节](chapter1/section2.md)
* [第二章](chapter2/README.md)
- [第一节](chapter2/section1.md)
- [第二节](chapter2/section2.md)
* [结束](end/README.md)
执行命令自动生成各章节文件

gitbook init
导出成html

gitbook build
本地测试

gitbook serve
启动就可以通过以下地址访问效果了

http://localhost:4000/
当你编辑过文件之后,不需要重新启动serve,在线刷新一下就可以看到效果
gitbook help //列出gitbook所有的命令
gitbook –help //输出gitbook-cli的帮助信息
gitbook build –gitbook=2.0.1 //生成时指定gitbook的版本, 本地没有会先下载
gitbook ls //列出本地所有的gitbook版本
gitbook ls-remote //列出远程可用的gitbook版本
gitbook fetch 标签/版本号 //安装对应的gitbook版本
gitbook update //更新到gitbook的最新版本
gitbook uninstall 2.0.1 //卸载对应的gitbook版本
gitbook build –log=debug //指定log的级别
gitbook builid –debug //输出错误信息

touch README.md SUMMARY.md
git init
git add README.md SUMMARY.md
git commit -m “first commit”
git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
git push -u gitbook master
git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
git push -u gitbook master

查询天气

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$curl wttr.in\?lang=zh
天氣預報: Beijing, China

\ / 晴天
.-. -1 °C
― ( ) ― ↙ 0 km/h
`-’ 7 km
/ \ 0.0 mm
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ 一 14 1月 ├───────────────────────┬──────────────────────────────┐
│ 早上 │ 中午 └──────┬──────┘ 晚間 │ 晚 │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / 晴天 │ \ / 局部多云 │ \ / 局部多云 │ \ / 晴朗 │
│ .-. 1 °C │ _ /"".-. 5 °C │ _ /"".-. 2-4 °C │ .-. -4-1 °C │
│ ― ( ) ― ← 2-3 km/h │ \_( ). ↖ 3-4 km/h │ \_( ). → 10-16 km/h │ ― ( ) ― ↘ 25-39 km/h │
│ `-’ 20 km │ /(___(__) 20 km │ /(___(__) 20 km │ `-’ 20 km │
│ / \ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ / \ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
$ curl wttr.in/Beijing
$ curl wttr.in/北京
$ curl wttr.in/pek # 北京首都国际机场
Weather report: pek

\ / Sunny
.-. -1 °C
― ( ) ― ↙ 0 km/h
`-’ 7 km
/ \ 0.0 mm
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 14 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / Sunny │ \ / Partly cloudy │ \ / Partly cloudy │ \ / Clear │
│ .-. 0 °C │ _ /"".-. 3-4 °C │ _ /"".-. 0-2 °C │ .-. -5-1 °C │
│ ― ( ) ― ← 3-4 km/h │ \_( ). ↑ 4 km/h │ \_( ). ↗ 8-16 km/h │ ― ( ) ― ↘ 19-35 km/h │
`-’ 20 km │ /(___(__) 20 km │ /(___(__) 20 km │ `-’ 20 km │
│ / \ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ / \ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Tue 15 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / Sunny │ \ / Sunny │ \ / Clear │ \ / Clear │
│ .-. -12--6 °C │ .-. -10--4 °C │ .-. -4--1 °C │ .-. -3--1 °C │
│ ― ( ) ― ↘ 17-23 km/h │ ― ( ) ― ↘ 19-22 km/h │ ― ( ) ― ↘ 8-10 km/h │ ― ( ) ― → 6-7 km/h │
`-’ 20 km │ `-’ 20 km │ `-’ 20 km │ `-’ 20 km │
│ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Wed 16 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / Sunny │ \ / Sunny │ \ / Partly cloudy │ \ / Partly cloudy │
│ .-. -5--3 °C │ .-. -1-1 °C │ _ /"".-. -2--1 °C │ _ /"".-. -3--2 °C │
│ ― ( ) ― ↘ 4-5 km/h │ ― ( ) ― ↗ 5-6 km/h │ \_( ). ↑ 4-6 km/h │ \_( ). ↘ 2-4 km/h │
`-’ 20 km │ `-’ 20 km │ /(___(__) 20 km │ /(___(__) 20 km │
│ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: 北京首都国际机场, 航管南路, 朝阳区 / Chaoyang, 北京市, 101312, 中国 [40.07928545,116.594560692]

Follow @igor_chubin for wttr.in updates
$ curl wttr.in/sha # 上海虹桥国际机场
$ curl "wttr.in/Beijing?u"
$ curl "wttr.in/Beijing?m"

生成各种不同环境下某个网页的截图

1
2
3
4
5
6
7
npm i -g screenshoteer
screenshoteer --url https://www.example.com

or .html localy copy the url path from the browser

screenshoteer --url file:///Users/../index.html
screenshoteer --url file:///C:/Users/../Random-HTML-file.html

豆瓣电台命令行版

1
2
npm i doubanfm -g
doubanfm

不再为文档而发愁

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ npm install doxmate -g
// 签出doxmate项目
$ git clone git://github.com/JacksonTian/doxmate.git ~/git/doxmate
// 去到项目目录
$ cd doxmate
$ doxmate build
// 在docs目录下将会得到文档
$ open ~/git/doxmate/doc/index.html
// 或者 -o folder,可以将文档生成到指定的目录下
$ doxmate build -o ~/output
// 带上-s参数后,可以选择doxmate提供的几种模板
$ doxmate build -s wordpress
//卸载
npm uninstall girlcrawler -g

pdf转换

1
2
3
4
5
6
7
8
9
10
11
npm install electron-pdf -g
To generate a PDF from a HTML file

$ electron-pdf index.html ~/Desktop/index.pdf

To generate a PDF from a Markdown file

$ electron-pdf index.md ~/Desktop/index.pdf
$ electron-pdf https://fraserxu.me ~/Desktop/fraserxu.pdf
$ npm install -g html-pdf
$ html-pdf test/businesscard.html businesscard.pdf

mp4转gif

1
2
3
4
npm install -g gifify
gifify back.mp4 -o back.gif --from 01:48:23.200 --to 01:48:25.300 --text "What?..What?What?"
gifify 22.mkv -o movie.gif --subtitles 22.ass --from 1995 --to 2002 --resize 600:-1
gifify screencast.mkv -o screencast.gif --resize 800:-1

系统面板

1
2
$ npm install gtop -g
$ gtop

gitbook

1
2
3
4
$ npm install gitbook-cli -g
$ gitbook init
$ gitbook serve
$ gitbook build

个人脚本管理工具

1
2
3
4
5
$ npm install helloshell -g
$ git clone https://github.com/wl879/HelloShell.git
$ chmod 777 ./HelloShell/main.py
$ ln -s "$(pwd)/HelloShell/main.py" /usr/local/bin/helloshell
$ helloshell new name [-l [name]]

静态博客

1
2
3
4
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ hexo server

rest api json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ npm install -g json-server
Create a db.json file

{
"posts": [
{ "id": 1, "title": "json-server", "author": "typicode" }
],
"comments": [
{ "id": 1, "body": "some comment", "postId": 1 }
],
"profile": { "name": "typicode" }
}

Start JSON Server

$ json-server --watch db.json

Now if you go to http://localhost:3000/posts/1, you'll get

{ "id": 1, "title": "json-server", "author": "typicode" }

md预览

1
2
3
4
5
6
7
8
9
10
11
$ npm i koy -g
$ koy

# Or a specific file
$ koy some-file.md

# Or a README.md in Github repo
$ koy gh:djyde/koy

# Or a README.md in NPM
$ koy npm:koy

Web 开发调试工具

1
2
npm install livepool -g
livepool

下载在线音乐歌词

1
2
3
4
npm install lyric-dl -g
npm update lyric-dl -g
lyric-dl download <url> --out-format json
lyric-dl search <name>

控制台登录pc浏览器

1
2
npm install -g m-console
mcon server

屏幕截图

1
2
3
4
5
npm install -g slimerjs
npm install -g phantomjs
npm install -g phantomjs2
npm install -g manet
manet

公众号文章抓取

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
npm i mpspider -g
# 第一种方式
mpspider url https://mp.weixin.qq.com/s/CIPosICgva9haqstMDIHag -d dest_path
# 第二种方式,需要手动配置代理,点击公众号「查看历史文章」,详见下面介绍
mpspider proxy -d dest_path -p proxy_port

# 进入抓取后gitbook的地址
cd dest_path
# 创建readme.md,gitbook不创建会报错
touch README.md
# 有必要可以创建book.json,参考gitbook文档
gitbook serve
# 访问地址查看效果
#npm i gitbook-cli -g
# 生成电子书
gitbook mobi ./ name.mobi

anyproxy --rule lib/anyproxyRule.js

网页打包

1
2
3
4
5
npm install nativefier -g
nativefier.cmd "http://github.com"
Downloading tmp-19012-1-SHASUMS256.txt-3.0.3
[============================================>] 100.0% of 4.74 kB (4.74 kB/s)
Packaging app for platform win32 x64 using electron v3.0.3

nodeppt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
npm install -g nodeppt
# 获取帮助
nodeppt start -h
# 绑定端口
nodeppt start -p <port>

nodeppt start -p 8090 -d path/for/ppts
# 绑定host,默认绑定0.0.0.0
nodeppt start -p 8080 -d path/for/ppts -H 127.0.0.1
# 使用socket通信(按Q键显示/关闭二维码,手机扫描,即可控制)
# socket须知:1、注意手机和pc要可以相互访问,2、防火墙,3、ip
# 获取generate帮助
nodeppt generate -h
# 使用generate命令
nodeppt generate filepath
# 导出全部,包括nodeppt的js、img和css文件夹
# 默认导出在publish文件夹
nodeppt generate ./ppts/demo.md -a
# 指定导出文件夹
nodeppt generate ./ppts/demo.md output/path -a

# create a new slide with an official template
$ nodeppt new slide.md

# create a new slide straight from a github template
$ nodeppt new slide.md -t username/repo

# start local sever show slide
$ nodeppt serve slide.md

INFO Starting development server...
98% after emitting DONE Compiled successfully in 4588ms19:44:58 s


NodePPT running at:
- Url: http://10.235.51.39:8080/
- Speaker Mode: http://10.235.51.39:8080/?mode=speaker

# to build a slide
$ nodeppt build slide.md

网页转图片

1
2
3
4
5
6
7
8
9
10
npm i page2image --global
# Single page
> page2image https://github.com/Runjuu --type=jpeg --quality=80

# Multi-page
> page2image https://github.com/Runjuu https://github.com/Runjuu --type=jpeg --quality=80

# Local file
> page2image ./index.html --type=jpeg --quality=80
page2image https://github.com/Runjuu --selector=".js-contribution-graph"

汉字拼音转换

1
2
3
4
npm install pinyin -g
$ pinyin 中心
zhōng xīn
$ pinyin -h

md ppt

1
2
3
4
5
6
ppt file.md 

ppt a.md --theme=black --transition=zoom

ppt https://raw.githubusercontent.com/jirengu/server-mock/master/README.md
Listening on port 8080. open http://localhost:8080/README.html

实时编辑刷新的前端服务器

1
2
3
npm -g install puer
cd /path/to/workspace ↵
puer

二维码

1
2
3
4
$ npm install -g qrcode-terminal
$ qrcode-terminal --help
$ qrcode-terminal 'http://github.com'
$ echo 'http://github.com' | qrcode-terminal

静态站点生成器

1
2
3
4
5
npm install rdoc -g
rdoc init my-project

cd my-project && npm install # Install dependencies.
npm start # Into the directory, start the service.

网络测速

1
2
3
4
5
6
npm install --global speed-test
speed-test.cmd

Ping 13 ms
Download 48 Mbps
Upload 24 Mbps

运行SQL查询并可视化结果

1
2
3
4
5
6
7
 npm install -g sqlpad#http://rickbergfalk.github.io/sqlpad/
sqlpad --dir ./sqlpaddata --ip 127.0.0.1 --port 3000 --passphrase secr3t
optional driver ../drivers/unixodbc not available

Welcome to SQLPad!. Visit http://127.0.0.1:3000 to get started

docker-compose up -d

检查网站堆栈

1
2
$ npm install stacks-cli -g
$ stacks-cli

种子

1
2
npm install -g t-get
tget 'magnet:?xt=urn:btih:0403fb4728bd788fbcb67e87d6feb241ef38c75a'

命令行提示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
npm install -g tldr#类似cheat
λ tldr curl
√ Page not found. Updating cache
√ Creating index

curl

Transfers data from or to a server.
Supports most protocols, including HTTP, FTP, and POP3.

- Download the contents of an URL to a file:
curl http://example.com -o filename

- Download a file, saving the output under the filename indicated by the URL:
curl -O http://example.com/filename

- Download a file, following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer:
curl -O -L -C - http://example.com/filename

以太坊的开发环境

1
2
$ npm install -g truffle
$ truffle init

流媒体客户端

1
2
npm install webtorrent-cli -g
$ webtorrent magnet_uri

wtfjs

1
$ npm install -g wtfjs

wtfpython

1
2
$ npm install -g wtfpython
$ pip install wtfpython -U

前端模拟用工具

1
2
3
npm i -g xmocker-cli
λ mocker start
后台管理界面运行于: http://localhost:6001 耗时: 607 ms

MySql数据库生成REST API

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
npm install -g xmysql
xmysql.cmd -h localhost -u root -p root -d laravel



Generating REST APIs at the speed of your thought..

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Database : laravel
Number of Tables : 19

REST APIs Generated : 370

Xmysql took : 0.9 seconds
API's base URL : localhost:3000

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GET / 200 29908 - 8.113 ms
GET /api/admin_menu/describe 200 708 - 49.192 ms

检查基金收入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
npm install xxb -g
λ xxb
info xxb is running. Press Ctrl+C to stop
WARN Can't find ~/.xxb file, using default configuration
┌──────────────┬─────────────────────────────┬────────────┬───────────────┬──────────┐
│ 产品名称 │ 合作基金 │ 发售平台 │ 7日年化收益率 │ 万份收益 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 零钱宝 │ 汇添富现金宝货币(000330) │ 苏宁 │ 3.3710% │ 0.8838元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 现金宝 │ 汇添富现金宝货币(000330) │ 网易理财 │ 3.3710% │ 0.8838元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 财富宝 │ 华夏财富宝货币A(000343) │ 微信理财通 │ 3.2740% │ 0.8739元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 全额宝 │ 汇添富全额宝货币(000397) │ 微信理财通 │ 3.0730% │ 0.8303元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 百赚利滚利版 │ 嘉实活期宝货币(000464) │ 百度理财 │ 3.1290% │ 0.8280元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 百赚 │ 华夏现金增利货币A/E(003003) │ 百度理财 │ 3.0950% │ 0.8093元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 零钱宝 │ 广发天天红货币A(000389) │ 苏宁 │ 2.8420% │ 0.7621元 │
├──────────────┼─────────────────────────────┼────────────┼───────────────┼──────────┤
│ 余额宝 │ 天弘余额宝货币(000198) │ 支付宝 │ 2.5260% │ 0.6881元 │
└──────────────┴─────────────────────────────┴────────────┴───────────────┴──────────┘

静态文件服务器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
npm install anywhere -g
$ anywhere
// or with port
$ anywhere -p 8000
// or start it but silent(don't open browser)
$ anywhere -s
// or with hostname
$ anywhere -h localhost -p 8888
// or with folder
$ anywhere -d ~/git/anywhere
// or enable html5 history
$ anywhere -f /index.html
npm install -g serve
serve

┌──────────────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:5000 │
│ - On Your Network: http://10.235.51.43:5000 │
│ │
│ Copied local address to clipboard!

图片识别

1
2
3
4
5
6
7
8
9
npm install baidu-ocr-api -g

ocr --help

# 远程图片
ocr http://7pun4e.com1.z0.glb.clouddn.com/test.jpg

# 本地图片
ocr ./test.jpg

翻译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ npm install fanyi -g
$ fanyi "make love"

-
make love ~ fanyi.youdao.com

- v. 做爱;示爱(献殷勤)

1. make love
做爱,制造浪漫,作爱
2. Make Someone Love You
迫使别人喜欢自己
3. Make up love
配制爱情

镜像管理

1
2
3
4
5
6
7
8
9
10
11
12
13
$ npm install -g nrm
$ nrm ls

npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
$ nrm use cnpm //switch registry to cnpm

Registry has been set to: http://r.cnpmjs.org/

将纯文本转换为ascii

1
2
3
4
5
6
7
8
9
10
npm install -g asciify

asciify "Boom" -f larry3d
____
/\ _`\
\ \ \L\ \ ___ ___ ___ ___
\ \ _ <' / __`\ / __`\ /' __` __`\
\ \ \L\ \/\ \L\ \/\ \L\ \/\ \/\ \/\ \
\ \____/\ \____/\ \____/\ \_\ \_\ \_\
\/___/ \/___/ \/___/ \/_/\/_/\/_/

进程管理

1
2
3
$ npm install pm2 -g
$ pm2 start app.js
$ pm2 list

版本管理器 n

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ npm install -g n
$ n stable (安装最新的稳定版)
$ n latest (安装最新版本)
$ n lts (安装长期支持版本,一般会 LTS 版)
$ n (显示已安装版本并选择)
#切换8.9.4版
$ n bin 8.9.4
/usr/local/n/versions/node/8.9.4/bin/node (获得路径)
vi /etc/profile

按 i 进入 Insert 模式,在末尾添加

# nodejs PATH
export NODE_HOME=/usr/local/n/versions/node/8.9.4
export PATH=$NODE_HOME/bin:$PATH

按 ESC 退出 Insert 模式,输入 :wq 回车保存并退出

$ source /etc/profile

find替代方案

1
2
3
4
https://linux.cn/article-10171-1.html https://github.com/chinanf-boy/fd-zh
$ fd cli # 所有包含 "cli" 的文件名
$ fd -e md # 所有以 .md 作为扩展名的文件
$ fd cli -x wc -w # 搜索 "cli" 并且在每个搜索结果上运行 `wc -w`

jq

1
2
3
4
5
https://github.com/stedolan/jq
$ npm i $(echo $(\
npm outdated --json | \
jq -r 'to_entries | .[] | "\(.key)@\(.value.latest)"' \
))

json

1
2
3
4
5
6
7
8
9
//https://github.com/antonmedv/fx
$ npm install -g fx
$ fx data.json
$ curl ... | fx 'json => json.message'
$ curl ... | fx '_.groupBy("commit.committer.name")' '_.mapValues(_.size)'
$ echo '{"count": 0}' | fx '{...this, count: 1}'
{
"count": 1
}

查看 Git 文件变动历史

1
2
3
4
5
6
7
8
9
10
11
12
13
https://github.com/pomber/git-history
文件地址 https://github.com/babel/babel/blob/master/packages/babel-core/test/browserify.js
将域名github.com 改为github.githistory.xyz
https://github.githistory.xyz/babel/babel/blob/master/packages/babel-core/test/browserify.js
$ npm install -g git-file-history
$ git-file-history path/to/file.ext
Running at http://localhost:3000

npx git-file-history path/to/file.ext
npx: installed 1 in 2.406s
Path must be a string. Received undefined
C:\Users\xxx\AppData\Roaming\npm\node_modules\git-file-history\cli.js
Running at http://localhost:3000

中文加空格

1
2
3
4
5
6
 npm install -g pangu
C:\Users\xxx\AppData\Roaming\npm\pangu -> C:\Users\xxx\AppData\Roaming\npm\node_modules\pangu\dist\node\cli.js
+ pangu@4.0.7
added 1 package in 3.207s
pangu "不能信任那些Terminal或Editor用白底的人"
不能信任那些 Terminal 或 Editor 用白底的人

网页截图

1
2
3
4
5
6
7
8
9
10
11
12
λ npm install --global capture-website-cli
C:\Users\xxx\AppData\Roaming\npm\capture-website -> C:\Users\xxx\AppData\Roaming\npm\node_modules\capture-website-cli\cli.js

> puppeteer@1.12.2 install C:\Users\xxx\AppData\Roaming\npm\node_modules\capture-website-cli\node_modules\puppeteer
> node install.js

Downloading Chromium r624492 - 140.5 Mb [====================] 100% 0.0s
Chromium downloaded to C:\Users\xxx\AppData\Roaming\npm\node_modules\capture-website-cli\node_modules\puppeteer\.local-chromium\win64-624492
+ capture-website-cli@0.1.1
added 98 packages in 37.927s
capture-website https://baidu.com baidu.png
capture-website test.html test.png

stackoverflow from the terminal

1
2
3
4
5
6
npm install -g how-2 #https://github.com/santinic/how2
how2 unzip

For example, you could alias the proxy seetings in your ~/.bash_profile:

alias how2="HTTPS_PROXY='your_proxy:8888' how2"

ppt转图片

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//http://blog.51yip.com/jsjquery/1924.html
apt install nodejs npm unoconv libreoffice-dev imagemagick
# nodejs init //产生package.json
# npm install ppt2png
root@bacon-PC:~# cat test.js
var ppt2png = require('ppt2png');
var ppt = process.argv[2];
var topath = process.argv[3];
ppt2png(ppt, topath, function( err ){
if(err) {
console.log(err);
} else {
console.log('convert successful.');
}
});
# nodejs test.js test.pptx ./test/hao
convert successful.

# ls ./test |grep hao
hao-0.png
hao-10.png
hao-11.png
hao-12.png
hao-13.png
hao-14.png
hao-15.png
hao-16.png
hao-17.png
hao-1.png
hao-2.png
hao-3.png
hao-4.png
hao-5.png
hao-6.png
hao-7.png
hao-8.png
hao-9.png

FFmpeg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ffmpeg -i imput.mkv -c:v libx264 output.mp4
查看视频文件的流信息,包括视频、音频、字幕。
ffmpeg -i input.mkv
mkv 文件剪辑,截取片段,指定音轨。https://www.playpi.org/2019032701.html
-- -ss 表示开始时间,-to 表示结束时间,
ffmpeg -ss 01:22:08 -to 01:32:16 -accurate_seek -i in.mkv -map 0:v -map 0:a:1 -codec copy -avoid_negative_ts 1 out.mkv
-- 视频使用 h264 编码,音频使用 aac 编码
ffmpeg -i input.rmvb -c:v h264 -c:a aac out.mp4
给视频添加水印https://www.njphper.com/posts/2ffce39e.html
// ffmpeg -i birds.mp4 -i watermark.png
-filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" birds2.mp4

ffmpeg -i birds.mp4 -i watermark2.png
-filter_complex "pad=height=ih+40:color=#71cbf4,overlay=(main_w-overlay_w)/2:main_h-overlay_h"
birds3.mp4
ffmpeg -i yii.mp4 -i logo.jpg -strict -2 -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" birds2.mp4

AnyProxy简介移动端抓包工具

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
npm install -g anyproxy
~ anyproxy
[AnyProxy Log][2018-12-26 11:42:19]: Http proxy started on port 8001
[AnyProxy Log][2018-12-26 11:42:19]: web interface started on port 8002


// 稳定版本生成方法
~ sudo anyproxy --root
// 最新版本生成方法
~ anyproxy-ca
支持 Https 方式重新启动 AnyProxy


~ anyproxy --intercept
// 简写
~ anyproxy -i
https://duanruilong.github.io/blog/2018/12/26/AnyProxy%E7%AE%80%E4%BB%8B%E7%A7%BB%E5%8A%A8%E7%AB%AF%E6%8A%93%E5%8C%85%E5%B7%A5%E5%85%B7/

docsify

1
2
3
4
5
6
7
8
9
10
11
12
npm i docsify-cli -g
docsify init ./docs
初始化成功后,可以看到 ./docs 目录下创建的几个文件

index.html 入口文件
README.md 会做为主页内容渲染
.nojekyll 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
直接编辑 docs/README.md 就能更新网站内容,当然也可以写多个页面

本地服务器通过 docsify serve 可以方便的预览效果,而且提供 LiveReload 功能,可以让实时的预览。默认访问 http://localhost:3000 。

https://duanruilong.github.io/blog/2019/03/14/docsify%E7%A5%9E%E5%A5%87%E7%9A%84%E6%96%87%E6%A1%A3%E7%BD%91%E7%AB%99%E7%94%9F%E6%88%90%E5%B7%A5%E5%85%B7/ https://www.bbsmax.com/A/A7zgplD1J4/

终端代码生成好看的图片

1
2
3
4
5
6
7
8
9
10
11
12
npm i -g carbon-now-cli
https://github.com/mixn/carbon-now-cli
$ carbon-now --help

Beautiful images of your code — from right inside your terminal.

Usage
$ carbon-now <file>
$ pbpaste | carbon-now
$ carbon-now --from-clipboard
$ carbon-now unfold.js
Takes the entire source of unfold.js, uses Carbon’s default settings and saves as .png into your cwd.

网页成为桌面应用程序

1
2
npm install nativefier -g
nativefier --name "LearnKu" "https://learnku.com"

网页保存成 PDF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 https://github.com/danburzo/percollate 
npm install -g percollate
To transform a single web page to PDF:

percollate pdf --output some.pdf https://example.com
To bundle several web pages into a single PDF, specify them as separate arguments to the command:

percollate pdf --output some.pdf https://example.com/page1 https://example.com/page2
You can use common Unix commands and keep the list of URLs in a newline-delimited text file:

cat urls.txt | xargs percollate pdf --output some.pdf
To transform several web pages into individual PDF files at once, use the --individual flag:

percollate pdf --individual https://example.com/page1 https://example.com/page2
https://www.sejda.com/html-to-pdf

命令行截图

1
2
3
4
5
6
7
8
9
npm i -g screenshoteer
You can use screenshoteer like this:

screenshoteer --url https://www.example.com

or .html localy copy the url path from the browser

screenshoteer --url file:///Users/../index.html
screenshoteer --url file:///C:/Users/../Random-HTML-file.html

任意网站变成桌面软件

1
2
3
4
npm i -g nativefier
nativefier "https://segmentfault.com"
nativefier --name "SegmentFault" "https://segmentfault.com/"
https://segmentfault.com/a/1190000012924855

windows scoop

1
2
3
4
5
6
7
8
9
10
在 PowerShell 中输入下面内容,保证允许本地脚本的执行:

set-executionpolicy remotesigned -scope currentuser
执行下面的命令安装 Scoop:

iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop search git
scoop install git

https://laravelcode.cn/posts/98/scoop-installation-and-use

gitbook

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
λ npm install -g gitbook-cli
npm ERR! path C:\Users\xxx\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules\npmi\node_modules\npm\node_modules\ansistyles
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\xxx\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules\npmi\node_modules\npm\node_modules\ansistyles' -> 'C:\Users\xxx\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules\npmi\node_modules\npm\node_modules\.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2019-12-17T07_10_31_419Z-debug.log

删除这个目录 C:\Users\xxx\AppData\Roaming\npm\node_modules\gitbook-cli\node_modules
λ npm install -g gitbook-cli
C:\Users\xxx\AppData\Roaming\npm\gitbook -> C:\Users\xxx\AppData\Roaming\npm\node_modules\gitbook-cli\bin\gitbook.js
+ gitbook-cli@2.3.2
added 577 packages and updated 1 package in 33.056s

使用tree生成目录树

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
npm install -g tree-node-cli
C:\Users\xxx\AppData\Roaming\npm\treee -> C:\Users\xxx\AppData\Roaming\npm\node_modules\tree-node-cli\bin\tree.js
C:\Users\xxx\AppData\Roaming\npm\tree -> C:\Users\xxx\AppData\Roaming\npm\node_modules\tree-node-cli\bin\tree.js
+ tree-node-cli@1.2.5
added 2 packages in 2.572s
tree --help
Usage: tree [options]

Options:
-V, --version output the version number
-a, --all-files All files, include hidden files, are printed.
--dirs-first List directories before files.
-d, --dirs-only List directories only.
-I, --exclude [patterns] Exclude files that match the pattern. | separates alternate patterns. Wrap your entire pattern in double quotes. E.g. `"node_modules|coverage".
-L, --max-depth <n> Max display depth of the directory tree.
-r, --reverse Sort the output in reverse alphabetic order.
-F, --trailing-slash Append a '/' for directories.
-h, --help output usage information
tree -L 3 -I "vendor" > tree.md

https://hanyajun.com/tools/windows_tree_skill/
链接:https://hanyajun.com/tools/windows_tree_skill/来源:hanyajun.com

ss

json cli

命令行:增强版

SQL 书写 + 视窗组件绑定 + 流程配置

使用Gitbook编写书籍文档

天气查询

命令行终端控制转义序列

Nodejs多版本切换https://tingtas.com/posts/2ec3f20f/