Skip to content

Instantly share code, notes, and snippets.

@juanfal
Last active February 16, 2026 06:03
Show Gist options
  • Select an option

  • Save juanfal/c71b92a92c03a7584958fb9cc32ff667 to your computer and use it in GitHub Desktop.

Select an option

Save juanfal/c71b92a92c03a7584958fb9cc32ff667 to your computer and use it in GitHub Desktop.
CAlendario laboral y festivo de Málaga (le he puesto yo!)El año se lo puedes pasar como argumento. La ciudad (Málaga es fácil de cambiar en el script por la que haga falta)
#!/bin/sh
# calendariolaboralaño.sh
# juanfal 2026-02-15
#https://gist.github.com/juanfal/c71b92a92c03a7584958fb9cc32ff667
cd ~/Desktop/
curryear=${1:-$(date +%Y)}
filename="calendario-laboral-malaga-${curryear}-PDF.pdf"
url="https://www.calendarioslaborales.com/${filename}"
wget -q --show-progress "$url" || {
echo "Error descargando $url"
exit 1
}
gs -q -o "cal${curryear}.pdf" \
-sDEVICE=pdfwrite \
-dBATCH -dNOPAUSE \
-dAutoRotatePages=/None \
-dPDFSETTINGS=/screen \
-dSubsetFonts=true -dEmbedAllFonts=false \
-c "<< /EndPage { 2 eq { pop false } { \
gsave \
% tapa (blanco)
1 1 1 setrgbcolor \
newpath 80 775 moveto 510 0 rlineto 0 100 rlineto -510 0 rlineto closepath fill \
% año (rojo), centrado en x=300
0.7 0.1 0.1 setrgbcolor \
/Helvetica-Bold findfont 36 scalefont setfont \
(${curryear}) dup stringwidth pop 2 div \
300 exch sub 800 moveto show \
% Helvetica con Latin1 para acentos
/Helvetica findfont dup length dict begin \
{1 index /FID ne {def} {pop pop} ifelse} forall \
/Encoding ISOLatin1Encoding def \
currentdict end \
/Helvetica-L1 exch definefont pop \
% Málaga (azul), centrado en x=300
0.0 0.45 0.65 setrgbcolor \
/Helvetica-L1 findfont 16 scalefont setfont \
(M\341laga) dup stringwidth pop 2 div \
300 exch sub 782 moveto show \
grestore \
true \
} ifelse } bind >> setpagedevice" \
-f "$filename"
open "cal${curryear}.pdf"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment