community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1658041 - in /comdev/projects.apache.org: scripts/cronjobs/countaccounts.py site/json/foundation/accounts.json
Date Sat, 07 Feb 2015 10:11:16 GMT
Author: humbedooh
Date: Sat Feb  7 10:11:16 2015
New Revision: 1658041

URL: http://svn.apache.org/r1658041
Log:
Add script for counting number of new accounts created each month plus historical data for
initial import.

Added:
    comdev/projects.apache.org/scripts/cronjobs/countaccounts.py
    comdev/projects.apache.org/site/json/foundation/accounts.json

Added: comdev/projects.apache.org/scripts/cronjobs/countaccounts.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/cronjobs/countaccounts.py?rev=1658041&view=auto
==============================================================================
--- comdev/projects.apache.org/scripts/cronjobs/countaccounts.py (added)
+++ comdev/projects.apache.org/scripts/cronjobs/countaccounts.py Sat Feb  7 10:11:16 2015
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import os
+import json;
+import re
+import sys
+from datetime import datetime
+import subprocess
+
+js = {}
+with open("../../site/json/foundation/accounts.json") as f:
+    js = json.loads(f.read())
+    f.close()
+
+currentMonth = datetime.now().month
+currentYear = datetime.now().year
+ym = "%04u-%02u" % (currentYear, currentMonth)
+tym = "%04u%02u" % (currentYear, currentMonth)
+print("Looking for entries for %s" % tym)
+js[ym] = 0
+
+proc = subprocess.Popen(['ldapsearch','-x', '-LLL', '-b', 'ou=people,dc=apache,dc=org', 'createTimestamp'],stdout=subprocess.PIPE)
+
+while True:
+    line = proc.stdout.readline()
+    if not line or line == "":
+        break
+    line = line.decode('utf-8')
+    m = re.search(r"createTimestamp: (\d\d\d\d\d\d)", line)
+    if m:
+        if m.group(1) == tym:
+            js[ym] += 1
+
+
+with open("../../site/json/foundation/accounts.json", "w") as f:
+    f.write(json.dumps(js))
+    f.close()
+    
+print("Done, found %u entries for this month" % js[ym])
\ No newline at end of file

Added: comdev/projects.apache.org/site/json/foundation/accounts.json
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/json/foundation/accounts.json?rev=1658041&view=auto
==============================================================================
--- comdev/projects.apache.org/site/json/foundation/accounts.json (added)
+++ comdev/projects.apache.org/site/json/foundation/accounts.json Sat Feb  7 10:11:16 2015
@@ -0,0 +1,146 @@
+{
+  "1999-02": 22,
+  "1999-10": 16,
+  "2000-04": 8,
+  "2000-11": 6,
+  "2001-05": 63,
+  "2001-07": 142,
+  "2001-10": 160,
+  "2002-06": 139,
+  "2003-03": 103,
+  "2003-12": 130,
+  "2004-01": 9,
+  "2004-02": 37,
+  "2004-03": 7,
+  "2004-04": 9,
+  "2004-05": 4,
+  "2004-06": 18,
+  "2004-07": 50,
+  "2004-08": 10,
+  "2004-09": 43,
+  "2004-10": 17,
+  "2004-11": 13,
+  "2004-12": 23,
+  "2005-01": 9,
+  "2005-02": 14,
+  "2005-03": 24,
+  "2005-04": 24,
+  "2005-05": 14,
+  "2005-06": 34,
+  "2005-07": 39,
+  "2005-08": 19,
+  "2005-09": 28,
+  "2005-10": 33,
+  "2005-11": 20,
+  "2005-12": 34,
+  "2006-01": 35,
+  "2006-02": 38,
+  "2006-03": 46,
+  "2006-04": 29,
+  "2006-05": 23,
+  "2006-06": 26,
+  "2006-07": 19,
+  "2006-08": 58,
+  "2006-09": 54,
+  "2006-10": 17,
+  "2006-11": 45,
+  "2006-12": 8,
+  "2007-01": 14,
+  "2007-02": 20,
+  "2007-03": 19,
+  "2007-04": 27,
+  "2007-05": 19,
+  "2007-06": 27,
+  "2007-07": 18,
+  "2007-08": 15,
+  "2007-09": 18,
+  "2007-10": 23,
+  "2007-11": 12,
+  "2007-12": 18,
+  "2008-01": 39,
+  "2008-02": 17,
+  "2008-03": 22,
+  "2008-04": 19,
+  "2008-05": 39,
+  "2008-06": 26,
+  "2008-07": 23,
+  "2008-08": 10,
+  "2008-09": 22,
+  "2008-10": 23,
+  "2008-11": 27,
+  "2008-12": 18,
+  "2009-01": 20,
+  "2009-02": 22,
+  "2009-03": 18,
+  "2009-04": 15,
+  "2009-05": 12,
+  "2009-06": 34,
+  "2009-07": 20,
+  "2009-08": 34,
+  "2009-09": 10,
+  "2009-10": 27,
+  "2009-11": 48,
+  "2009-12": 47,
+  "2010-01": 25,
+  "2010-02": 32,
+  "2010-03": 22,
+  "2010-04": 6,
+  "2010-05": 14,
+  "2010-06": 31,
+  "2010-07": 18,
+  "2010-08": 11,
+  "2010-09": 37,
+  "2010-10": 20,
+  "2010-11": 23,
+  "2010-12": 42,
+  "2011-01": 23,
+  "2011-02": 26,
+  "2011-03": 43,
+  "2011-04": 5,
+  "2011-05": 20,
+  "2011-06": 73,
+  "2011-07": 14,
+  "2011-08": 86,
+  "2011-09": 18,
+  "2011-10": 57,
+  "2011-11": 24,
+  "2011-12": 29,
+  "2012-01": 71,
+  "2012-02": 42,
+  "2012-03": 30,
+  "2012-04": 15,
+  "2012-05": 53,
+  "2012-06": 30,
+  "2012-07": 34,
+  "2012-08": 39,
+  "2012-09": 48,
+  "2012-10": 36,
+  "2012-11": 39,
+  "2012-12": 28,
+  "2013-01": 37,
+  "2013-02": 41,
+  "2013-03": 65,
+  "2013-04": 38,
+  "2013-05": 40,
+  "2013-06": 49,
+  "2013-07": 42,
+  "2013-08": 48,
+  "2013-09": 35,
+  "2013-10": 39,
+  "2013-11": 20,
+  "2013-12": 40,
+  "2014-01": 32,
+  "2014-02": 36,
+  "2014-03": 30,
+  "2014-04": 41,
+  "2014-05": 30,
+  "2014-06": 35,
+  "2014-07": 34,
+  "2014-08": 40,
+  "2014-09": 46,
+  "2014-10": 40,
+  "2014-11": 63,
+  "2014-12": 28,
+  "2015-01": 49,
+  "2015-02": 7
+}
\ No newline at end of file



Mime
View raw message