--- layout: post status: publish published: true title: Displaying EE mobile data usage in Conky wordpress_id: 2746 wordpress_url: https://www.martineve.com/?p=2746 date: !binary |- MjAxMy0wNy0xNCAxNzowNzoxOSArMDIwMA== date_gmt: !binary |- MjAxMy0wNy0xNCAxNjowNzoxOSArMDIwMA== categories: - Technology tags: - Technology comments: [] ---

OK, this is probably one of the most specific posts I've ever written, but...

I wrote a bash script to automatically fetch and parse the currently used data on the 4G EE mobile network in the UK that can then be used with Conky. It's a compact one liner that looks like this:

{% highlight bash %} #!/bin/bash wget -qO- http://add-on.ee.co.uk/status | awk -v OFS=' / ' -v ORS='' '//{sub(/^[^0-9]*/, ""); dused=$0; match(dused, /^([0-9].?[0-9]?).+([0-9][^G]?[0-9]?)/, arr);} END {print arr[1], arr[2];}' {% endhighlight %}

You can then call this from a conkyrc file with something like this:

{% highlight bash %} ${color #F09000}Mobile Usage${color #707070}:${color white} ${execi 900 ~/.scripts/getusage.sh}GB {% endhighlight %}