#! /usr/bin/env python3
import datetime
import os
import shutil
import subprocess
def run(*args):
subprocess.call(args)
def main():
time = datetime.datetime.now()
time_id = time.strftime('%Y%m%d%H%M%S')
style = 'css'
script = 'js'
root = os.path.dirname(os.path.realpath(__file__))
input_directory = os.path.join(root, 'in')
out = os.path.join(root, 'out')
web = os.path.join(out, 'web')
if os.path.exists(web):
shutil.rmtree(web)
os.makedirs(web)
gen = os.path.join(web, time_id)
css = os.path.join(gen, style)
js = os.path.join(gen, script)
#
run('rsync', '--archive', f'{input_directory}/', f'{web}/')
for directory in [css, js]:
os.makedirs(directory)
#
link_gv = os.path.join(root, 'link.gv')
link_svg = os.path.join(gen, 'link.svg')
run('dot', link_gv, '-Tsvg', '-o', link_svg)
with open(link_svg, 'br') as f:
link_text = f.read().decode('u8')
page_file = os.path.join(web, 'index.html')
page_text = f'''\
Marc Beninca
Last update: {time.strftime('%Y/%m/%d %H:%M:%S')}
'''
css_file = os.path.join(css, 'index.css')
css_text = f'''\
@media screen and (max-aspect-ratio: 10/16) {{
body {{
font-size: 2em;
}}
}}
body {{
background: rgb(255,255,255);
color: rgb(0,0,0);
font-family: sans;
margin: .5em;
}}
body.dark {{
background: rgb(0,0,0);
color: rgb(160,160,160);
}}
header {{
background-image: url("../img/debian.jpeg");
background-position: center;
background-size: cover;
display: flex;
flex-wrap: wrap;
}}
.tabs {{
display: flex;
flex-wrap: wrap;
}}
.tabs .tabs {{
padding: .5em 0 0 0;
}}
.tabs > input {{
display: none;
}}
.tabs > input:checked + label + div {{
display: block;
}}
.tabs > label {{
order: 1;
}}
.tabs > div {{
display: none;
flex-basis: 100%;
order: 2;
}}
.tabs {{
margin: 0;
}}
.tabs > input:checked + label {{
background: linear-gradient(rgba(128,128,128,1), rgba(128,128,128,0));
}}
.tabs > label {{
background: linear-gradient(rgba(64,64,64,1), rgba(64,64,64,0));
border-color: rgb(128,128,128);
border-radius: .5em;
border-style: solid;
border-width: 1px 1px 0 1px;
font-weight: bold;
margin: 0;
padding: .5em 1.5em;
}}
.tabs > label:hover {{
background: linear-gradient(rgba(64,64,64,0), rgba(64,64,64,1));
color: rgb(192,0,0);
}}
.tabs > div {{
margin: 0;
}}
a {{
color: rgb(0,192,192);
text-decoration: none;
}}
a:hover {{
color: rgb(192,0,0);
}}
a:visited {{
color: rgb(0,160,160);
}}
img {{
border: 1px solid;
border-color: rgb(192,192,192);
border-radius: 1em;
height: 8em;
}}
table {{
empty-cells: hide;
}}
th,td {{
border-radius: .2em;
}}
th:hover,td:hover {{
background: rgb(48,0,0);
}}
th {{
background: rgb(64,64,64);
color: rgb(128,128,0);
}}
td {{
background: rgb(48,48,48);
border: 1px solid;
border-color: rgb(192,192,192);
text-align: center;
}}
.cards {{
display: flex;
}}
.card {{
list-style: none;
margin: 0 1em;
text-align: center;
}}
.card img {{
border: none;
height: 3em;
}}
.debug {{
border-color: rgb(255,0,255);
border-style: solid;
border-width: 1px;
}}
'''
js_file = os.path.join(js, 'index.js')
js_text = f'''\
function check(tab) {{
const tabs = tab.split('/')
let id = 'tab'
let element
for (tab of tabs) {{
id = `${{id}}/${{tab}}`
element = document.getElementById(id)
if (element) {{
element.checked = true
}}
}}
}}
function debug() {{
for (element of document.getElementsByTagName('*')) {{
element.classList.toggle('debug')
}}
}}
function push(tab) {{
window.history.pushState(null, null, `?tab=${{tab}}`)
}}
function update(id) {{
const tab = id.split('/').slice(1).join('/')
push(tab)
}}
function main() {{
let tab = (new URL(document.location)).searchParams.get('tab')
if (tab) {{
check(tab)
}} else {{
tab = 'my/profiles'
check(tab)
push(tab)
}}
const dark = document.getElementById('dark')
if (dark) {{
dark.click()
}}
}}
function swap() {{
document.body.classList.toggle('dark')
}}
'''
# {link_text}
with open(page_file, 'bw') as f:
f.write(page_text.encode('u8'))
with open(css_file, 'bw') as f:
f.write(css_text.encode('u8'))
with open(js_file, 'bw') as f:
f.write(js_text.encode('u8'))
tabs = {
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'about': f'''\
About…
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'bio': f'''\
Marc Beninca
Welcome to a recap attempt of my IT life!
The early days
In my primary school days I started to interact with computers at home,
mainly Amstrad CPC 464 & 6128 machines.
It was the occasion for me to:
discover computer architectures
learn how to program in BASIC
suffer the noise and speed of tape recorders
experience the revolution of floppy disks transfer rates
Diving in
Right before beginning high school, I was introduced to the PC platform.
The “system programming PC bible” was my reference for a long time.
I had the occasion to develop projects in:
Pascal (for example my own hexadecimal file editor)
Assembly (mainly for critical subroutines performance)
AutoLISP (automation in LISP of AutoCAD elements processing)
To be continued…
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'books': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'buy': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'comments': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'cv': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'repos': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'health': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'id': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'learn': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'links': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'music': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'profiles': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'lsgm': f'''\
Live Scan Grub Menu
Setup a whole EFI System Partition:
generate customized GRUB EFI & BIOS images
scan data partition(s) for SquashFS image files
display generated boot menu
live boot selected kernel, initial ramdisk and file system image
BASH experimenting:
''',
'ofsp': f'''\
Operating File System Profile
Build from mirror a full operating system bootable file image:
bootstrap base file system
configure common core basics
install TUI packages
install GUI packages
copy kernel and initial ramdisk for bootloader
archive final file system as SquashFS file
BASH experimenting:
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'social': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'software': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'style': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'tasks': f'''\
fix dark switch
style list items
switch fonts
use CSS variables
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'tbm': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'trips': f'''\
Belgium
Estonia
Lahemaa
Narva
Pärnu
Saaremaa
Tallinn
Tartu
Germany
Japan
Hiroshima
Kyoto
Okinawa
Osaka
Tokyo
Netherlands
Switzerland
United States of America
California
Los Angeles
San Francisco
Georgia
Hawaii
Indiana
Kentucky
New York
Ohio
Tennessee
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'vegan': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'others': f'''\
''',
#⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
'unsorted': f'''\
''',
}
if __name__ == '__main__':
main()