Skip to content

Instantly share code, notes, and snippets.

View igneus's full-sized avatar

Jakub Pavlík igneus

View GitHub Profile
# decode the inscription around the SkKySIO logo
# https://commons.wikimedia.org/wiki/File:SkKySIO.svg
code = 'oiooiioooiioiiiioiiooiiioiioiiiioiiiooii'
p code
.tr('oi', '01')
.scan(/.{8}/)
.collect {|i| i.to_i(2).chr }
@igneus
igneus / added_feasts.rb
Created August 18, 2023 17:44
How many celebrations of rank of a feast or higher have been added since the 1969 calendar reform?
# How many celebrations of rank of a feast or higher have been added
# since the 1969 calendar reform?
# (Data for the discussion at https://www.facebook.com/Liturgie.cz/posts/pfbid02g7wBtAEfsuwjZDoebsqsjnu5VHAyx42txiRqreZrRZ826mxPPzGfjp48PAjgyZXal )
require 'calendarium-romanum/cr'
require 'pp'
class CalendariumRomanum::Sanctorale
def to_h
r = {}
@igneus
igneus / inverse_date_feasts.rb
Created June 15, 2023 15:24
Which sanctorale feasts are celebrated on inverse dates like 2/5 x 5/2?
# Which sanctorale feasts are celebrated on inverse dates like 2/5 x 5/2?
require 'calendarium-romanum/cr'
class CR::AbstractDate
def inverse
return nil if day > 12 || day == month
self.class.new(day, month)
end
end
@igneus
igneus / ultra_condensed_formatter.rb
Created May 13, 2023 17:38
calrom formatter summarizing the day's liturgy in just one or two characters
# custom formatter for calrom https://github.com/calendarium-romanum/calrom
# Don't expect calrom code to be already loaded, load all direct dependencies of our class - this allows usage like
# $ RUBYOPT="-I my/custom/code/dir -r ultra_condensed_formatter" calrom -f ultracondensed --today
require 'calrom/formatter/formatter'
module Calrom
module Formatter
# Prints just one or two characters signalling
# what kind of celebration is celebrated today.
@igneus
igneus / skipped_ordinary_time_sundays2.rb
Created October 23, 2022 19:45
Which portions of the repertory of Ordinary time Sundays are left unused in the given range of liturgical years?
# Which portions of the repertory of Ordinary time Sundays
# (lessons, corresponding chants of the Mass and Divine Office)
# are left unused in the given range of liturgical years?
require 'calendarium-romanum/cr'
require 'set'
SUNDAYS = (2..33).to_a.freeze
SANCTORALE = CR::Data::GENERAL_ROMAN_ENGLISH.load
@igneus
igneus / feast_of_lord_first_vespers.rb
Created September 13, 2022 18:08
In which years does each feast of the Lord fall on Sunday and is thus celebrated with first Vespers?
# In which years does each feast of the Lord fall on Sunday and is thus celebrated with first Vespers?
require 'calendarium-romanum/cr'
years = 2000 .. 2100
sanctorale = CR::Data::GENERAL_ROMAN_ENGLISH.load
sanctorale
.each_day
.select {|_,celebrations| celebrations.first.rank == CR::Ranks::FEAST_LORD_GENERAL }
@igneus
igneus / skipped_ordinary_time_sundays.rb
Created July 2, 2022 20:31
Which Ordinary time Sundays were not celebrated in the given liturgical year?
# Which Ordinary time Sundays were not celebrated in the given liturgical year?
require 'calendarium-romanum/cr'
SUNDAYS = (2..33).to_a.freeze
SANCTORALE = CR::Data::GENERAL_ROMAN_ENGLISH.load
def skipped_sundays(year)
cal = CR::Calendar.new year, SANCTORALE
r = SUNDAYS.dup
@igneus
igneus / sacred_heart_occurrence.rb
Created June 25, 2022 14:33
Occurrence of Sacred Heart with another solemnity
# In which years Sacred Heart occurs with another solemnity and
# https://github.com/igneus/calendarium-romanum/issues/80
# will hit again?
require 'calendarium-romanum/cr'
sanctorale = CR::Data::GENERAL_ROMAN_ENGLISH.load
(2020..2200).each do |liturgical_year|
date = CR::Temporale::Dates.sacred_heart liturgical_year
@igneus
igneus / years_without_adalbert.rb
Created April 23, 2022 13:59
How often is the feast of St. Adalbert suppressed?
# How often is the feast of St. Adalbert suppressed?
require 'calendarium-romanum/cr'
cal = CR::PerpetualCalendar.new sanctorale: CR::Data['czech-praha-cs'].load_with_parents
date = CR::AbstractDate.new 4, 23
(1970..2100).each do |y|
puts y if cal[date.concretize(y)].celebrations.first.symbol != :adalbert
end
@igneus
igneus / lh_volume_sanctorale_ranges.rb
Last active March 4, 2022 15:17
Which date range(s) must sanctorale of each Liturgia horarum volume cover?
# Which date range(s) must sanctorale of each Liturgia horarum volume cover?
require 'calendarium-romanum/cr'
years = 1971 .. 3000
dates = CR::Temporale::Dates
xviii_sunday = lambda do |y|
dates.first_advent_sunday(y + 1) -