Skip to content

Instantly share code, notes, and snippets.

View igneus's full-sized avatar

Jakub Pavlík igneus

View GitHub Profile
@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
@igneus
igneus / README.md
Created March 4, 2019 20:51
BaseX - examples of concurrent connections (fails in Python, OK in other tested languages)
@igneus
igneus / normostrany.sh
Last active January 6, 2019 18:25
Kolik normostran textu obsahuje daný pdf dokument?
#!/bin/bash
# Klasicka otazka studentova: Kolik normostran ma me pdf?
if [ $# -lt 1 ]
then
echo "pdf file expected as command line argument."
exit 1
fi
@igneus
igneus / pedal_channel_switch.py
Created December 26, 2016 18:48
Switch MIDI presets by piano pedals
# mididings patch translating piano pedals to Program switch messages
#
# I use it to switch presets in aeolus
from mididings import *
config(
client_name='pedal_channel_switch'
)
@igneus
igneus / gabc_quanta.rb
Created December 12, 2016 20:46
"How melismatic chants do my gabc files contain?"
# takes a list of gabc file paths as commandline arguments,
# for each of them prints syllable count, note count and notes per syllable
require 'grely'
class GabcScore
def syllables_count
i = 0
each_syllable {|s| i += 1 }
i
@igneus
igneus / feast.cr
Last active November 23, 2016 21:05
On feast days display feast title
# 2016-11-18
# connects to the Church Calendar API
# If there is a celebration of rank feast or higher, prints it's title
# For me to fill a textbox widget in awesome:
# In rc.lua:
#
# calendarbox = widget({ type = "textbox" })
# calendarbox.text = awful.util.pread("/path/to/feast --calendar=czech-pha")
@igneus
igneus / http_error_raiser.rb
Last active September 18, 2016 09:15
returns unhappy HTTP status codes you ask for.
# Application returning unhappy HTTP status codes you ask for, e.g.
# GET /404
# returns 404 Not Found etc.
# Created for manual testing of HTTP clients.
require 'sinatra'
require 'json'
KNOWN_ERRORS = {
400 => 'Bad Request',
@igneus
igneus / Rakefile
Last active August 24, 2016 16:21
my seminar paper template (studying Theology at http://www.tf.jcu.cz/)
deps = Dir["*.tex"] + Dir["*.*bx"] + Dir['*.bib']
main = Dir['*.tex'].first # only one expected
main_noext = main.sub '.tex', ''
main_pdf = main.sub '.tex', '.pdf'
file main_pdf => deps do |t|
sh "xelatex #{main_noext}"
sh "biber #{main_noext}"
sh "xelatex #{main_noext}"
\header
title: Antiphons for the Consecration of Virgins
\score
annotation: I D
c4
d f ef g ,
g ixhih g h ;
h g f ef d ,
d e d d f e c d ::
@igneus
igneus / threefold_piano.py
Last active July 30, 2016 13:23
mididings patch transforming a single-manual MIDI piano with standard three piano pedals to a two-manual organ with pedal (sort of)
# mididings patch making a single-manual MIDI piano with standard
# three piano pedals capable of simple organ music:
# * splits keyboard in two manuals (MIDI channels 1, 2)
# * transforms the piano pedals in a diatonic
# single-octave organ pedal playing on MIDI channel 4
# (it isn't possible to play more simultaneous pedal notes -
# combinations are instead used to expand the pedal's range)
from mididings import *
from mididings.event import CtrlEvent