summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Stensgård <mastensg@mastensg.net>2025-04-18 18:06:33 +0200
committerMartin Stensgård <mastensg@mastensg.net>2025-04-18 18:06:33 +0200
commit6888113d42ba2e1e4c0690e82e61092872cdffb3 (patch)
treec4e55e435534829b39b022f0576e7561355b7813
parent156827816395ff0ccf9535f502c6d80736244c41 (diff)
check_ical: parse events
-rw-r--r--.gitignore3
-rw-r--r--Makefile16
-rw-r--r--check_ical.c52
-rw-r--r--check_ical_ans.txt10
-rw-r--r--check_ical_in.ical300
5 files changed, 377 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 1825f47..4c3ad24 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
*.swp
+/check_ical
+/check_ical_out.txt
/opplysning
+core
diff --git a/Makefile b/Makefile
index 8792f2e..d172224 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,24 @@
.POSIX:
CFLAGS = -Wall -Wextra -pedantic -O2 -g
+LIBS = -lraylib -lm -lpthread -lGLESv2 -lEGL \
+ -lical -licalss -licalvcal \
+ $$([ `uname -m` = aarch64 ] && echo '-lvcos -lvchiq_arm -lgbm -ldrm')
+
+all: check_ical opplysning
-all: opplysning
+check: all
+ ./check_ical < check_ical_in.ical > check_ical_out.txt
+ diff -u check_ical_ans.txt check_ical_out.txt && echo PASS || echo FAIL
clean:
+ rm -f check_ical check_ical_out.txt
rm -f opplysning
-.PHONY: all clean
+.PHONY: all check clean
-LIBS = -lraylib -lm -lpthread -lGLESv2 -lEGL \
- $$([ `uname -m` = aarch64 ] && echo '-lvcos -lvchiq_arm -lgbm -ldrm')
+check_ical: check_ical.c
+ $(CC) $(CFLAGS) -o $@ check_ical.c $(LIBS)
opplysning: opplysning.c
$(CC) $(CFLAGS) -o $@ opplysning.c $(LIBS)
diff --git a/check_ical.c b/check_ical.c
new file mode 100644
index 0000000..6cddeb3
--- /dev/null
+++ b/check_ical.c
@@ -0,0 +1,52 @@
+#include <assert.h>
+#include <stdlib.h>
+
+#include <libical/ical.h>
+
+char *
+read_stream(char *s, size_t size, void *d)
+{
+ return fgets(s, (int)size, (FILE *)d);
+}
+
+int
+main(void)
+{
+ icalparser *parser = icalparser_new();
+ assert(parser);
+
+ FILE *stream = stdin;
+ assert(stream);
+
+ icalparser_set_gen_data(parser, stream);
+ for (;;) {
+ char *line = icalparser_get_line(parser, read_stream);
+ if (!line) {
+ break;
+ }
+
+ icalcomponent *comp = icalparser_add_line(parser, line);
+ if (!comp) {
+ continue;
+ }
+
+ for (icalcompiter i = icalcomponent_begin_component(
+ comp, ICAL_VEVENT_COMPONENT);
+ icalcompiter_deref(&i); icalcompiter_next(&i)) {
+ icalcomponent *c = icalcompiter_deref(&i);
+
+ struct icaltimetype dts = icalcomponent_get_dtstart(c);
+ printf("%02u-%02u-%02u ", dts.year, dts.month,
+ dts.day);
+ printf("%02u:%02u ", dts.hour, dts.minute);
+
+ const char *sum = icalcomponent_get_summary(c);
+ assert(sum);
+ printf("%s\n", sum);
+ }
+
+ icalcomponent_free(comp);
+ }
+
+ icalparser_free(parser);
+}
diff --git a/check_ical_ans.txt b/check_ical_ans.txt
new file mode 100644
index 0000000..154341f
--- /dev/null
+++ b/check_ical_ans.txt
@@ -0,0 +1,10 @@
+2025-04-17 18:00 Byggekveld
+2025-04-17 18:00 Omvisning (guided tour)
+2025-04-18 19:00 PRUSA 3D printer course
+2025-04-19 17:00 Lasercutter: basic use and safety
+2025-04-20 13:00 Armor Workshop
+2025-04-23 16:00 Learn to use Bitraf's Table Saw
+2025-04-24 18:00 Omvisning (guided tour)
+2025-04-24 18:00 Form Labs resin printer introduksjons kurs
+2025-04-24 18:00 Byggekveld
+2025-04-24 20:00 Bitrafs årsmøte 2025
diff --git a/check_ical_in.ical b/check_ical_in.ical
new file mode 100644
index 0000000..d4e1346
--- /dev/null
+++ b/check_ical_in.ical
@@ -0,0 +1,300 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Meetup//Meetup Calendar 1.0//EN
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+NAME:Bitraf
+X-WR-CALNAME:Bitraf
+BEGIN:VTIMEZONE
+TZID:Europe/Oslo
+TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Oslo
+X-LIC-LOCATION:Europe/Oslo
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+TZNAME:CEST
+DTSTART:19700329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+TZNAME:CET
+DTSTART:19701025T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:event_306978569@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250417T180000
+DTEND;TZID=Europe/Oslo:20250417T234500
+SUMMARY:Byggekveld
+DESCRIPTION:Bitraf\nBring your own project if you want or just drop by to
+ check out what we're all about. This is the perfect day for a tour of the
+ space\, so if you want to see Bitraf - be there close to 18:00 and someone
+ can show you around. Check the Photos (https://bitraf.no/skrytegalleri/)
+ to see examples of what Bitraf members are making on BuildNight and at Bit
+ raf in general.\n\nThe doors are open from 1800\, often earlier too. Feel
+ free to come later too\, we'll stick around for most of the evening. See h
+ ttps://wiki.bitraf.no/wiki/Byggekveld for details about this evening.
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/306978569/
+STATUS:CONFIRMED
+CREATED:20250328T174809Z
+LAST-MODIFIED:20250328T174809Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_306978583@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250417T180000
+DTEND;TZID=Europe/Oslo:20250417T190000
+SUMMARY:Omvisning (guided tour)
+DESCRIPTION:Bitraf\nDenne dagen er fin å komme på om man har lyst på en
+ omvisning.\nVi tar en generell runde og viser frem hva man kan gjøre på
+ Bitraf\, blant annet: Laser kutter\, 3D printer\, CNC fres\, lodding\, el
+ ektronikk\, verksted\, coworking space\, medlemsprosjekter og mye annet. S
+ pørsmål underveis.\n\nOmvisningen starter:\n18:00\nMan kan finne mer inf
+ ormasjon om Bitraf på vår wiki: [Bitraf wiki](https://bitraf.no/wiki/ind
+ ex.php?title=Hovedside)\n\nEnglish:\nThis day is dedicated to free tours o
+ f Bitraf\, guaranteed to not stumble into a full event. We will walk throu
+ gh and look at all the machinery and activities one can do at bitraf. More
+ info about what is at bitraf: [Bitraf wiki](https://bitraf.no/wiki/index.
+ php?title=Hovedside)\nTours begin at:\n18:00
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/306978583/
+STATUS:CONFIRMED
+CREATED:20250328T174816Z
+LAST-MODIFIED:20250328T174816Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_306792351@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250418T190000
+DTEND;TZID=Europe/Oslo:20250418T213000
+SUMMARY:PRUSA 3D printer course
+DESCRIPTION:Bitraf\nThis will be a short intro\, where I'll show you the w
+ hole process from model to ready print. I'm also going to show you how the
+ common problems occur\, and how to fix them. I also should say this cours
+ e is going to be in english\, but i can answer any questions you ask in no
+ rwegian.\nIf you want to bring your laptop\, here are important links:\n[P
+ rusa slicer](https://www.prusa3d.com/page/prusaslicer_424/)\n[Prusa i3 mk3
+ s handbook](https://cdn.prusa3d.com/downloads/manual/prusa3d_manual_mk3s_e
+ n.pdf)\n[Website with free models for printing](https://www.printables.com
+ /)\n\nThe only requirement for the course\, is that you choose a time you
+ can actually attend and cancel in advance if you cant attend.\n**Bringing
+ a computer is recommended**.\n\nThere are no restrictions on who can use t
+ he printers. But this is where you can get all the info and pointers you n
+ eed for using printers as a beginner.
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/306792351/
+STATUS:CONFIRMED
+CREATED:20250318T180559Z
+LAST-MODIFIED:20250318T180559Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307301453@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250419T170000
+DTEND;TZID=Europe/Oslo:20250419T190000
+SUMMARY:Lasercutter: basic use and safety
+DESCRIPTION:Bitraf\nThis course is for paying Bitraf members only. If you
+ are not a paying member\, sign up for membership at [https://bitraf.no/#](
+ https://bitraf.no/#) before the course.\nIf you want to make precise cuts
+ in thin materials\, a laser cutter may just be what you need.\nBitraf has
+ 2 laser cutters capable of cutting lines and engraving patterns in wood\,
+ plastic\, fabric\, leather and more. It's entirely possible to do dangerou
+ s and harmful things with the cutter. Therefore it is mandatory to complet
+ e a laser-course at Bitraf before using the machinery. During this course
+ we will look at the whole process from a simple and quick design project t
+ o a finished object.\nIt is an advantage if everyone has their own laptop
+ with Illustrator\, Inkscape\, Fusion 360 or Rhino installed. Both Inkscape
+ and Fusion can be installed for free\; https://inkscape.org/en\, [https:/
+ /www.autodesk.com/products/fusion-360/overview](https://www.autodesk.com/p
+ roducts/fusion-360/overview). For Fusion\, sign up for «Start-Up or Educa
+ tional licensing». Bitraf has a PC for those who can’t bring a laptop.\
+ nNorwegian documentation for the laser can be found at\n[https://wiki.bitr
+ af.no/wiki/Laser](https://wiki.bitraf.no/wiki/Laser)\n[https://wiki.bitraf
+ .no/wiki/Laser-steg](https://wiki.bitraf.no/wiki/Laser-steg)\n[https://pap
+ er.dropbox.com/doc/Lasercutter-Guidelines-of-use--Bu19hdZzo6KoAg6AlpgjTMPg
+ Ag-SJmzPpa01ts2cHiMjybQE](https://paper.dropbox.com/doc/Lasercutter-Guidel
+ ines-of-use--Bu19hdZzo6KoAg6AlpgjTMPgAg-SJmzPpa01ts2cHiMjybQE)\n\nThe soft
+ ware we use on the lasers is called Lightburn.\n[https://lightburnsoftware
+ .com](https://lightburnsoftware.com)\nPlease look through the plethora of
+ tutorials available on youtube and their website - you can download the so
+ ftware to your own laptop before the course too.\n\nThe course will be in
+ either Norwegian or English\, depending on the attendees.\nImportant infor
+ mation:\n• These courses tend to fill up. If you realize that you can't
+ attend after signing up\, please RSVP 'no' to sign off asap\, so that some
+ one else can take your spot.\n• The course **starts** at 17:00 precisely
+ in the lab. You are welcome to come earlier to grab coffee etc before the
+ course starts. Be sure to be on time\, if you come late as you will miss
+ important information essential to complete the course\, and not get certi
+ fied to use the machines.\n• Because of high expenses and running costs
+ for the laser\, you need to be a paying member of Bitraf to attend this co
+ urse. Please join Bitraf at [http://bitraf.no/join](http://bitraf.no/join)
+ before signing up to the course.\n• The course starts with a group theo
+ ry presentation (about 45 min)\, then practical training that can take up
+ to an hour each. You will be added to the 'TOOLS' tool access system at th
+ is point\, meaning you will have everything you need to start using the la
+ sers straight away. You are free to leave after the practical part.\n\nPle
+ ase join Bitraf Slack workspace and register for the bitraf google calenda
+ r before attending the course:\n[Click here to join Bitraf’s slack works
+ pace](https://bitraf.no/slack-invite/)\nhttps://bitraf.no/slack-invite/\n[
+ Click here for how to join Bitraf's google group](https://wiki.bitraf.no/w
+ iki/Booking)\nhttps://wiki.bitraf.no/wiki/Booking
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307301453/
+STATUS:CONFIRMED
+CREATED:20250415T140332Z
+LAST-MODIFIED:20250415T140332Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307024978@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250420T130000
+DTEND;TZID=Europe/Oslo:20250420T190000
+SUMMARY:Armor Workshop
+DESCRIPTION:Bitraf\nArmor Workshop invitere til kostyme\, props og all mor
+ ro vi kan ha med laging og mekking av hva en vi ønsker. Ta med deg dine p
+ rosjekter og delta i felleskapet.\n\nKanskje kan vi og lære noe av hveran
+ dre!\n\nBegynner 13:00 til 19:00. Men man kommer og går som man vil :)
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307024978/
+STATUS:CONFIRMED
+CREATED:20250331T113546Z
+LAST-MODIFIED:20250331T113546Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307068688@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250423T160000
+DTEND;TZID=Europe/Oslo:20250423T210000
+SUMMARY:Learn to use Bitraf's Table Saw
+DESCRIPTION:Bitraf\nThis course is necessary for everyone who wants access
+ to the table saw at Bitraf - beginner and experienced users - to establis
+ h baseline knowledge & standards that everyone can expect of each other.\n
+ \nThis course is very popular - **be the person** that signs up and takes
+ the opportunity to join a course seriously. If you don't turn up\, you tak
+ e away the opportunity to learn from someone else. **Book the time off in
+ your calendar\, even if you're on the waitlist**. It is very common to get
+ bumped up as the course date/time approaches.\n\nSigning up to the waitli
+ st means you take on the responsibility to check the event daily (even on
+ the hours before the event) **and** the possibility to turn up at short no
+ tice. If you know it's likely you won't have the time anymore\, please cha
+ nge your rsvp to 'no' as soon as you're aware.\n\nThe intention of the cou
+ rse is to develop safe working practices for the safety of you\, others at
+ Bitraf\, and the machine. This is required knowledge that must put into u
+ se each time you use the table saw to be safe and excellent to each other.
+ \n\n***\n\nYOU are responsible for yourself\, Bitraf has no liability if y
+ ou are injured.\n\nThis course is for paying Bitraf members only. If you a
+ re not a paying member\, sign up for membership at [https://bitraf.no/#](h
+ ttps://bitraf.no/#) before the course.\n\n3 people per course\n\nIt is a 5
+ -part course with a small break\, taking approx 4 hours\n\nThis course is
+ in English\n\nThe course is held in the workshop upstairs.\n\nThings to ha
+ ve ready for course:\n\n* Dust Mask (buy in Bitmart if needed)\n* Eye and
+ Hearing protection (Bitraf has if you don't)\n* A mind of giving what you
+ have - time\, an open mind\, an attitude of learning/sharing\n\nUpon compl
+ etion of course you will have table saw access via the p2k16 ‘TOOLS’ s
+ ystem. This enables use of the machine to be logged.\n\nThanks for your ti
+ me and future attention
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307068688/
+STATUS:CONFIRMED
+CREATED:20250402T174028Z
+LAST-MODIFIED:20250402T174028Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_bndvktyhcgbgc@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250424T180000
+DTEND;TZID=Europe/Oslo:20250424T190000
+SUMMARY:Omvisning (guided tour)
+DESCRIPTION:Bitraf\nDenne dagen er fin å komme på om man har lyst på en
+ omvisning.\nVi tar en generell runde og viser frem hva man kan gjøre på
+ Bitraf\, blant annet: Laser kutter\, 3D printer\, CNC fres\, lodding\, el
+ ektronikk\, verksted\, coworking space\, medlemsprosjekter og mye annet. S
+ pørsmål underveis.\n\nOmvisningen starter:\n18:00\nMan kan finne mer inf
+ ormasjon om Bitraf på vår wiki: [Bitraf wiki](https://bitraf.no/wiki/ind
+ ex.php?title=Hovedside)\n\nEnglish:\nThis day is dedicated to free tours o
+ f Bitraf\, guaranteed to not stumble into a full event. We will walk throu
+ gh and look at all the machinery and activities one can do at bitraf. More
+ info about what is at bitraf: [Bitraf wiki](https://bitraf.no/wiki/index.
+ php?title=Hovedside)\nTours begin at:\n18:00
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/bndvktyhcgbgc/
+STATUS:CONFIRMED
+CREATED:20240315T094635Z
+LAST-MODIFIED:20240315T094635Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307081967@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250424T180000
+DTEND;TZID=Europe/Oslo:20250424T200000
+SUMMARY:Form Labs resin printer introduksjons kurs
+DESCRIPTION:Bitraf\nVi starter opp igjen med introduksjonskurs på vår Fo
+ rm Labs resin printer.\n\nDette er en gjennomgang av printeren\, slicer so
+ ftware\, og en forståelse for hva man bør tenke på ved resin printing.\
+ n\nDet er ikke noe printing på selve kurset men det gir deg en solid star
+ t for å begynne på egenhand.\n\nKursetholdes på norsk eller engelsk ett
+ er ønske.\nKurset holdes hver andre uke. Men kan og holdes etter avtale.
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307081967/
+STATUS:CONFIRMED
+CREATED:20250403T090931Z
+LAST-MODIFIED:20250403T090931Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307109896@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250424T180000
+DTEND;TZID=Europe/Oslo:20250424T234500
+SUMMARY:Byggekveld
+DESCRIPTION:Bitraf\nBring your own project if you want or just drop by to
+ check out what we're all about. This is the perfect day for a tour of the
+ space\, so if you want to see Bitraf - be there close to 18:00 and someone
+ can show you around. Check the Photos (https://bitraf.no/skrytegalleri/)
+ to see examples of what Bitraf members are making on BuildNight and at Bit
+ raf in general.\n\nThe doors are open from 1800\, often earlier too. Feel
+ free to come later too\, we'll stick around for most of the evening. See h
+ ttps://wiki.bitraf.no/wiki/Byggekveld for details about this evening.
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307109896/
+STATUS:CONFIRMED
+CREATED:20250404T172302Z
+LAST-MODIFIED:20250404T172302Z
+CLASS:PUBLIC
+END:VEVENT
+BEGIN:VEVENT
+UID:event_307219849@meetup.com
+SEQUENCE:1
+DTSTAMP:20250416T190128Z
+DTSTART;TZID=Europe/Oslo:20250424T200000
+DTEND;TZID=Europe/Oslo:20250424T220000
+SUMMARY:Bitrafs årsmøte 2025
+DESCRIPTION:Bitraf\nAlle medlemmer i foreningen Bitraf (orgnr. 898124452)
+ inviteres herved til årsmøte/generalforsamling for 2025 – torsdag 24.
+ april kl. 20:00.\n\nAgenda/saksliste:\n\n1. Valg av møteleder og referent
+ \n2. Godkjenning av innkalling\n3. Årsberetning og informasjon om alt som
+ er nytt\n4. Regnskap og Balanse for 2024\n5. Budsjett for 2025\n6. Valg a
+ v styre\n7. Valg av revisor\n8. Eventuelt\n\nAlle som vil kan komme på å
+ rsmøtet\, men for å ha stemmerett må man være betalende medlem av Bitr
+ af.
+URL;VALUE=URI:https://www.meetup.com/bitraf/events/307219849/
+STATUS:CONFIRMED
+CREATED:20250410T194408Z
+LAST-MODIFIED:20250410T194408Z
+CLASS:PUBLIC
+END:VEVENT
+X-ORIGINAL-URL:https://www.meetup.com/bitraf/events/ical/
+X-WR-CALNAME:Bitraf
+END:VCALENDAR