- result = subprocess.run("wc -w content/drafts/blanchards-dangerous-idea-and-the-plight-of-the-lucid-crossdreamer.md content/drafts/a-hill-of-validity-in-defense-of-meaning.md content/drafts/if-clarity-seems-like-death-to-them.md content/drafts/agreeing-with-stalin-in-ways-that-exhibit-generally-rationalist-principles.md content/drafts/standing-under-the-same-sky.md".split(), stdout=subprocess.PIPE)
+ result = subprocess.run("wc -w content/2023/blanchards-dangerous-idea-and-the-plight-of-the-lucid-crossdreamer.md content/2023/a-hill-of-validity-in-defense-of-meaning.md content/drafts/if-clarity-seems-like-death-to-them.md content/drafts/agreeing-with-stalin-in-ways-that-exhibit-generally-rationalist-principles.md content/drafts/zevis-choice.md content/drafts/standing-under-the-same-sky.md content/drafts/the-last-indictment.md".split(), stdout=subprocess.PIPE)
wc_lines = result.stdout.decode('utf8').split('\n')
total_line = wc_lines[-2] # last line is empty
return int(total_line.split()[0])
wc_lines = result.stdout.decode('utf8').split('\n')
total_line = wc_lines[-2] # last line is empty
return int(total_line.split()[0])
subprocess.run(["git", "checkout", "HEAD~1"])
wordcount = wordcount_at_this_sha()
date = date_at_this_sha()
subprocess.run(["git", "checkout", "HEAD~1"])
wordcount = wordcount_at_this_sha()
date = date_at_this_sha()
keep_going = False
wordcounts.append((date, wordcount))
# don't leave the head detached
keep_going = False
wordcounts.append((date, wordcount))
# don't leave the head detached
def write_csv(wordcounts):
with open("memoir_wordcounts.csv", 'w') as f:
writer = csv.writer(f)
def write_csv(wordcounts):
with open("memoir_wordcounts.csv", 'w') as f:
writer = csv.writer(f)
- writer.writerow([date.strftime("%m/%d/%Y"), wordcount])
+ diff = wordcount - previous if previous is not None else ''
+ writer.writerow([date.strftime("%m/%d/%Y"), wordcount, diff])
+ previous = wordcount