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.
Install so-notify in Linux
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:
extension=pdo_sqlite
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.
How to use So-notify, the Stack Overflow Question Notifier
If you run 'so-notify' without any arguments, you will see the list of available commands and general options.
$ so-notify
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
Suggested read:
Resource:
2 comments
Thank You. It is awesome that you are wrote about my project and I would appreciate if you could add the Product Page link to the resources section. It is https://www.kerneldev.com/2017/12/27/so-notify-a-stack-overflow-question-notifier/
Linked the project’s page. Cheers!