Compare commits

...

4 Commits

Author SHA1 Message Date
ff4cb0ec8c Fix line endings in post-push hook 2025-10-27 13:03:35 +01:00
10048e7611 Add LaTeX compilation and post-push sync hooks
- Update pre-commit hook to compile cv.tex and cv_de.tex before generating webp
- Add post-push hook to rsync PDFs to bocken.org:/var/www/static/
- Update documentation with new hook requirements and functionality
2025-10-27 13:01:45 +01:00
9cec37d7ea Add tracked Git hooks and refactor timeline arrows
- Add .githooks directory with pre-commit hook for cv.webp generation
- Create installation script for hooks setup
- Add documentation for hooks usage
- Refactor timeline arrows into reusable commands (\timelinearrow and \timelinearrowcontinue)
- Simplify arrow usage by only requiring length parameter
2025-10-27 12:58:04 +01:00
091aeb4798 refactor out timelinearrow 2025-10-27 12:55:21 +01:00
7 changed files with 247 additions and 18 deletions

46
.githooks/README.md Normal file
View File

@@ -0,0 +1,46 @@
# Git Hooks
This directory contains Git hooks for the CV project.
## Installation
To install the hooks, run:
```bash
.githooks/install-hooks.sh
```
Or, configure Git to use this directory for hooks (Git 2.9+):
```bash
git config core.hooksPath .githooks
```
## Available Hooks
### pre-commit
Automatically compiles LaTeX files and generates WebP preview image.
**Requirements:**
- `pdflatex` (from TeX Live or similar LaTeX distribution)
- `pdftoppm` (from poppler-utils)
- `magick` (ImageMagick)
The hook will:
1. Compile `cv.tex` and `cv_de.tex` to PDF if they've been modified or staged
2. Convert the first page of `cv.pdf` to a WebP image
3. Save it as `img/cv.webp`
4. Add the generated image to the commit
### post-push
Automatically syncs compiled PDFs to bocken.org after pushing.
**Requirements:**
- `rsync`
- SSH access to `root@bocken.org`
The hook will:
1. Upload `cv.pdf` to `root@bocken.org:/var/www/static/`
2. Upload `cv_de.pdf` to `root@bocken.org:/var/www/static/` (if exists)

30
.githooks/install-hooks.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# Install git hooks from .githooks directory
HOOKS_DIR=".githooks"
GIT_HOOKS_DIR=".git/hooks"
# Ensure .git/hooks directory exists
if [ ! -d "$GIT_HOOKS_DIR" ]; then
echo "Error: .git/hooks directory not found. Are you in a git repository?"
exit 1
fi
# Copy all hooks from .githooks to .git/hooks
for hook in "$HOOKS_DIR"/*; do
# Skip this installation script
if [ "$(basename "$hook")" = "install-hooks.sh" ] || [ "$(basename "$hook")" = "README.md" ]; then
continue
fi
if [ -f "$hook" ]; then
hook_name=$(basename "$hook")
echo "Installing $hook_name..."
cp "$hook" "$GIT_HOOKS_DIR/$hook_name"
chmod +x "$GIT_HOOKS_DIR/$hook_name"
echo "$hook_name installed"
fi
done
echo ""
echo "All hooks installed successfully!"

38
.githooks/post-push Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# Post-push hook to rsync CV PDFs to bocken.org
set -e
echo "==== Syncing PDFs to bocken.org ===="
# Check if PDFs exist
if [ ! -f "cv.pdf" ]; then
echo "Warning: cv.pdf not found, skipping sync"
exit 0
fi
# Rsync cv.pdf
echo "Uploading cv.pdf..."
if rsync -avz --progress cv.pdf root@bocken.org:/var/www/static/; then
echo "✓ cv.pdf synced successfully"
else
echo "✗ Failed to sync cv.pdf"
exit 1
fi
# Rsync cv_de.pdf if it exists
if [ -f "cv_de.pdf" ]; then
echo "Uploading cv_de.pdf..."
if rsync -avz --progress cv_de.pdf root@bocken.org:/var/www/static/; then
echo "✓ cv_de.pdf synced successfully"
else
echo "✗ Failed to sync cv_de.pdf"
exit 1
fi
fi
echo ""
echo "==== Sync complete ===="
exit 0

87
.githooks/pre-commit Executable file
View File

@@ -0,0 +1,87 @@
#!/bin/bash
# Pre-commit hook to compile LaTeX files and generate cv.webp
set -e # Exit on error
# Function to compile LaTeX file
compile_latex() {
local texfile=$1
local pdffile="${texfile%.tex}.pdf"
echo "Compiling $texfile..."
# Run pdflatex twice to resolve references
pdflatex -interaction=nonstopmode "$texfile" > /tmp/latex_output.log 2>&1
pdflatex -interaction=nonstopmode "$texfile" > /tmp/latex_output.log 2>&1
# Check if PDF was created successfully (ignore exit code as warnings cause non-zero)
if [ -f "$pdffile" ]; then
echo "✓ Successfully compiled $pdffile"
return 0
else
echo "✗ Failed to compile $texfile"
echo "See /tmp/latex_output.log for details"
return 1
fi
}
# Function to generate webp from PDF
generate_webp() {
local pdffile=$1
echo "Generating cv.webp from $pdffile..."
# Use pdftoppm to convert first page to PNG, then ImageMagick to convert to WebP
pdftoppm -png -f 1 -l 1 -singlefile "$pdffile" temp_cv && \
magick temp_cv.png -quality 85 img/cv.webp && \
rm -f temp_cv.png
if [ $? -eq 0 ]; then
echo "✓ Successfully generated img/cv.webp"
git add img/cv.webp
return 0
else
echo "✗ Failed to generate cv.webp"
return 1
fi
}
# Check if .tex files are staged or modified
if git diff --cached --name-only | grep -qE "^cv(_de)?\.tex$" || \
[ -f "cv.tex" -a "cv.tex" -nt "cv.pdf" ] || \
[ -f "cv_de.tex" -a "cv_de.tex" -nt "cv_de.pdf" ]; then
echo "==== Compiling LaTeX files ===="
# Compile cv.tex if it exists and is newer than PDF or staged
if [ -f "cv.tex" ]; then
if [ ! -f "cv.pdf" ] || [ "cv.tex" -nt "cv.pdf" ] || \
git diff --cached --name-only | grep -q "^cv\.tex$"; then
compile_latex "cv.tex" || exit 1
fi
fi
# Compile cv_de.tex if it exists and is newer than PDF or staged
if [ -f "cv_de.tex" ]; then
if [ ! -f "cv_de.pdf" ] || [ "cv_de.tex" -nt "cv_de.pdf" ] || \
git diff --cached --name-only | grep -q "^cv_de\.tex$"; then
compile_latex "cv_de.tex" || exit 1
fi
fi
echo ""
fi
# Generate cv.webp from cv.pdf
if [ -f "cv.pdf" ]; then
if [ ! -f "img/cv.webp" ] || [ "cv.pdf" -nt "img/cv.webp" ]; then
echo "==== Generating WebP image ===="
generate_webp "cv.pdf" || exit 1
fi
fi
echo ""
echo "==== Pre-commit checks complete ===="
exit 0

32
cv.tex
View File

@@ -443,6 +443,26 @@
\end{center}
}
%---------------------------------------------------------------------------------------
% TIMELINE ARROW
%----------------------------------------------------------------------------------------
% Renders a timeline arrow for CV sections
% param 1: length of the arrow (e.g., -19em, -39em, etc.)
\newcommand{\timelinearrow}[1] {
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, #1) -- (0.1375em, 0.7em);
\end{tikzpicture}
}
% Renders a timeline arrow continuation (without arrow head)
% param 1: length of the arrow (e.g., -10.5em, -18.5em, etc.)
\newcommand{\timelinearrowcontinue}[1] {
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, #1) -- (0.1375em, 0.7em);
\end{tikzpicture}
}
%=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
% EDIT AFTER THIS POINT
@@ -603,9 +623,7 @@
\cvsectionspaced{Education}
\vspace{-1.5em}
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -19em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrow{-19.5em}
\cvevent
{\textbf{2022 - Jan 2025}}
@@ -671,9 +689,7 @@
\cvsectionspaced{Work Experience}
\vspace{-1.5em}
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -39em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrow{-39em}
\cveventdetailed{\textbf{2025 Feb - to date}}
{Associate Consultant Cyber Security \& Privacy}
@@ -708,9 +724,7 @@
\pagebreak
% Draw timeline arrow continuation for second page
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -10.5em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrowcontinue{-10.5em}
\cvevent
{\textbf{2024 Apr - Sep}}

View File

@@ -443,6 +443,26 @@
\end{center}
}
%---------------------------------------------------------------------------------------
% TIMELINE ARROW
%----------------------------------------------------------------------------------------
% Renders a timeline arrow for CV sections
% param 1: length of the arrow (e.g., -19em, -39em, etc.)
\newcommand{\timelinearrow}[1] {
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, #1) -- (0.1375em, 0.7em);
\end{tikzpicture}
}
% Renders a timeline arrow continuation (without arrow head)
% param 1: length of the arrow (e.g., -10.5em, -18.5em, etc.)
\newcommand{\timelinearrowcontinue}[1] {
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, #1) -- (0.1375em, 0.7em);
\end{tikzpicture}
}
%=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
% EDIT AFTER THIS POINT
@@ -603,9 +623,7 @@
\cvsectionspaced{Ausbildung}
\vspace{-1.5em}
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -20.5em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrow{-20.5em}
\cvevent
{\textbf{2022 - Jan 2025}}
@@ -671,9 +689,7 @@
\cvsectionspaced{Berufserfahrung}
\vspace{-1.5em}
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-to, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -37em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrow{-37em}
\cveventdetailed{\textbf{Feb 2025 - heute}}
{Associate Consultant Cyber Security \& Privacy}
@@ -703,9 +719,7 @@
\pagebreak
% Draw timeline arrow continuation for second page
\begin{tikzpicture}[remember picture, overlay, xshift=-0.5em]
\draw[-, line width=0.275em, rounded corners=10pt, line cap=round, maincol] (0.1375em, -18.5em) -- (0.1375em, 0.7em);
\end{tikzpicture}
\timelinearrowcontinue{-18.5em}
\cvsubpoint{Unternehmensentwicklung \& Interne Führung}{
\item Leite monatliche Wissensaustauschforen für 30-köpfiges Cybersecurity-Team, organisiere Referenten zu neuen Themen und erleichtere bereichsübergreifenden Wissenstransfer

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 288 KiB