Created
October 27, 2012 04:01
-
-
Save MichaelBlume/3962894 to your computer and use it in GitHub Desktop.
Beeminder writing check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.