Visit StackOverflow without leaving the terminal with Python

Stuck on a coding problem? Wish to visit StackOverflow without leaving the terminal? With howdoi, you can do it!

Introduction to howdoi

Howdoi is an open source command line tool that gives answers to your questions right on the command line. Howdoi can be used by anyone and everyone who finds themselves Googling for answers to their basic programming questions.

You wonder:

howdoi print hello in python

Howdoi output:

print(“hello”)

Installation

pip install howdoi

Suppose you want to know how to format a date in bash. Why open your browser and read through blogs (risking major distraction) when you can simply stay in the console and ask howdoi:

$ howdoi format date bash
> DATE=`date +%Y-%m-%d`

howdoi will answer all sorts of queries:

$ howdoi print stack trace python
> import traceback
>
> try:
>     1/0
> except:
>     print '>>> traceback <<<'
>     traceback.print_exc()
>     print '>>> end of traceback <<<'
> traceback.print_exc()

$ howdoi convert mp4 to animated gif
> video=/path/to/video.avi
> outdir=/path/to/output.gif
> mplayer "$video" \
>         -ao null \
>         -ss "00:01:00" \  # starting point
>         -endpos 10 \ # duration in second
>         -vo gif89a:fps=13:output=$outdir \
>         -vf scale=240:180

$ howdoi create tar archive
> tar -cf backup.tar --exclude "www/subf3" www

You can also search other StackExchange properties for answers:

HOWDOI_URL=cooking.stackexchange.com howdoi make pesto

or as an alias:

alias hcook='function hcook(){ HOWDOI_URL=cooking.stackexchange.com howdoi $* ; }; hcook'
hcook make pesto

I advise you to visit this link: howdoi

There is also an Visual Studio Code Extension, Head over to the MarketPlace to install the extension.

Thank you all.

24