Skip to content

Instantly share code, notes, and snippets.

@edunham
Created November 2, 2014 17:09
Show Gist options
  • Save edunham/a5ff33070b359fcebc1c to your computer and use it in GitHub Desktop.
Save edunham/a5ff33070b359fcebc1c to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import sys
import os
import datetime
from subprocess import check_output
def count():
files = os.listdir('.')
count = 0
ext = 'from_focuswriter.txt'
for f in files:
if ext in f:
count += int(check_output(["wc", f]).split()[1])
return count
def today():
return datetime.datetime.today().day
def round_down(num, divisor):
return num - (num%divisor)
def main():
perday = 1667.0
target = today() * perday
daysleft = 30 - today()
print "today's target is " + str(int(target))
current = count()
wordsleft = 50000-current
print "your current wordcount is " + str(current)
skew = (current - target) / perday
print "You are currently ahead/behind by days: " + str(skew)
print "Tomorrow's target would be " + str(target+perday) + \
" but is actually now " + str(current+perday)
print "------------------------------------------"
print "You have "+str(wordsleft)+" words left. Use them wisely."
wpdtf = wordsleft/daysleft
print "Words per day to finish: " + str(wpdtf)
t_wpdtf = round_down(wpdtf, 10)
h_wpdtf = round_down(wpdtf, 100)
k_wpdtf = round_down(wpdtf, 1000)
print "If you want wpdtf = " + str(t_wpdtf)
print "\t then write this many more " + str(50000 - (t_wpdtf * daysleft + current))
print "If you want wpdtf = " + str(h_wpdtf)
print "\t then write this many more " + str(50000 - (h_wpdtf * daysleft + current))
print "If you want wpdtf = " + str(k_wpdtf)
print "\t then write this many more " + str(50000 - (k_wpdtf * daysleft + current))
print "------------------------------------------"
dday = 50000/(current/today())
print "you've written words per day: " + str(current/today())
print "If you keep up this average, you'll be done on day " + str(dday)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment