Skip to content

Instantly share code, notes, and snippets.

View igneus's full-sized avatar

Jakub Pavlík igneus

View GitHub Profile
@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) -
@igneus
igneus / second_sunday_of_xmas.rb
Last active December 19, 2021 20:26
In which years is the Second Sunday of Christmas celebrated?
require 'calendarium-romanum'
dates = CalendariumRomanum::Temporale::Dates
years = (1969..3000)
has_second_sunday_of_xmas = proc do |year|
dates.octave_of(dates.sunday_after(dates.nativity(year))) <
dates.epiphany(year)
end
@igneus
igneus / psalter_latex_to_yaml.rb
Last active June 13, 2021 14:41
How often does a term appear in individual days of the LOTH Psalter cycle?
# coding: utf-8
# accepts https://github.com/igneus/In-adiutorium/blob/master/antifonar/antifonar_zaltar.ltex
# as input, prints psalter distribution as YAML
started = false
ARGF.each_line do |line|
case line
when /^\\nadpisTyden\{.+?\}\{(\d.+)\}/
started = true
puts "#{$1}:"
@igneus
igneus / celebrations_never_getting_vespers.rb
Created June 13, 2021 10:40
Celebrations never getting Vespers in the General Roman Calendar
require 'calendarium-romanum/cr'
sanctorale = CR::Data::GENERAL_ROMAN_ENGLISH.load
result = CR::Util::Year.new(2000).each_cons(2).flat_map do |date_a, date_b|
cel_a = sanctorale[date_a]
cel_b = sanctorale[date_b]
if cel_b.size > 0 && cel_b[0].solemnity? && cel_a.size > 0 && cel_b[0].rank > cel_a[0].rank
cel_a.collect do |c|
@igneus
igneus / test.md
Created June 12, 2021 21:57
Github Markdown: Try out how text on the line of the initial fence of a fenced code block is displayed

text before code block

Code block without syntax highlighting

blah blah

# Code block without syntax highlighting
@igneus
igneus / cantusindex_missing_ids.rb
Created April 19, 2021 14:55
hymnologica.cz - check which Cantus IDs are available at CantusIndex
# reads Cantus IDs on stdin, tries to fetch every one from CantusIndex, prints result
require 'mechanize'
def exists?(cantusid)
uri = "http://www.cantusindex.org/id/#{cantusid}"
agent = Mechanize.new
begin
@igneus
igneus / index.php
Last active February 1, 2021 22:25
hledání jednorožce
<?php
$hesla = array(
"heslo" => "Tajný text",
"jineheslo" => "Jiný tajný text\nse zalomeními\n\nřádků",
// "zakomentovaneheslo" => "Pokud řádek neodkomentuješ smazáním dvou lomítek na jeho začátku , tohle heslo je neaktivní.",
);
$title = 'Hledání jednorožce';
layout title url previous next
default
Command Reference
/command-reference
/specification-reference
/rubygems-org-api

What each gem command does, and how to use it.

@igneus
igneus / lh_posts_commenters.rb
Created April 17, 2020 20:45
signaly blog scraper
require 'mechanize'
require 'csv'
blog = 'https://pokus-4.signaly.cz'
agent = Mechanize.new
agent.log = Logger.new "mech.log"
# collect links to all archive pages (each listing blog posts of a single month)
page = agent.get blog
@igneus
igneus / frances_of_rome_in_passion_week.rb
Created June 14, 2019 19:05
In which years does the feast of St. Frances of Rome occur in the Passion Week?
require 'calendarium-romanum'
CR = CalendariumRomanum
def passion_week(liturgical_year)
easter = CR::Temporale::Dates.easter_sunday liturgical_year
((easter - 7) .. (easter - 1))
end