Skip to content

Instantly share code, notes, and snippets.

@MichaelBlume
Created October 27, 2012 04:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MichaelBlume/3962894 to your computer and use it in GitHub Desktop.
Save MichaelBlume/3962894 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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