Skip to content

Instantly share code, notes, and snippets.

View welpo's full-sized avatar
🌱

Óscar welpo

🌱
View GitHub Profile
@welpo
welpo / pre-commit
Last active July 10, 2024 23:33
git pre-commit script to update the date of Zola's posts
#!/usr/bin/env bash
# Requires Bash 4.0 or newer.
# This script updates the 'updated' field in the front matter of modified .md
# files setting it to their last modified date.
# Function to exit the script with an error message.
function error_exit() {
echo "ERROR: $1" >&2
exit "${2:-1}"
@welpo
welpo / pre-commit
Last active July 10, 2024 23:34
git pre-commit script to update the date of Zola's posts and compress png files
#!/usr/bin/env bash
# Requires Bash 4.0 or newer.
# This script updates the 'updated' field in the front matter of modified .md
# files setting it to their last modified date.
# It also compresses PNG files with either oxipng or optipng if available.
# Function to exit the script with an error message.
function error_exit() {
echo "ERROR: $1" >&2