Michal Hrušecký

...about me, Linux and OpenSource

Car consumption script

About a week ago I was at LinuxTag spreading a word about openSUSE. It was great event and I really liked it. And I was on of the four lucky guys that won Googles Nexus One. Hurray! And now what I want to write today about... I was migrating all my stuff from my Palm Centro to Nexus One. And one of the things I was using my Centro for was tracking how much petrol does my car consume. I was writing in plain text file and I was thinking about writing some script around that... But never had the time to actually do that. But now with Nexus One, my log is synchronized with Google Docs. So I don't have to take care of the synchronization part. So I sat down and wrote a simple script to compute my cars consumption and I want to share it with you. Originaly I wanted to use googlecl, which is available in openSUSE Contrib, but it had some problems with Google Apps, so I decided to use curl instead.

First of all how do I structure my log. I've got currently two types of things I'm tracking - petrol and maintenance. As we are talking about consumption, we are interested only in petrol ones face-wink.png These lines looks like this:

PET:97644:20100430:12.53l:394.4Kč

As you see, it's in semicolon separated values format face-smile-big.png First field means that it's petrol entry. Second one is kilometer counter. Third one is the date %Y%m%d and the fourth one is the number of liters. Fourth one is the price, but it's not really important. My document is named "Auto" but if you want to use the same script, you can name it however you want and just change the $TITLE variable in the script. You'll need to change email and password anyway face-wink.png And you might be also interested in changing $RECENT variable, which states how many entries are used in computation.

Script

Leave a Comment

Write the captcha code you are seeing.

Comment XML feeds: RSS | Atom

openSUSE Conference 2010

Identica

  • Last ride in the driving school on Wednesday, then the exams on Monday, I wonder whether I'll make it...
    2 days ago :: link
  • Did you knew that all ducks are wearing dog mask? http://i.imgur.com/XSVIy.jpg
    16 days ago :: link
  • Firt ride in the driving school. No crush, kill or destroy so I guess it's going well so far :-D
    16 days ago :: link
  • Already at #frosconn preparing for !openSUSE Connect hacking session!
    18 days ago :: link
  • Are you interested in !openSUSE Connect? Join us at #froscon! http://bit.ly/dDdKIp
    21 days ago :: link

Ohloh Journal for Michal Hrušecký

  • Finally pushed Affisix version that supports variables in the way I'm satisfied with. Time to get back to the documentation fixing ;-)
    9 days ago :: link
  • Article about Affisix was acceptet for ITAT 2010! Time to fix everything that reviewers complained about!
    76 days ago :: link
  • Abstract for ITAT2020 about Affisix sent, working on the article now...
    106 days ago :: link
  • Just commited basit filter mode support to the Affisix repository. It is still missing a lot of features, but the basics are already there!
    132 days ago :: link
  • One more note about affisix - backward entropy works now as well. So after school exams, I can start implementing new features and fixing broken ones...
    199 days ago :: link

Emblems

Powered By Jaws Project
Supports RSS2
Supports Atom
Powered By openSUSE
Powered By Vim
Is Valid XHTML
Is Valid CSS
Is Valid RSS2