[ Launch: timbre.js pendulums ] 5893707 by jsundram[ Launch: timbre.js play midi dots ] 5893390 by enjalot[ Launch: timbre.js play midi ] 5893333 by enjalot[ Launch: timbre.js reich ] 5893325 by enjalot[ Launch: timbre.js reich ] 5893317 by enjalot[ Launch: timbre.js ] 5893276 by enjalot[ Launch: timbre.js ] 5893159 by enjalot
This file contains hidden or 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 glob import glob | |
| import os | |
| from pyPdf import PdfFileWriter, PdfFileReader | |
| def merge_pdfs(pdfs, output_file, delete_originals=True): | |
| """ Takes a list of pdf filenames and and output filename | |
| and merges all the input filenames into one pdf (in | |
| the order they were specified | |
| """ | |
| merged = PdfFileWriter() |
This file contains hidden or 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 sys | |
| from BeautifulSoup import BeautifulSoup, SoupStrainer | |
| def use(link): | |
| return link.get('href', None) and link.text and not link.text.startswith('http') | |
| def file_as_string(filename): | |
| with open(filename) as f: | |
| return f.read() | |
This file contains hidden or 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
| """https://code.google.com/p/pyprocessing/wiki/QuickReference#Pyprocessing_Documentation""" | |
| from pyprocessing import * | |
| from random import randint as random | |
| MAXS = 40 | |
| MINS = 1 | |
| pic = None | |
| grow = False | |
| box_size = MAXS |
Utilities for accessing and working with colorbrewer colors in Python. Data copied from mbostock's block #5577023
Install AggDraw. From natevw's post on stack overflow.
Includes a patch I discovered was necessary for freetype, mentioned here.
This file contains hidden or 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 music21 | |
| haydn = music21.corpus.getWorkList('haydn') | |
| haydn = [h for h in haydn if 'essenFolksong' not in h and 'symphony' not in h] | |
| prefix, _ = haydn[0].split('haydn/') | |
| prefix += 'haydn/' | |
| # now we have a list of all the quartets | |
| haydn_quartets = [h.replace(prefix, '') for h in haydn] |
This file contains hidden or 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 glob import glob | |
| import sys | |
| from tempfile import NamedTemporaryFile | |
| png_dir = sys.argv[1] | |
| wildcard = os.path.join(png_dir, '*.png') | |
| n = len(glob(wildcard)) | |
| if n < 100: | |
| # for short files, animated gifs are preferable |
This file contains hidden or 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 music21 | |
| import os | |
| from collections import defaultdict | |
| HAYDN = music21.corpus.getWork('haydn') | |
| def title(h): | |
| path, mvt = os.path.split(h) | |
| mvt, ext = os.path.splitext(mvt) | |
| qrt = os.path.basename(path) |
This file contains hidden or 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> | |
| <html lang="en"> | |
| <head> | |
| <title>dc.js multi-line chart attempt</title> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link rel="stylesheet" type="text/css" href="http://nickqizhu.github.io/dc.js/css/dc.css"/> | |
| <link rel="stylesheet" type="text/css" href="http://nickqizhu.github.io/dc.js/css/bootstrap.min.css"/> |