cal_gen: make runable as a script
template: improve the layout