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 IPython.parallel import Client | |
| import threading | |
| import time | |
| import contextlib | |
| class SafeClient(object): | |
| """Wrapper for IPython.parallel.Client adding callbacks for AsyncResults. |
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
| """Adapted from http://askubuntu.com/a/141641 | |
| This compatibility layer allows to use either PySide or PyQt4 as the Qt | |
| binding. It will choose what's available, defaulting on PySide, unless the | |
| QT_API environment variable is set. | |
| """ | |
| import os | |
| import sys |
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> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
| <title>Look of disapproval</title> | |
| </head> | |
| <body> | |
| <p style="position: absolute; top: 50%; left: 50%; margin-left: -180px; margin-top: -111px;"><canvas class="jsdisapproval" width="360" height="222"></canvas></p> | |
| <script type="text/javascript" src="disapproval.js"></script> |
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 | |
| import time | |
| if __name__ == '__main__': | |
| begin = time.time() | |
| l = sys.stdin.readline() | |
| while l: | |
| sys.stdout.write("%f %s" % (time.time() - begin, l)) | |
| l = sys.stdin.readline() |
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
| def rgb2hsv(rgb): | |
| """Converts RGB to HSV. | |
| Note that H may be None when S is 0 (for grey colors). | |
| """ | |
| r, g, b = rgb | |
| minimum = min(r, g, b) | |
| maximum = max(r, g, b) | |
| v = maximum |
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
| // shim layer with setTimeout fallback | |
| window.requestAnimFrame = (function(){ | |
| return window.requestAnimationFrame || | |
| window.webkitRequestAnimationFrame || | |
| window.mozRequestAnimationFrame || | |
| window.oRequestAnimationFrame || | |
| window.msRequestAnimationFrame || | |
| function( callback ){ | |
| window.setTimeout(callback, 1000 / 60); | |
| }; |
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
| #!/bin/sh | |
| # rename.sh [-n] [-r] <regex> [file [...]] | |
| notreally= | |
| sedopts= | |
| while getopts ":nr" opt ; do | |
| case $opt in | |
| n) |
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
| def print_compositeerror(e): | |
| sys.stderr.write("Got %d exceptions from IPython engines:\n" % | |
| len(e.elist)) | |
| for e_type, e_msg, formatted_tb, infos in e.elist: | |
| sys.stderr.write("Error from engine %d (%r):\n" % ( | |
| infos['engine_id'], infos['engine_uuid'])) | |
| sys.stderr.write("%s\n" % strip_ansi_codes(formatted_tb)) | |
| def print_remoteerror(e): |
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
| [submodule "c-matrix_to_quaternion"] | |
| path = c-matrix_to_quaternion | |
| url = https://gist.github.com/5260578.git | |
| [submodule "c-stringify"] | |
| path = c-stringify | |
| url = https://gist.github.com/5109330.git | |
| [submodule "general-color"] | |
| path = general-color | |
| url = https://gist.github.com/6284607.git | |
| [submodule "general-file_is_binary"] |
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 HTMLParser import HTMLParser | |
| import urllib2 | |
| import os | |
| import re | |
| re_url = re.compile(r'^(([a-zA-Z_-]+)://([^/]+))(/.*)?$') | |
| def resolve_link(link, url): | |
| m = re_url.match(link) |