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
import os | |
from docutils import nodes | |
from docutils.parsers.rst import directives | |
from docutils.parsers.rst.directives.images import Image | |
def find_image(path, filename): | |
fname = os.path.join(path, filename) | |
if os.path.exists(fname + '.pdf'): | |
return fname + '.pdf' |
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
#!/bin/sh | |
initfile=~/.lattesrc | |
tmpdir=/tmp | |
function parse_init { | |
if [ -f $initfile ] | |
then | |
source $initfile | |
else |
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
.. autoimage:: notation3.png | |
:scale-html: 40 | |
:scale-latex: 80 |
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
\newcommand{\pdfinclude}[2]{ | |
\foreach \i in {#2}{ | |
\includegraphics[scale=.80,page=\i]{#1}\pagebreak\par | |
} | |
} | |
\pdfinclude{pdf_file}{1,2,3,4,5,6,7} |
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
import os | |
import shutil | |
from sphinx.builders.epub import EpubBuilder | |
# We subclass EpubBuilder and re-define build_epub to call | |
# clean_html_file_for_ibooks. This function replaces all instances of | |
# the SPAN tag to SAMP. It's uglish but it works. A better way would | |
# be to change sphinx.writers.html to emmit the SAMP tag in the first | |
# place, but it seems even more difficult to do. |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}"/> | |
{{ metatags }} | |
{%- block htmltitle %} |
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 python | |
import os | |
import subprocess | |
from lxml import html | |
from lxml.html import builder as E | |
from lxml.html.clean import clean_html | |
url = "http://dangerousprototypes.com/docs/Bus_Blaster" |
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
ENV = "full-dev" | |
.PHONY: tests coverage | |
tests: | |
. ${WORKON_HOME}/$(ENV)/bin/activate && autonose --console -x--with-color | |
coverage: | |
. ${WORKON_HOME}/$(ENV)/bin/activate && nosetests --with-coverage --cover-html |
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
notes1 = tinyNotation.TinyNotationStream("c4 d8 f g16 a g f#", "3/4") | |
notes2 = tinyNotation.TinyNotationStream("g4 a8 b c16 a b c#", "3/4") | |
c1 = contour.Contour(notes1) | |
c2 = contour.Contour(notes2) | |
c3 = contour.Contour([0, 3, 1, 2]) | |
bach = corpus.parseWork('bach/bwv295') | |
soprano = bach.parts[0].flat.notes | |
c4 = contour.Contour(soprano) |
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 itertools import combinations, product, permutations, chain | |
from math import factorial | |
import functools | |
import operator | |
def prod(seq): | |
"""Product of a sequence.""" | |
return functools.reduce(operator.mul, seq, 1) |