Last active
April 13, 2016 20:36
-
-
Save hacosta/5d71ef77660f54aa1fe41b25ac9232f1 to your computer and use it in GitHub Desktop.
This file contains 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/python2 | |
from __future__ import division | |
from datetime import date | |
import re | |
with open('/var/log/pacman.log') as f: | |
first = f.readline() | |
y, m, d = [int(c, 10) for c in first[1:11].split('-')] | |
days = (date.today() - date(y, m, d)).days | |
print('days since install %d' % days) | |
syutimes = len(re.findall(r'pacman -Syu', f.read())) | |
print('pacman -Syu ran: %d times' % syutimes) | |
print(syutimes / days) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now with 100% more output