isamert

my notes and projects

Projects | Github

24 March 2018

Nice little curl commands

by isamert

Here are some curl friendly web services that you can use in your terminal:

Weather

IP

File/URL

Cheat sheets

Translate

This is not really curl friendly but it works.

curl -s -A "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0" "https://translate.google.com/m?sl=FROM&tl=TO&ie=UTF-8" --data-urlencode "q=WORD_OR_SENTENCE" | grep -Po '<div dir="ltr" class="t0">\K[^<]*'

This example demonstrates how you can get the relevant information from an ordinary website. Always use the mobile versions if available because it is easier to parse them.

Cryptocurrency rates

ASCII QR Codes

WebDAV

If you are using a service that supports WebDAV, you can use these simple curl commands to download/upload files to your service. You can also do more sophisticated things with curl but if you need more than just downloading/uploading files then it’s better to use a client dedicated for that service.

It’s better not to write your password while using these commands. If you remove the password part it will just simply show you a password prompt when you execute these commands which better than exposing your password to bash history.

Convert Documents

I’ll just leave a link here: docverter.com. You can convert nearly any format to any other one using this service. It has a nice and clear API. The website provides curl command examples.

tags: