Skip to content

Commit

Permalink
Add ICS calendar generator (#16)
Browse files Browse the repository at this point in the history
* Add generating ICS calendar

* Fix timezone

* Replace dependency that cant handle timezones with custom generator

* Replace let with const
  • Loading branch information
Adikso authored Dec 4, 2023
1 parent 4cf7087 commit 40798b4
Show file tree
Hide file tree
Showing 5 changed files with 2,450 additions and 15 deletions.
43 changes: 38 additions & 5 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
const { DateTime } = require("luxon");
const {DateTime} = require("luxon");
const ics = require("./plugins/ics");
const fs = require("fs");

const DEFAULT_START_TIME = {
hours: 18,
minutes: 15
}

const EVENT_COMMON = {
description: `Spotkanie koła KNCyber
Bieżące informacje i szczegóły na serwerze Discord koła lub stronie na Facebooku
https://www.facebook.com/KoloCyber
https://discord.com/invite/DjVypPcV8c`,
location: 'Wydział Elektroniki i Technik Informacyjnych Politechniki Warszawskiej'
}

let headers = [];
let calendarEvents = [];

module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({"static": "/"});
Expand All @@ -10,11 +27,11 @@ module.exports = function (eleventyConfig) {
headers = [];
});

eleventyConfig.addShortcode("event", function (date, description) {
eleventyConfig.addShortcode("event", function (date, description, extra = null) {
const currentDate = DateTime.local().setZone("Europe/Warsaw");
const parsedDate = DateTime.fromFormat(date, "yyyy-MM-dd", {
zone: 'Europe/Warsaw'
});
}).set(DEFAULT_START_TIME);

const isWinter = parsedDate.month >= 10 || parsedDate.month < 2;
const isFuture = currentDate < parsedDate;
Expand All @@ -30,7 +47,23 @@ module.exports = function (eleventyConfig) {
headers.push(header);
}

// Create ICS calendar event
calendarEvents.push({
title: description,
start: parsedDate,
end: parsedDate.plus({hours: 2}),
...EVENT_COMMON
});

const dateString = parsedDate.toFormat("dd/MM/yyyy");
return result + `- ${dateString} - ${description}`
})
return result + `- ${dateString} - ${description}` + (extra != null ? ` - ${extra}` : '')
});

eleventyConfig.on('eleventy.after', async ({dir}) => {
const icsContent = ics.generateICS(calendarEvents);

const writeStream = fs.createWriteStream(`./${dir.output}/calendar.ics`);
writeStream.write(icsContent);
writeStream.end();
});
};
15 changes: 8 additions & 7 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ layout: "layouts/post.njk"
- Thursdays 18:15 - everything else
- [Discord link](https://discord.gg/DjVypPcV8c)
- [Facebook page](https://www.facebook.com/KoloCyber)
- [ICS Calendar](/calendar.ics) (Subscribe URL in your calendar)

{% event "2023-11-30" "Wstęp do exploitacji binarnej part 1" %}
{% event "2023-11-16" "Przejmujemy system monitoringu" %}
Expand All @@ -25,14 +26,14 @@ layout: "layouts/post.njk"
{% event "2023-01-05" "Intro to Docker" %}
{% event "2022-12-08" "Intro to Vim" %}
{% event "2022-11-17" "Practical web hacking with burp and nmap" %}
{% event "2022-10-10" "Intro to Linux - [(terminal)](https://docs.google.com/presentation/d/1lUJG3ZeYpzkbV2AIr3Tb9Pf5dpYz7MOxmmbHANYckP4/edit?usp=sharing)" %}
{% event "2022-10-03" "Intro to Linux - [(ssh)](https://docs.google.com/presentation/d/17pdNQ7bMUJpsCE73hYcIy1UXxaqCriwTTp2xZXhgFR8/edit?usp=sharing)" %}
{% event "2022-06-07" "Cloud Security Academy: Reference Security Architecture in Google Cloud [(ISSA Polska feat. KNCyber)](https://www.elka.pw.edu.pl/Aktualnosci/Seminaria-wyklady-warsztaty/Cloud-Security)" %}
{% event "2022-10-10" "Intro to Linux" "[(terminal)](https://docs.google.com/presentation/d/1lUJG3ZeYpzkbV2AIr3Tb9Pf5dpYz7MOxmmbHANYckP4/edit?usp=sharing)" %}
{% event "2022-10-03" "Intro to Linux" "[(ssh)](https://docs.google.com/presentation/d/17pdNQ7bMUJpsCE73hYcIy1UXxaqCriwTTp2xZXhgFR8/edit?usp=sharing)" %}
{% event "2022-06-07" "Cloud Security Academy: Reference Security Architecture in Google Cloud" "[(ISSA Polska feat. KNCyber)](https://www.elka.pw.edu.pl/Aktualnosci/Seminaria-wyklady-warsztaty/Cloud-Security)" %}
{% event "2022-05-26" "Warsztat: Bezpieczne hostowanie aplikacji na dockerze" %}
{% event "2022-05-12" "IRL hacking with hardware 2" %}
{% event "2022-04-28" "IRL hacking with hardware" %}
{% event "2022-01-13" "Automating clusters of servers with ansible" %}
{% event "2021-12-21" "Christmas hacking CTF + presentation form [billtech](https://billtech.pl)" %}
{% event "2021-12-21" "Christmas hacking CTF + presentation form" "[billtech](https://billtech.pl)" %}
{% event "2021-12-16" "Having fun with Log4J - how to hack the internet" %}
{% event "2021-11-18" "AW CTF writeups" %}
{% event "2021-11-04" "Introduction to Science Club" %}
Expand All @@ -42,13 +43,13 @@ layout: "layouts/post.njk"
{% event "2021-04-26" "Web Exploitation (SQL injections) - workshop 3" %}
{% event "2021-04-20" "Docker - introduction to containerization" %}
{% event "2021-04-12" "Basic use of Python for request automation" %}
{% event "2021-04-06" "A few things about dynamic binary instrumentation - by [Redford](https://twitter.com/dsredford)" %}
{% event "2021-04-06" "A few things about dynamic binary instrumentation" "by [Redford](https://twitter.com/dsredford)" %}
{% event "2021-04-05" "Web Exploitation (SQL injections) - workshop 2" %}
{% event "2021-03-30" "How to decrypt ransomware, or die trying - by [msm](https://twitter.com/MsmCode)" %}
{% event "2021-03-30" "How to decrypt ransomware, or die trying" "by [msm](https://twitter.com/MsmCode)" %}
{% event "2021-03-29" "Web Exploitation (SQL injections) - workshop 1" %}
{% event "2021-03-23" "Introduction to Web Exploitation" %}
{% event "2021-03-09" "Introduction to Science Club" %}
{% event "2020-12-17" "Jak mogłem sterować polskim przemysłem? - by [dudekmar](https://twitter.com/dudekmar)" %}
{% event "2020-12-17" "Jak mogłem sterować polskim przemysłem?" "by [dudekmar](https://twitter.com/dudekmar)" %}
{% event "2020-12-14" "Web Exploitation - workshop 1" %}
{% event "2020-11-30" "Binary Exploitation - workshop 3" %}
{% event "2020-11-26" "Summary of project ideas" %}
Expand Down
Loading

0 comments on commit 40798b4

Please sign in to comment.