# HG changeset patch # User Windel Bouwman # Date 1357990502 -3600 # Node ID 347d7d8b96c06217ebfd07095aa8827b02413924 # Parent bb08633510bf801cbd9c85973301e0c0b7b845ca Cleanup diff -r bb08633510bf -r 347d7d8b96c0 python/repostats.py2 --- a/python/repostats.py2 Sat Jan 12 10:56:12 2013 +0100 +++ b/python/repostats.py2 Sat Jan 12 12:35:02 2013 +0100 @@ -1,6 +1,8 @@ #!/usr/bin/python2 from mercurial import ui, hg +import numpy +import matplotlib.pyplot as plt import datetime u = ui.ui() @@ -8,14 +10,41 @@ stamps = [] nds = repo.changelog.nodesbetween() -print len(nds), nds for hexid in nds[0]: cset = repo.changelog.read(hexid) - print cset - ts = cset[2][0] - stamps.append(ts) + stamps.append(cset[2][0]) -print len(stamps) dts = [datetime.datetime.fromtimestamp(st) for st in stamps] print dts +stats = numpy.zeros( (7, 24) ) + +for dt in dts: + d = dt.weekday() + h = dt.hour + stats[d][h] += 1 + +print stats +def enclose(tag, content, options=''): + return '<{0} {2}>\n{1}\n'.format(tag, content, options) +def merge(*args): + print(args) + return '\n'.join(args) + +head = enclose('head', enclose('title', 'repo stats')) + +r1 = [enclose('td', td) for td in ['','Monday','Tuesday', 'Wed', 'Thur', 'Friday', 'S', 'S']] +r1 = enclose('tr', merge(*r1)) + +tc = merge(r1) + +table = enclose('table', tc, options='border="2"') +body = enclose('body', enclose('h1', 'repo stats') + table) +html = enclose('html', head + body) + +#with open('repostats.html', 'w') as f: +# f.write(html) + +plt.scatter(stats) +plt.show() + diff -r bb08633510bf -r 347d7d8b96c0 python/stlink.py --- a/python/stlink.py Sat Jan 12 10:56:12 2013 +0100 +++ b/python/stlink.py Sat Jan 12 12:35:02 2013 +0100 @@ -64,27 +64,6 @@ FLASH_F4_CR_SNB_MASK = 0x38 FLASH_F4_SR_BSY = 16 -# flashloaders/stm32f4.s -loader_code_stm32f4 = bytes([ - 0x07, 0x4b, - - 0x62, 0xb1, - 0x04, 0x68, - 0x0c, 0x60, - - 0xdc, 0x89, - 0x14, 0xf0, 0x01, 0x0f, - 0xfb, 0xd1, - 0x00, 0xf1, 0x04, 0x00, - 0x01, 0xf1, 0x04, 0x01, - 0xa2, 0xf1, 0x01, 0x02, - 0xf1, 0xe7, - - 0x00, 0xbe, - - 0x00, 0x3c, 0x02, 0x40 -]) - def calculate_F4_sector(address): """ from 0x8000000 to 0x80FFFFF @@ -110,7 +89,6 @@ sectors = [] while off < size: sectornum, sectorsize = calculate_F4_sector(address + off) - #print('num: {0} size: {1:X} offset: {2}'.format(sectornum, sectorsize, off)) sectors.append((sectornum, sectorsize)) off += sectorsize return sectors