Instantly share code, notes, and snippets.

Embed
What would you like to do?
Beeminder writing check
#!/usr/bin/env python
import envoy
import requests
import time
r = envoy.run("find /Users/mike/Dropbox/writing | grep -v DS_Store | xargs wc -c")
count = r.std_out.split()[-2]
kb_written = int(count) // 1024
url = "https://www.beeminder.com/api/v1/users/mblume/goals/writing/datapoints.json"
r = requests.post(url,
{'auth_token': BEEMINDER_TOKEN
,'timestamp': time.time()
,'value': kb_written
})
with open('/Users/mike/.logs/writing_outputs', 'a') as f:
f.write('kb written: ')
f.write(str(kb_written))
f.write('\n')
f.write('excess bytes: ')
f.write(str(int(count) % 1024))
f.write('\n')
f.write(r.text)
f.write('\n')
@MichaelBlume

This comment has been minimized.

Owner

MichaelBlume commented Oct 27, 2012

Little script I keep in cron to track the size of my writing folder in my dropbox. I write to text files (from any computer connected to my dropbox) and it tells me if I'm not writing enough.

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