Рубрики
Uncategorized

Рекомендация артефакта командной строки

Автор оригинала: David Wong.

Поскольку программисты привыкли работать в командной строке, порекомендуйте сегодня какой-нибудь артефакт командной строки, который может открыть вам глаза.

Счетчик строк кода статистического текущего справочника

//https://github.com/MorganZhang100/line-counter
//find . -name '*.py' -exec wc -l {} + 
//wc -l
pip install line-counter  
$ line
Search in /Users/Morgan/Documents/Example/
file count: 4
line count: 839
$ line -d
Search in /Users/Morgan/Documents/Example/
Dir A/file C.c                                             72
Dir A/file D.py                                           268
file A.py                                                 467
file B.c                                                   32
file count: 4
line count: 839

//https://github.com/AlDanial/cloc
npm install -g cloc   
$ cloc wechat-cli.py
       1 text file.
       1 unique file.
       0 files ignored.

github.com/AlDanial/cloc v 1.72  T=0.14 s (7.4 files/s, 779.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                           1             12              7             87
-------------------------------------------------------------------------------

Исправление ошибок командной строки, блядь

//https://github.com/nvbn/thefuck
pip install thefuck
➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim
[sudo] password for nvbn:
Reading package lists... Done

уценка в html

npm install -g codedog
codedog xx.md or codedog xx.md width height

Клиент MySQL, поддерживающий подсветку синтаксиса и команды завершение mycli

// https://github.com/dbcli/mycli
pip install -U mycli
$ mycli -h localhost -uroot
Password:
Version: 1.8.0
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - Tech Blue Software
mysql [email protected]:(none)> use test
You are now connected to database "test" as user "root"
Time: 0.005s
mysql [email protected]:test> show t
                                  TABLE STATUS
                                  TABLE STATUS
                                  TABLES
                                  TABLES
                                  TRIGGERS
                                  TRIGGERS
                                  STATUS
 [F2] Smart Completion: ON  [F3] Multiline: OFF  [F4] Emacs-mode

Инструмент веб-экрана на основе Кукольника

$ npm install -g vian
(1) intercepting GitHub Homepage

$ vian https://github.com
(2) intercepting GitHub home page (not full screen)

$ vian --no-fullpage https://github.com
(3) Save the GitHub home page as a picture to simulate the iPhone 6

$ vian -d 'iPhone 6' -f github.jpg https://github.com
(4) Save the GitHub homepage as a PDF document, and choose A4 as the paper size.

$ vian -t pdf -s A4 https://github.com
(5) View all analog devices

$ vian devices

//https://github.com/Runjuu/page2image
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

Микросервис для создания PDF-файлов

установка npm-g pdf-оба

Отображение обработки и форматирования файлов JSON, поддержка подсветки, может заменить python-m json. инструмент

//https://github.com/stedolan/jq http://blog.chinaunix.net/uid-24774106-id-3830242.html
$ cat json_raw.txt 
{"name":"Google","location":{"street":"1600 Amphitheatre Parkway","city":"Mountain View","state":"California","country":"US"},"employees":[{"name":"Michael","division":"Engineering"},{"name":"Laura","division":"HR"},{"name":"Elise","division":"Marketing"}]}
cat json_raw.txt | jq '.location.state'
    "California"
 echo '{"foo": 42, "bar": "less interesting data"}' | jq .nofoo
    null
cat json_raw.txt | jq 'keys'
[
  "employees",
  "location",
  "name"
]

Инструмент статической проверки скрипта оболочки проверка оболочки

//https://github.com/koalaman/shellcheck
apt-get install shellcheck
shellcheck test.sh

Многопоточный инструмент загрузки Axel

//  axel.alioth.debian.org/
sudo apt-get install axel
axel -n 10 -a 
axel -n 20 http://centos.ustc.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso

Средство запроса командной строки http ie

//https://httpie.org/ https://github.com/jakubroztocil/httpie
pip install --upgrade httpie
http PUT example.org X-API-Token:123 name=John
http -f POST example.org hello=World
http example.org/file > file
http httpbin.org/post  --  -name-starting-with-dash=foo -Unusual-Header:bar
POST /post HTTP/1.1
-Unusual-Header: bar
Content-Type: application/json

{
    "-name-starting-with-dash": "value"
}

Документ командной строки TLDR

// https://github.com/tldr-pages/tldr
npm install -g tldr
$ tldr curl
Cache is out of date, you should run "tldr --update"

  curl
  Transfers data from or to a server.
  Supports most protocols including HTTP, FTP, POP.

  - Download a URL to a file:
    curl "URL" -o filename

  - Send form-encoded data:
    curl --data name=bob http://localhost/form

  - Send JSON data:
    curl -X POST -H "Content-Type: application/json" -d '{"name":"bob"}' http://
localhost/login

  - Specify an HTTP method:
    curl -X DELETE http://localhost/item/123

  - Head request:
    curl --head http://localhost

  - Include an extra header:
    curl -H "X-MyHeader: 123" http://localhost

  - Pass a user name and password for server authentication:
    curl -u myusername:mypassword http://localhost

Обман инструмента командной строки

//https://github.com/chrisallenlane/cheat
 pip install cheat
cheat tar
# To extract an uncompressed archive: 
tar -xvf '/path/to/foo.tar'

# To extract a .gz archive:
tar -xzvf '/path/to/foo.tgz'

# To create a .gz archive:
tar -czvf '/path/to/foo.tgz' '/path/to/foo/'

# To extract a .bz2 archive:
tar -xjvf '/path/to/foo.tgz'

# To create a .bz2 archive:
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'

Фоновый процесс запуска и управления PM2 и руководитель python

//http://pm2.keymetrics.io/
npm install pm2 -g 
pm2 list

Мониторинг артефакта Nginx ngxtop в режиме реального времени в командной строке

//https://linux.cn/article-3205-1.html
pip install ngxtop
ngxtop -n 20
ngxtop info

Инструмент нормализации формата кода Python yapf

//https://github.com/google/yapf 
 pip install yapf
>>> from yapf.yapflib.yapf_api import FormatCode  # reformat a string of code

>>> FormatCode("f ( a = 1, b = 2 )")
'f(a=1, b=2)\n'

Инструмент нечеткого поиска FZF в командной строке

//https://github.com/junegunn/fzf
brew install fzf
find * -type f | fzf > selected

Версия командной строки музыкальной шкатулки

//https://github.com/darknessomi/musicbox
pip(3) install NetEase-MusicBox

$ git clone https://github.com/darknessomi/musicbox.git && cd musicbox
$ python(3) setup.py install

Многопоточный инструмент загрузки aria2

//https://github.com/aria2/aria2
aria2c http://a/f.iso ftp://b/f.iso
Aria2 download cloud link https://github.com/acgotaku/BaiduExporter

Лучший HTTP – сервер http-сервер, чем python-mSimpleHTTPServer

//https://github.com/indexzero/http-server
npm install http-server -g
 http-server 8888
alias hs="source ~/.bash_profile && http-server -a $(ifconfig en0 | grep 'inet ' | cut -d ' ' -f 2)"
// Browser opens http://localhost:8888

Получить Китайский Пиньинь пи пиньинь

pip install pypinyin

What command-line software pypinyin has is a magic weapon

yǒu něi xiē mìng lìng xíng de ruǎn jiàn kān chē

Статический анализатор конфигурации Nginx

https://github.com/yandex/gixy 
pip install gixy
gixy /etc/nginx/nginx.conf

Запрос HTTP

pip install http-prompt
pip install httpie
# No parameters initially
> httpie
http http://localhost

# Send a request with some overrided parameters
> post /api/v1 --form name=jane

# Current state remains intact
> httpie
http http://localhost

узел ppt

https://github.com/ksky521/nodePPT
npm install -g nodeppt 
Execute nodeppt start
Visit http://127.0.0.1:8080/
Online demo: http://js8.in/nodeppt/

Проверьте Совместимость Браузера

npm install -g caniuse-cmd
$ caniuse flex
Flexible Box Layout Module √ 83.86% Θ 13.63% [W3C Candidate Recommendation]
  Method of positioning elements in horizontal or vertical stacks. Support
  includes the support for the all properties prefixed with `flex` as well as
  `display: flex`, `display: inline-flex`, `align-content`, `align-items`,
  `align-self`, `justify-content` and `order`. #CSS3

  IE × 5.5+ Θ 10+ᵖ² Θ 11⁴
  Edge √
  Firefox Θ 2+ᵖ¹ Θ 22+³ √ 28+
  Chrome Θ 4+ᵖ¹ √ 21+ᵖ √ 29+
  Safari Θ 3.1+ᵖ¹ √ 6.1+ᵖ √ 9+
  Opera × 9+ √ 12.1+ √ 15+ᵖ √ 17+

    ¹Only supports the [old
    flexbox](http://www.w3.org/TR/2009/WD-css3-flexbox-20090723) specification
    and does not support wrapping.
    ²Only supports the [2012
    syntax](http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/)
    ³Does not support flex-wrap, flex-flow or align-content properties
    ⁴Partial support is due to large amount of bugs present (see known issues)
   ⓘ  Most partial support refers to supporting an [older
   version](http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/) of the
   specification or an [older
   syntax](http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/).

Средство Перевода командной Строки

npm install terminal-translate -g
// Similar to NPM install fanyi-g https://github.com/afc163/fanyi
$ tl great

  ~Great - [GRE ɪ t] us [GRE ɪ t]
  Great.

   - n. Masters; Big Men; Great Men
   - adj. Great, great; excellent, good; major

   1. Great
     Great, Great, Great

   2. Great Lakes
     Great Lakes, Great Lakes, Great Lakes Region

   3. Great Recession
     Great Recession, Great Recession, Great Depression

Инструмент Для Создания Коротких Доменных Имен

npm i -g npm i -g

Распознавание изображений

npm install baidu-ocr-api -g

ocr --help
# Remote Pictures
ocr http://7pun4e.com1.z0.glb.clouddn.com/test.jpg

# Local Pictures
ocr ./test.jpg

Сравнение файлов

npm install -g diffchecker
diffchecker file1.js file2.js
diffchecker --expires day file1.js file2.js

Общий доступ к файлам

# Uploading is easy using curl 
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt 
https://transfer.sh/66nb8/hello.txt 

$ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt https://transfer.sh/hello.txt 
https://transfer.sh/66nb8/hello.txt 
# Download the file 
$ curl https://transfer.sh/66nb8/hello.txt -o hello.txt

отправляйте электронные письма

First, create a config.json with your SMTP settings:

{
    "host": "smtp.foobar.net",
    "port": 465,
    "user": "noreply",
    "pass": "foobar!"
}

Install the app and start it up to point at the config:

npm i mailit -g
mailit --config /path/to/config.json

And presto, a mail endpoint! Let's try it out:

curl --data "[email protected]&subject=hi&text=hey world" http://127.0.0.1:3000/email

узнай, что ты баш

установка npm-g bash -справочник

Загрузчик облачной музыки Netease

$ git clone https://github.com/codezjx/netease-cloud-music-dl.git
$ python setup.py install
$ ncm -s 123123
or
$ ncm -s http://music.163.com/#/song?id=123123

Статистический анализ Curl http stat

pip install httpstat
httpstat httpbin.org/get

Удалите избыточный CSS

//https://github.com/purifycss/purifycss
$ npm install -g purify-css
$ purifycss -h

purifycss   [option]

Options:
  -m, --min        Minify CSS                         [boolean] [default: false]
  -o, --out        Filepath to write purified css to                    [string]
  -i, --info       Logs info on how much css was removed
                                                      [boolean] [default: false]
  -r, --rejected   Logs the CSS rules that were removed
                                                      [boolean] [default: false]
  -w, --whitelist  List of classes that should not be removed
                                                           [array] [default: []]
  -h, --help       Show help                                           [boolean]
  -v, --version    Show version number                                 [boolean]

Инструмент HTTP-запросов

pip install http
# Verify proxy IP validity by comparing responses with real IP, if not different
$ http --proxy http://59.49.129.60:8998 http://ip.cip.cc
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 13
Content-Type: text/plain; charset=utf-8
Date: Sat, 09 Sep 2017 01:06:40 GMT
P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NO
I DSP COR'
Proxy-Connection: keep-alive
Server: nginx
Vary: Accept-Encoding

59.49.129.60
>>> pro={'http':'59.49.129.60:8998'}
>>>pro=requests.get('http://lab.crossincode.com/proxy/get/?num=35&head=https').json()['proxies']
>>> import requests as rq
>>> r=rq.get('http://ip.cip.cc',proxies=pro) 
>>> r.text
'59.49.129.60\n'

Инструмент поиска владельца номера мобильного Телефона

npm install -g cellocate
cellocate 13888888888
13888888888
Yunnan Kunming Mobile

Создание простого статического файлового http-сервера

python3 -m http.server port
npm install http-server -g
npm install -g serve
npm install -g anywhere
npm -g install puer
php -S localhost:9999

Поиск инструмента управления словами в командной строке

pip install iSearch
s sun

Sun is not in the database. Look it up from a dictionary.
sun /sʌn/

N-SING The sun is the ball of fire in the sky that goes around the earth, and that gives us heat and light. 

The sun was now high in the southern sky. The sun was hanging high in the southern sky. 

Example: The sun came out, briefly. The sun came out for a short time.

Скриншот веб-страницы

npm install capteer -g
capteer  [filename] [options]

Подробнее Используйте скриншоты Инструменты командной строки Общедоступный номер: Су Шэн не смущен