头图

A happy application of curl with the command line to do everything

Yujiaao
中文

View your own external network ip address

Many websites provide this feature, such as:

curl -s ip.liquidweb.com
curl checkip.amazonaws.com
curl ifconfig.me
curl httpbin.org/ip

Generate a QR code

The website is qrenco.de, which is QR encode, is it easy to remember?

% curl qrenco.de/bixuebihui.com
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █ ▄ █ █ ▄▄▄▄▄ ████
████ █   █ █ ▀▀  █ █   █ ████
████ █▄▄▄█ █▀▀██ █ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄▀ █▄█▄▄▄▄▄▄▄████
████  ▀▀ ▄▄▀▀ █▄█▀█▄▀▄▄ ▄████
████▀ █▄▀ ▄▀▄▀ █▀▀██ ██▄▀████
███████▄▄█▄▄ ▀▀▄██▀█ ▄█ ▄████
████ ▄▄▄▄▄ █▀▄▄█▀ █▀▄▄█ ▀████
████ █   █ █▄▀▀█▄ ██▀ ▀▀▀████
████ █▄▄▄█ █▀  ▀▀▄██ ████████
████▄▄▄▄▄▄▄█▄██▄█▄█▄████▄████
█████████████████████████████
█████████████████████████████

The generation is displayed on the page and it seems a bit problematic, but it can still be scanned in the command line.

Look up a dictionary

curl dict.org/d:entropy |less

curl dict.org/d:curl |less

Make a fair random number in the lottery

curl "https://www.random.org/integers/?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new"

Cheat sheet

curl http://cht.sh/java

Will return some common usage tips for java.

like

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] */

Chinese OCR recognition

This website has free APIs available: https://ocr.space/OCRAPI
The text on the picture can be recognized by a simple call of curl, and the language can be specified. The free version can be used 500 times a day, and the maximum file size is 1M.
Support more than 20 languages, including Chinese.

Call example:

curl -H "apikey:helloworld" --form "file=@screenshot.jpg" --form "language=eng" --form "isOverlayRequired=true" https://api.ocr.space/Parse/Image

You need to register an apikey before use.

Check the weather

$ curl wttr.in

Will return to the weather of the last three days according to 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

You are in Beijing and want to see the weather in Shanghai, it’s also very simple
上海天气

阅读 337

[链接]

12.4k 声望
4.7k 粉丝
0 条评论

[链接]

12.4k 声望
4.7k 粉丝
文章目录
宣传栏