From cd942b97b062603af9e1569109a66bddf6b7fe9c Mon Sep 17 00:00:00 2001 From: James Shiffer Date: Thu, 20 Nov 2025 17:17:43 -0800 Subject: [PATCH] New event script, pages for past events --- content/events/alumni-night.md | 13 ++ content/events/spooky-e-waste-tour.md | 13 ++ content/events/surprise-server-room-tour.md | 13 ++ create_event.sh | 176 ++++++++++++++++++++ 4 files changed, 215 insertions(+) create mode 100644 content/events/alumni-night.md create mode 100644 content/events/spooky-e-waste-tour.md create mode 100644 content/events/surprise-server-room-tour.md create mode 100755 create_event.sh diff --git a/content/events/alumni-night.md b/content/events/alumni-night.md new file mode 100644 index 0000000..0ea7ff4 --- /dev/null +++ b/content/events/alumni-night.md @@ -0,0 +1,13 @@ +--- +title: "Alumni Night" +date: 2025-11-10 +tags: [events] +author: LUG Board +--- + +David Z., the man himself who revived UCLA LUG in 2022, who has worked at Tesla and Apple, is visiting from the Bay Area. You can ask him about UCLA LUG history, what distros he recommends, how Linux is used in industry, how to get internships, or just joke around. + +* **Date**: 2025-11-13 +* **Time**: 6-8 PM +* **Location**: Boelter Hall 4283 + diff --git a/content/events/spooky-e-waste-tour.md b/content/events/spooky-e-waste-tour.md new file mode 100644 index 0000000..2622729 --- /dev/null +++ b/content/events/spooky-e-waste-tour.md @@ -0,0 +1,13 @@ +--- +title: "Spooky E-Waste Tour 👻🎃" +date: 2025-10-29 +tags: [events] +author: LUG Board +--- + +It's like trick-or-treating except the goodies aren't edible. Costumes (or painted nails 💅) are highly encouraged. Meet by the compass statue at the fifth floor Boelter entrance. + +* **Date**: 2025-10-31 +* **Time**: 8-10 PM +* **Location**: Boelter Hall Main Entrance + diff --git a/content/events/surprise-server-room-tour.md b/content/events/surprise-server-room-tour.md new file mode 100644 index 0000000..07762ee --- /dev/null +++ b/content/events/surprise-server-room-tour.md @@ -0,0 +1,13 @@ +--- +title: "Surprise Server Room Tour 🎉" +date: 2025-11-20 +tags: [events] +author: LUG Board +--- + +We're inviting members of LUG for an exclusive look at the Boelter Hall server room, where we have our own rack and keep some spare e-waste as well. + +* **Date**: 2025-11-20 +* **Time**: 6-7 PM +* **Location**: Boelter Hall 3292 + diff --git a/create_event.sh b/create_event.sh new file mode 100755 index 0000000..f76574e --- /dev/null +++ b/create_event.sh @@ -0,0 +1,176 @@ +#!/bin/bash + +# Function to prompt for input with a default value +prompt() { + local prompt_text="$1" + local default_val="$2" + local var_name="$3" + + if [ -n "$default_val" ]; then + read -p "$prompt_text [$default_val]: " input + eval $var_name="\${input:-$default_val}" + else + read -p "$prompt_text: " input + eval $var_name="\$input" + fi +} + +# --- 1. Gather Event Details --- +echo "--- New Event Wizard ---" +prompt "Event Name" "" EVENT_NAME +prompt "Date (YYYY-MM-DD)" "$(date +%Y-%m-%d)" EVENT_DATE +prompt "Time (e.g. 6-9 PM)" "6-9 PM" EVENT_TIME +prompt "Location" "Engineering IV, Maxwell Room (57-124)" EVENT_LOCATION +prompt "Ping Preference (1: @everyone, 2: @UCLA, 3: None)" "3" PING_CHOICE + +case $PING_CHOICE in + 1) PING_TEXT="@everyone" ;; + 2) PING_TEXT="<@&1000205372327481444>" ;; # Assuming @UCLA role ID, replace if known or use generic + *) PING_TEXT="" ;; +esac + +echo "Enter Description (Markdown supported). Press Ctrl+D on a new line to finish:" +EVENT_DESCRIPTION=$(cat) +echo "" # Add newline after input + +# Slugify event name for filename +SLUG=$(echo "$EVENT_NAME" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) +FILENAME="content/events/${SLUG}.md" + +# --- 2. Generate Hugo Content --- +echo "Generating $FILENAME..." + +cat < "$FILENAME" +--- +title: "$EVENT_NAME" +date: $(date +%Y-%m-%d) +tags: [events] +author: LUG Board +--- + +$EVENT_DESCRIPTION + +* **Date**: $EVENT_DATE +* **Time**: $EVENT_TIME +* **Location**: $EVENT_LOCATION + +EOF + +echo "Hugo page created." + +# --- 3. Discord Notification (Webhook) --- +# Check for env var or prompt +if [ -z "$DISCORD_WEBHOOK_URL" ]; then + prompt "Enter Discord Webhook URL (leave empty to skip)" "" DISCORD_WEBHOOK_URL +fi + +if [ -n "$DISCORD_WEBHOOK_URL" ]; then + echo "Sending Discord announcement..." + + # Construct JSON payload + # Note: Using jq would be safer, but manual construction avoids dependencies if simple + # Escaping quotes in description for JSON + SAFE_DESC=$(echo "$EVENT_DESCRIPTION" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + + JSON_PAYLOAD=$(cat < "18:00" + # This is a simplification. For robust parsing, might need python or date utils. + + # Extract start hour and minute + START_HOUR=$(echo "$EVENT_TIME" | grep -oE '^[0-9]+' | head -1) + START_MINUTE=$(echo "$EVENT_TIME" | grep -oE ':[0-9]+' | sed 's/://' | head -1) + START_MINUTE=${START_MINUTE:-00} + + if [[ "$EVENT_TIME" == *"PM"* ]] && [ "$START_HOUR" -lt 12 ]; then + START_HOUR=$((START_HOUR + 12)) + fi + + # Construct ISO string with timezone using date command + START_DATE_STR="$EVENT_DATE $START_HOUR:$START_MINUTE" + START_ISO=$(date -d "$START_DATE_STR" --iso-8601=seconds) + + # End time: Start + 2 hours + # Use START_ISO as base to ensure correct calculation + END_ISO=$(date -d "$START_ISO + 2 hours" --iso-8601=seconds) + + # Location Type 3 is "External" + CAL_PAYLOAD=$(cat <