dot_testing/builds/archutils/generate_daily_brief

119 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/sh
working_directory=$(date +%Y-%m-%d)
human_readable=$(date "+%d %b %Y")
cd ~/doc/briefs/
mkdir "$working_directory"
cd "$working_directory"
cat > main.tex <<EOF
\documentclass[oneside]{article}
\usepackage{amssymb}
2024-08-26 20:00:30 -05:00
\usepackage[left=1.5cm, right=1.5cm, top=1.5cm, bottom=1.5cm]{geometry}
\pagenumbering{gobble}
\begin{document}
\noindent {\Large Ryan Marina} \hspace{\fill} {\Large Briefing for $human_readable}
\noindent \textsc{Internal Document System} \hspace{\fill} $ \square $ \textit{scanned?} $ \square $ \textit{not scanned?}
\noindent \textit{Digital Archive Supplement} \hspace{\fill} internal notes: \rule{3cm}{0.4pt}
\noindent \texttt{iref:doc/briefs/$working_directory}
\vspace{0.4cm}
\noindent \textsc{Schedule}
\vspace{-0.30cm}
2024-08-26 20:00:30 -05:00
\noindent \rule{\textwidth}{0.4pt}
EOF
schedule=$(
2024-08-26 20:00:30 -05:00
khal list today today --format "{calendar}|{categories}|{start-time}|{end-time}|{title}" |
grep -E '^home\|school\||band\|'
)
IFS='
'
for class in $schedule; do
echo "$class" |
awk -F'|' '{
2024-08-26 20:00:30 -05:00
print "\\noindent " $5 " \\hspace{\\fill} \\textit{(" $3 "-" $4 ")}\n\n"
}' >> main.tex
done
cat >> main.tex <<EOF
\vspace{0.4cm}
\noindent \textsc{Unresolved Items}
\vspace{-0.30cm}
2024-08-26 20:00:30 -05:00
\noindent \rule{\textwidth}{0.4pt}
EOF
todo_items=$(
todo --porcelain |
jq -r '.[].summary'
)
IFS='
'
for todo in $todo_items; do
printf '\\noindent $ \\square $ %s\n\n' "$todo" >> main.tex
done
cat >> main.tex <<EOF
\vspace{0.4cm}
2024-08-26 20:00:30 -05:00
EOF
# generate notices
ssh netbox df -h |
grep /dev/vda3 |
awk -F' ' '{print "\\item \\texttt{" $1 "} on \\texttt{netbox} is at " $5 " utilization."}' |
sed 's/\%/\\%/g' > notices.tex
if [ -f notices.tex ]; then
cat >> main.tex <<EOF
\noindent \textsc{Procedural Notices}
\vspace{-0.30cm}
\noindent \rule{\textwidth}{0.4pt}
\begin{enumerate}
\input{notices}
\end{enumerate}
\vspace{0.4cm}
EOF
fi
cat >> main.tex <<EOF
\noindent \textsc{Items to be Appended to the Agenda}
\vspace{-0.30cm}
2024-08-26 20:00:30 -05:00
\noindent \rule{\textwidth}{0.4pt}
\end{document}
EOF
pdflatex main.tex
printf "[!] briefing generated\n"
printf "file:///home/usr/doc/briefs/%s/main.pdf\n" "$working_directory"