Last active
April 26, 2024 21:24
-
-
Save rkoopmann/02f441b9dc4d98e38c98b7453b63c7ab to your computer and use it in GitHub Desktop.
my Jekyll scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ../_events/ | |
dateList=$(jq -r '.[] | .[] | [.Date] | @tsv' ../_data/events/list.json | sort -u) | |
echo "Looking for missing event files." | |
for d in ${dateList}; do | |
y=$(echo "${d}" | cut -d- -f1) | |
f="${y}/${d}.md" | |
if [ ! -f "${f}" ]; then | |
echo "Adding event file for ${d}" | |
mkdir -p "${y}" | |
echo -n "--- | |
layout: event | |
title: TITLE-GOES-HERE | |
date: ${d} | |
tags: | |
- event | |
--- | |
" > "${f}" | |
bbedit "${f}" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd _data/events/ | |
jq '[reduce .Event[] as $item ({}; .[$item.Artist] += [$item.Date]) | map_values(unique) | to_entries | sort_by(.value | length) | reverse[] | {artist: .key, dates: .value}]' list.json > list-artists.json | |
jq '[reduce .Event[] as $item ({}; .[$item.Venue] += [$item.Date]) | map_values(unique) | to_entries | sort_by(.value | length) | reverse[] | {venue: .key, dates: .value}]' list.json > list-venues.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
output_file="events.ics" | |
echo "BEGIN:VCALENDAR | |
VERSION:2.0 | |
PRODID://EPOCHS//setlist | |
CALSCALE:GREGORIAN | |
X-WR-TIMEZONE:America/Chicago | |
X-WR-CALNAME:Setlist.fm | |
X-WR-CALDESC:Sourced from selist.fm export files | |
X-WR-RELCALID:8765309E-E4AC-4C2C-B9F1-FF78AB91DA97 | |
X-APPLE-CALENDAR-COLOR:#000080" > "${output_file}" | |
cat ../_data/events/{1,2}*.json | jq -r '. | | |
"BEGIN:VEVENT | |
UID:\(.id) | |
SUMMARY:\(.artist.name) | |
DTSTAMP;TZID=America/Chicago:\(.eventDate | split("-") | .[2] + .[1] + .[0])T200000 | |
DTSTART;VALUE=DATE:\(.eventDate | split("-") | .[2] + .[1] + .[0]) | |
DTEND;VALUE=DATE:\(.eventDate | split("-") | .[2] + .[1] + .[0]) | |
URL:\(.url) | |
LOCATION:\(.venue.name), \(.venue.city.name), \(.venue.city.stateCode) | |
GEO:\(.venue.city.coords.lat);\(.venue.city.coords.long) | |
DESCRIPTION:#\(.artist.name | gsub("[^A-Za-z0-9 ]"; "") | gsub(" "; "_")) #\(.venue.name | gsub("[^A-Za-z0-9 ]"; "") | gsub(" "; "_")) geo:\(.venue.city.coords.lat),\(.venue.city.coords.long) | |
END:VEVENT"' | sed "s/$/$CRLF/" >> "${output_file}" | |
echo "END:VCALENDAR" >> "${output_file}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "" > sitemap.yaml | |
for f in $(find . -type f -name "*.md"); do | |
# add new file marker | |
echo "- file: $f" >> sitemap.yaml | |
# append the indented frontmatter | |
sed -n '/^---$/,/^---$/p' "$f" \ | |
| sed '/^---$/d; s/^/ /g' \ | |
>> sitemap.yaml | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# clear any existing tag pages | |
rm -f tag-*.md | |
# fetch a distinct listing of tags being used | |
tagListing=$(yq '.[] | .tags[] | [.]' ../sitemap.yaml | sed 's/^- //g; s/ /-/g;' | sort -u) | |
# iterate over tags writing a tag page for each | |
IFS=$'\n\t' && for tag in ${tagListing}; do | |
echo "Refreshing ${tag}" | |
echo -n "--- | |
layout: tag_page | |
tag: ${tag} | |
permalink: /tag-${tag// /-}/ | |
--- | |
" > tag-${tag// /-}.md | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment