From 8cb2975d93d19a7ad1abc1f735799d93b82c56de Mon Sep 17 00:00:00 2001 From: andwati <56686898+andwati@users.noreply.github.com> Date: Thu, 8 May 2025 17:22:08 +0300 Subject: [PATCH] added shell script for new post --- _posts/2025-05-08-bitsiege-ctf-writeup.md | 6 +++++ scripts/newpost.sh | 29 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 _posts/2025-05-08-bitsiege-ctf-writeup.md create mode 100755 scripts/newpost.sh diff --git a/_posts/2025-05-08-bitsiege-ctf-writeup.md b/_posts/2025-05-08-bitsiege-ctf-writeup.md new file mode 100644 index 0000000..8e5142b --- /dev/null +++ b/_posts/2025-05-08-bitsiege-ctf-writeup.md @@ -0,0 +1,6 @@ +--- +title: "Bitsiege Ctf Writeup" +description: "" +date: 2025-05-08 +0300 +tags: [] +--- diff --git a/scripts/newpost.sh b/scripts/newpost.sh new file mode 100755 index 0000000..6099d61 --- /dev/null +++ b/scripts/newpost.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Check if a title argument was passed +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Get the current date +DATE=$(date +"%Y-%m-%d") +TIMEZONE="+0300" +TITLE_SLUG="$1" +FILENAME="${DATE}-${TITLE_SLUG}.md" +POST_PATH="_posts/${FILENAME}" + +# Convert slugified title to a proper title +TITLE=$(echo "$TITLE_SLUG" | sed 's/-/ /g' | sed -E 's/\b(.)/\U\1/g') + +# Create the post file with frontmatter +cat < "$POST_PATH" +--- +title: "${TITLE}" +description: "" +date: ${DATE} ${TIMEZONE} +tags: [] +--- +EOF + +echo "New post created at $POST_PATH"