Codeistry

gcalc: a command line version of Google Calculator

Here’s a command line version of Google Calculator:gcalc command line tool in use

Download gcalc here: http://www.codeistry.com/assets/files/gcalc.zip

Using Google Calculator in firefox's search box.It’s a little python script that talks to Google, using it’s calculator syntax. You’ll get the same answers if you type the queries into google

To use the script, just download the zip file, extract the file inside and put it somewhere on your path; I’ve started putting these kind of things in ~/bin. I originally found the script here (http://vrai.net/page.php?block=scripts) but it didn’t work too well, so I fixed it up. I’ve tested it on Linux, but it should work anywhere Python is installed.

If you’re using that script on Linux, then chmod +x gcalc it to allow it to be executed. If you’re using Windows, you might have to add ‘.py’ to the end of the filename. Then the syntax is very simple:

gcalc “1 hour 5 minutes in seconds”
1 hour 5 minutes = 3900 seconds

gcalc “100 + 2 * 5″
100 + (2 * 5) = 110

gcalc “41000 yen in british pounds”
41,000 Japanese yen = 277.129372 British pounds

Here are complete instructions on the syntax that Google Calculator supports.

Also, in the screenshot above I’m using Fish, the Friendly Interactive SHell because it does nice syntax highlighting, amongst many other cool things. Fish is here, if you want it.

Have fun!

Tags: , , ,

 

4 Responses to “gcalc: a command line version of Google Calculator”

  1. null1024 says:

    When I try to click the download link you’ve provided, I keep getting this same page reloaded.
    I’m using Chrome, on Windows.

  2. Duncan Lock says:

    You’re right – thanks for letting me know! Something to do with it being a python file – I’ve zipped it up and it seems to work ok now.

  3. tm says:

    would do fantastically as an enso plugin. although – enso’s dead, or is it?
    http://www.humanized.com/

    last blog entry from 2008, hummmm

  4. Duncan Lock says:

    I used to use Enso ages ago, back when I used to use Windows. I think that the Enso team all went to work for Mozilla or to make cardboard boxes and whatnot, so Enso Launcher kinda got left behind. They open sourced it before they left though, which was nice of them. I occasionally check in on the open source project, but it seems to have made extremely slow progress. They’ve moved to launchpad since last time I looked, which is nice – and according to the Wiki, they have a working Ubuntu build in a PPA. I might try it out and see if it’s still something I’d want to use.

Leave a Reply

Codeistry blog is proudly powered by WordPress Entries (RSS) and Comments (RSS).