This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
# Converts an arbitrary file to MIDI. Obviously. | |
# Note the output files can be.. long (a 25KiB file becomes about 10 hours), | |
# and may cause players to lockup while opening (the aforementioned 10 hour | |
# file took Quicktime Player 7 about 5-10 seconds to open) | |
import smidi | |
def fileToMidi(input_fname, output_fname): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simulating infinite-length leading lookbehind in JavaScript. Uses XRegExp. | |
// Captures within lookbehind are not included in match results. Lazy | |
// repetition in lookbehind may lead to unexpected results. | |
(function (XRegExp) { | |
function prepareLb(lb) { | |
// Allow mode modifier before lookbehind | |
var parts = /^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*)\)$/.exec(lb); | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import NamedTuple # >= Python.3.6.0 | |
class Employee(NamedTuple): | |
name: str | |
department: str | |
salary: int | |
is_remote: bool = False # >= Python.3.6.1 | |
bob = Employee(name='Bob', department='IT', salary=10000, is_remote=True) |