Stack Overflow needs no introduction. It is one of the largest Q&A portal site for Programmers to learn, search and post questions and get answers from millions of users around the world. A while ago, we published a guide that described how to search and browse Stack Overflow website from command line. Today, we are going to discuss yet another command line application named "so-notify" that sends a notification to the user's system when a new question is posted on Stack Overflow website. So-notify, the Stack Overflow Question notifier, is a tiny CLI application (97k) written in PHP. The source code is freely available on GitHub, so you can fork it, improve the code or fix bugs if there any.
So-notify – A Stack Overflow Question Notifier
Installation is incredibly easy! I tested it on my Arch Linux system. It worked well!
First make sure you have installed php and php-sqlite packages. These two packages are available in the official repositories of most Linux distributions. On Arch Linux and derivatives, you can install them like below.
$ sudo pacman -S php php-sqlite
After installing the prerequisites, enable pdo sqlite extension for your php.
To do so, edit /etc/php/php.ini file:
$ sudo vi /etc/php/php.ini
Find and uncomment the following line:
Hit ESC key and type :wq to save and close the file.
Now, download the latest version of so-notify from the project's releases page.
$ wget https://github.com/SapneshNaik/so-notify--A_Stack_Overflow_Question_Notifier/files/1586849/so-notify.gz
Extract the downloaded archive:
$ gzip -d ./so-notify.gz
Then copy it to your /usr/local/bin/ folder:
$ sudo mv ./so-notify /usr/local/bin
Finally, make it executable:
$ chmod u+x /usr/local/bin/./so-notify
Done! Now it is time to see how it works.
If you run 'so-notify' without any arguments, you will see the list of available commands and general options.
Before running it, you need to subscribe to one or more tags of your choice. Let me subscribe to some tags, for example linux and python.
$ so-notify tag:add linux
$ so-notify tag:add python
You can subscribe to as many as tags you want. To list all subscribed tags, run:
$ so-notify tag:show
Sample output would be:
Once subscribed, run so-notify for questions:
$ so-notify run
Just click on any question to view it in your default web browser.
To unsubscribe from any subscribed tag, use tag_id like below:
$ so-notify tag:remove 2
You can view the tag ids by listing the subscribed tags.
$ so-notify tag:show
You don't have to manually check for questions every time. Setup a cronjob to check for new questions every X minute(s).
To do so, run:
$ crontab -e
Add the following line to check for new questions every minute.
* * * * * /usr/local/bin/so-notify run
Save and quit the file. Start or restart cron service to take effect the changes.
$ sudo service cron start