命令行搞一切之curl 的开心应用
查看自己的外网ip地址
很多网站都提供这个功能,如:
curl -s ip.liquidweb.com
curl checkip.amazonaws.com
curl ifconfig.me
curl httpbin.org/ip
生成一个二维码
网址是 qrenco.de,即 QR encode,是不是很好记呢。
% curl qrenco.de/bixuebihui.com
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █ ▄ █ █ ▄▄▄▄▄ ████
████ █ █ █ ▀▀ █ █ █ ████
████ █▄▄▄█ █▀▀██ █ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄▀ █▄█▄▄▄▄▄▄▄████
████ ▀▀ ▄▄▀▀ █▄█▀█▄▀▄▄ ▄████
████▀ █▄▀ ▄▀▄▀ █▀▀██ ██▄▀████
███████▄▄█▄▄ ▀▀▄██▀█ ▄█ ▄████
████ ▄▄▄▄▄ █▀▄▄█▀ █▀▄▄█ ▀████
████ █ █ █▄▀▀█▄ ██▀ ▀▀▀████
████ █▄▄▄█ █▀ ▀▀▄██ ████████
████▄▄▄▄▄▄▄█▄██▄█▄█▄████▄████
█████████████████████████████
█████████████████████████████
生成是显示在页面上看上去有点问题,命令行里还是可以扫到的。
查个字典
curl dict.org/d:entropy |less
curl dict.org/d:curl |less
抽奖时搞个公平随机数
curl "https://www.random.org/integers/?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new"
打小抄
curl http://cht.sh/java
会返回常用的java的一些使用提示。
如
curl http://cht.sh/js/promise
/*
* understanding javascript promise object
*
* Promise execution is asynchronous, which means that it's executed, but
* the program won't wait until it's finished to continue with the rest
* of the code.
*
* Basically, your code is doing the following:
*
* 1. Log 'Hi'
* 2. Create a promise
* 3. Execute the promise
* 4. Log 'zami'
* 5. Promise is resolved and logs 'There'.
* If you want it to print 'Hi there, zami', you will have to
*/
myPromise.then(function (result) {
// Resolve callback.
console.log(result);
console.log('zami');
}, function (result) {
// Reject callback.
console.error(result);
});
/* [Alberto Rivera] [so/q/39458201] [cc by-sa 3.0] */
中文OCR识别
这个网站有免费可用的api: https://ocr.space/OCRAPI
通过curl简单调用可以识别图片上的文字,可以指定语言。免费版每天可用500次,文件最大1M。
支持20几种语言,包括中文。
调用示例:
curl -H "apikey:helloworld" --form "file=@screenshot.jpg" --form "language=eng" --form "isOverlayRequired=true" https://api.ocr.space/Parse/Image
使用前需要注册一个apikey.
查看天气
$ curl wttr.in
会根据ip返回最近三天的天气
% curl wttr.in
Weather report: Beijing, China
.-. Light rain, mist
( ). 18 °C
(___(__) ↑ 0 km/h
‘ ‘ ‘ ‘ 5 km
‘ ‘ ‘ ‘ 2.0 mm
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sun 19 Sep ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ _`/"".-. Light rain sho…│ _`/"".-. Light rain sho…│ .-. Moderate rain │ .-. Light rain │
│ ,\_( ). 19 °C │ ,\_( ). 19 °C │ ( ). 17 °C │ ( ). 16 °C │
│ /(___(__) ↑ 6-8 km/h │ /(___(__) ↑ 6-7 km/h │ (___(__) ← 10-14 km/h │ (___(__) ↓ 6-9 km/h │
│ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‚‘‚‘‚‘‚‘ 7 km │ ‘ ‘ ‘ ‘ 9 km │
│ ‘ ‘ ‘ ‘ 0.2 mm | 74% │ ‘ ‘ ‘ ‘ 0.4 mm | 97% │ ‚’‚’‚’‚’ 2.5 mm | 95% │ ‘ ‘ ‘ ‘ 1.9 mm | 94% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 20 Sep ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ .-. Light rain │ Cloudy │ \ / Partly cloudy │ Overcast │
│ ( ). 16 °C │ .--. 17 °C │ _ /"".-. 18 °C │ .--. 17 °C │
│ (___(__) ↘ 20-34 km/h │ .-( ). ↘ 15-26 km/h │ \_( ). ↘ 5-9 km/h │ .-( ). → 4-8 km/h │
│ ‘ ‘ ‘ ‘ 9 km │ (___.__)__) 10 km │ /(___(__) 10 km │ (___.__)__) 10 km │
│ ‘ ‘ ‘ ‘ 1.3 mm | 89% │ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Tue 21 Sep ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ \ / Partly cloudy │ \ / Partly cloudy │ \ / Partly cloudy │ \ / Partly cloudy │
│ _ /"".-. 21 °C │ _ /"".-. +24(25) °C │ _ /"".-. +23(25) °C │ _ /"".-. 20 °C │
│ \_( ). → 15-20 km/h │ \_( ). ↘ 23-27 km/h │ \_( ). ↓ 6-10 km/h │ \_( ). → 4-7 km/h │
│ /(___(__) 10 km │ /(___(__) 10 km │ /(___(__) 10 km │ /(___(__) 10 km │
│ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Follow @igor_chubin for wttr.in updates
你在北京,想看看上海的天气,也很简单
推荐阅读
从原生 JavaScript 到 React
React 是一个用于构建用户界面的 JavaScript 框架。它可用于通过动态操作页面内容来创建 JavaScript 应用程序。浏览器已经提供了在页面中创建元素的 API,即 DOM,所以新手可能想知道 React 带来了什么以及它与 D...
Yujiaao赞 7阅读 3.3k
curl安装
一:windows下安装curl1:下载windows版本curl安装包根据你电脑的系统选择32位或64位,因为我的电脑是64位的,所以我选择64位的安装包curl下载地址:[链接]2:安装curl(1)将下载下来的压缩包解压到你想要安装的目录下...
huaweichenai阅读 402
【文本检测与识别白皮书-3.2】第三节:常用的文本识别模型
2017年华中科技大学在发表的论文《An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition》提出了一个识别文本的方法,这种方法就是CRNN...
合合技术团队阅读 377
FreeBSD系统安装NFS(Network File System)服务并启用基于 IP 认证的机制
Network File System (NFS)网络文件系统:可以把网络上的某个资源做为本地硬盘来使用的一种系统。该服务主要依赖于:nfsd、mountd以及rpcbindnfsd: 接收 NFS 客户端发起的请求mountd: 处理由nfsd接收的请潮州rpcb...
myskies阅读 372
FOTS:端到端的文本检测与识别方法的原理方法与优势
导言:基于深度学习的可端到端训练的自然场景检测与识别算法(text spotting)由于其简洁高效且统一的结构,逐渐取代了过去将检测与识别分阶段训练然后拼接在一起的方案,成为自然场景文本检测与识别的主流研究方向...
合合技术团队阅读 370
智能文档处理IDP关键技术与实践
什么是智能文档处理?针对文本数据处理尤其是纯文本,大家通常会想到使用自然语言处理(Natural language processing,NLP)技术来解决语义理解及分析处理工作。关于自然语言处理技术的研究有很长历史,针对不同...
达观数据阅读 356
后端请求数据计算量过大,导致给用户的返回结果过于漫长【一次调优的过程】
有一个表格,描述的是Snapshot-1和Snapshot-2之间的对比,数据对比的结果是由后端算出来的,前端只要负责渲染就可以。后端返回的数据本质是一个“森林”,每棵“树”都是三层,分别是:type/ class name/ object name...
灰灰阅读 350
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。