Wednesday, January 31, 2018

cURL - client for URLs

Have been hearing about the tool cURL but never looked into its expansion - its client for URL!

Yes, it deals with URL and hence can also be called as "see URL"

cURL Commands in action:

1. To display content of the site page in your terminal

          curl http://cmshiyas.com

2. Save the output of an URL to a file
   
         curl -o website http://cmshiyas.com

this command saves the output of the site page to the file named website in the current working directory

  • -o (lowercase o) the result will be saved in the filename provided in the command line
  • -O (uppercase O) the filename in the URL will be taken and it will be used as the filename to store the result
        $ curl -O http://cmshiyas.com/index.html

3. Download files

          curl -o archive.zip http://cmshiyas.com/ShiyasFullStackDeveloper.docx

download multiple files

          curl -o archive.zip http://cmshiyas.com/ShiyasFullStackDeveloper.docx -o http://cmshiyas.com/ShiyasFullStackDeveloperNew.docx

to download files securely via SSH

          $ curl -u user ftp://cmshiyas.com

4. Get http header information

           $ curl -I https://google.com

5. Access FTP server

download a file via FTP

                $ curl ftp://ftp.cmshiyas.com/ShiyasFullStackDeveloper.docx --user username:password

upload  a file to server

                $ curl -T file.zip ftp://ftp.cmshiyas.com/ --user username:password

to check cURL man page

               man cURL

Reference:
https://curl.haxx.se/docs/faq.html#What_is_cURL
https://www.rosehosting.com/blog/curl-command-examples/
https://www.thegeekstuff.com/2012/04/curl-examples/

Wednesday, January 17, 2018

How to launch Visual Studio Code from Windows command prompt or Mac Terminal

Launching from the Command Line:

You can also run VS Code from the terminal by typing 'code' after adding it to the path:

  • Launch VS Code.
  • Open the Command Palette (Ctrl+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
Mac shell commands
  • Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.
Note: If you still have the old code alias in your .bash_profile (or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install 'code' command in PATH command.

How to do tag wrapping in VS code?


  1. Launch VS Code Quick Open (Ctrl+P)
  2. paste 'ext install htmltagwrap' and enter
  3. select HTML
  4. press "Alt + W" ("Option + W" for Mac) and enter the tag name you want to provide.