Skip to content

Instantly share code, notes, and snippets.

@gautamkrishnar
Last active April 14, 2022 20:20
Embed
What would you like to do?
Automated script to fetch current and daily BSNL network usage and show it on your MacOS menu bar
#!/usr/bin/env bash
curl 'https://redirect1.bbportal.bsnl.co.in/portal/fetchUserQuotaPM.do' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36' \
--data-raw \
'actionName=manual&_search=false&rows=4&page=1&sidx=&sord=asc' \
--silent | /usr/local/bin/jq --raw-output '.rows[0] | "\(.totalUsage)\n---\nToday \(.dailyTotalUsage)"'
@gautamkrishnar
Copy link
Author

gautamkrishnar commented Apr 13, 2022

Preview

Screenshot 2022-04-13 at 1 03 23 PM

How to use

  1. Open your terminal
  2. Install brew if it is not installed: https://brew.sh/
  3. Install jq by running the following command
brew install jq
  1. Download and install https://xbarapp.com/
  2. Open Xbar
  3. Click on Xbar on your menu bar and select Open Plugin Folder option
  4. Create a file named bsnl_usage-5m-sh in that folder with the above contents
  5. Click on xbar again and select "Refresh all" option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment