Skip to content

Instantly share code, notes, and snippets.

View msikma's full-sized avatar
🐛
Writing bugs

Michiel Sikma msikma

🐛
Writing bugs
View GitHub Profile
% Ballade No.1 in G Minor, Op.23 (F.Chopin, 1835-1836)
% music.ly - main music markup
%
% (C) 2016, Michiel Sikma <[email protected]>
% Licensed under CC BY-SA 4.0.
% TODO:
% [ ] add fingering
% [ ] add all slurs
% [ ] remove all fixmes
include-header =
#(define-void-function (parser location)()
(define lang "")
(define ext ".ily")
(if (defined? 'HEADERS-LANG)
(set! lang (string-append "-" HEADERS-LANG)))
(if (defined? 'HEADERS-EXT)
(set! ext (string-append "." HEADERS-EXT)))
(ly:parser-include-string parser (format "\\include \"~A~A~A\"\n" "header" lang ext)))
#!/usr/bin/env python3
from bz2 import BZ2Decompressor
class BZ2TextFileStreamer:
'''
Iterates through a bzip2 compressed text file, decoding as it goes along
and yielding lines one by one until the end of the file. Since the file
is not completely contained in memory, it can be used to decode
\version "2.18.2"
\language "english"
% Time signature for the first section, bars 1-7.
part-one = {
\key g \minor
\time 4/4
\tempo "Largo"
}
next_item = Word()
# next_item is either a Word object, which has .is_type(), or it's None
if next_item is None:
# code for situation A
elif next_item.is_type('something'):
# code for situation B
elif next_item.is_type('something_else'):
# code for situation C
else:
if self.is_type(ADJ_I):
stem_kana = self.conjugations['stem_kana']
stem_kanji = self.conjugations['stem_kanji']
conj = self.conjugations['conj']
suffix = ''
next_type = None if next is None else next.get_type()
if next.is_type(ADJ_I):
suffix = 'くて'
if self.is_type(ADJ_I):
stem_kana = self.conjugations['stem_kana']
stem_kanji = self.conjugations['stem_kanji']
conj = self.conjugations['conj']
suffix = ''
next_type = None if next is None else next.get_type()
if next_type == ADJ_I:
suffix = 'くて'
cheap = Word(id=1153670) # 安い
white = Word(id=1474910) # 白い
present = Phrase(cheap, white, tense=TENSE_PRESENT)
past = Phrase(cheap, white, tense=TENSE_PAST)
past_neg = Phrase(cheap, white, tense=TENSE_PAST, polarity=POLARITY_NEG)
# これは安くて、白いです。
print('これは' + str(present) + 'です。')
cheap = Word(id=1153670) # 安い
yummy = Word(id=1486650) # おいしい
present = Phrase(cheap, yummy, tense=TENSE_PRESENT)
past = Phrase(cheap, yummy, tense=TENSE_PAST)
past_neg = Phrase(cheap, yummy, tense=TENSE_PAST, polarity=POLARITY_NEG)
# 牛丼は安くて、美味しいです。
print('牛丼は' + str(present) + 'です。')
import requests
import json
import calendar
from datetime import datetime, timedelta
# https://api.slack.com/docs/oauth-test-tokens
_token = 'token'
_domain = 'hma'
if __name__ == '__main__':