view your public IP from pentadactyl/vimperator
Pentadactyl and vimperator extensions allow you to write handy functions in javascript. These functions can be later called from the command mode or from keybindings.
Some time ago, I wrote a simple function, that makes a request to a page which returns your public ip address. That way you don’t have to actually visit that page and interrupt your flow of work. I find this extremely useful as I frequentlty use VPNs and SOCKS proxies.
The js code is the following:
I used a very simple service I wrote and is currently deployed at heroku, ipz. You can use any of the popular services like icanhazip or checkip service from dyndns.
In order for this to work, you need to put the function in your ~/.pentadactylrc
enclosed
in a here-document block:
I also set a command to call this function by typing :ip
, the command is:
In order for this to work in vimperator, we need some adjustments. Put the following code in your
~/.vimperatorrc
.
Again don’t forget the here-document block and the command, which are a bit different.