Skip to content

Instantly share code, notes, and snippets.

@artyom-poptsov
Last active January 6, 2017 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artyom-poptsov/5d781ee0cfcc4201726fcaa27777c244 to your computer and use it in GitHub Desktop.
Save artyom-poptsov/5d781ee0cfcc4201726fcaa27777c244 to your computer and use it in GitHub Desktop.
Example of Guile-ICS (https://github.com/artyom-poptsov/guile-ics) usage: Convert iCalendar data to Emacs org-mode
#!/usr/bin/guile \
-e main
!#
(use-modules (ice-9 popen)
(srfi srfi-41) ; streams
;; Guile-ICS
(ics)
(ics conv))
(setlocale LC_ALL "")
(define (main args)
;; We have to use 'curl' because 'http-get' from (web client) does
;; not work with HTTPS.
(let ((p (open-input-pipe "curl 'https://fosdem.org/2017/schedule/ical'")))
(stream-for-each ical-object->org-mode (ics->stream p))))
$ cat rfc5545-example.ics | ./utils/ics --to-org-mode
* VCALENDAR
:PROPERTIES:
:PRODID: -//hacksw/handcal//NONSGML v1.0//EN
:VERSION: 2.0
:END:
** VEVENT
:PROPERTIES:
:SUMMARY: Bastille Day Party
:DTEND: 19970715T040000Z
:DTSTART: 19970714T170000Z
:DTSTAMP: 19970610T172345Z
:UID: 19970610T172345Z-AF23B2@example.com
:END:
$ cat rfc5545-example.ics | ./utils/ics --pretty-print
BEGIN: VCALENDAR
PRODID: -//hacksw/handcal//NONSGML v1.0//EN
VERSION: 2.0
BEGIN: VEVENT
SUMMARY: Bastille Day Party
DTEND: 19970715T040000Z
DTSTART: 19970714T170000Z
DTSTAMP: 19970610T172345Z
UID: 19970610T172345Z-AF23B2@example.com
END: VEVENT
END: VCALENDAR
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:19970610T172345Z-AF23B2@example.com
DTSTAMP:19970610T172345Z
DTSTART:19970714T170000Z
DTEND:19970715T040000Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment