forked from Coldcard/wordlist-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
html-worksheet.py
57 lines (49 loc) · 1.85 KB
/
html-worksheet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Failed attempt at using HTML to show a table.
#
# - do not use
# - particularly bad because ultimately we need this printed on paper
# - don't be distracted by how close I got
#
def worksheet(count=5):
with open('worksheet.html', 'wt') as fd:
P = lambda *a: print(*a, file=fd)
P('''
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css">
<style>
td { text-align: center; }
td.R { text-align: right; }
td.L { text-align: left; }
#bb {
transform: rotate(90deg) translate(33%, 0%);
}
</style>
<body>
<div id="bb" class="pure-g">
<div class="pure-u-1">
''')
P('<h2>XOR Seed Worksheet</h2>\n')
P('<table class="pure-table pure-table-bordered"><tbody>')
for c in range(count):
dig = chr(65+c)
P(f'<tr class="pure-table-odd"><td rowspan=3>{dig}<td class=R>Word #' + ''.join(f'<td colspan=3>{n+1}' for n in range(24)))
P('<tr><td class=R>Word' + ''.join(f'<td colspan=3>' for n in range(24)))
P('<tr><td class=R>Hex Digit' + ''.join(f'<td> ' for n in range(24*3)))
if c:
if c == 1:
here = 'A'
elif c > 2:
here = '...'
else:
here = '(' + '⊕'.join('%X' % (z+10-1) for z in range(1, c+1)) + ')'
P(f'<tr><td colspan=2 class=R>{here}⊕{dig}'
+ ''.join(f'<td> ' for n in range((24*3)-2)) + '<td>X<td>X')
if c in {2, 5}:
if c == 2:
m = 'sane people stop here'
else:
m = 'please stop, this hurts'
P(f'<tr class="pure-table-odd"><td colspan=2><td colspan=99 class=L><em>{m}</em>')
P('</table>')
worksheet()