Skip to content

Instantly share code, notes, and snippets.

@christiangenco
Created May 1, 2013 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiangenco/5499011 to your computer and use it in GitHub Desktop.
Save christiangenco/5499011 to your computer and use it in GitHub Desktop.
A simple script to log my weight in a csv stored in dropbox.
#!/usr/bin/env ruby
require 'time'
filename = '/Users/cgenco/Dropbox/log/weight.csv'
File.open(filename, "a") {} # create the file if it doesn't exist
weight = ARGV.first
unless weight
puts "From: " + filename
puts File.read(filename)
exit
end
f = File.new(filename, 'a')
f.puts "#{Time.now.to_s}, #{weight}"
@christiangenco
Copy link
Author

Usage:

~$ weight 167.2
~$ weight
From: ~/Dropbox/log/weight.csv
2013-05-01 17:53:15 -0500, 167.2

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