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 numpy as np | |
from bokeh.plotting import output_notebook, show, figure | |
from bokeh.models import Plot, CustomJS, TapTool, ColumnDataSource, Line, DataRange1d | |
output_notebook() | |
p = figure() | |
t = np.linspace(0, 5, 100) | |
l1 = p.line(t, np.sin(t), color='#ff0000', nonselection_color='#888', line_width=5) | |
l2 = p.line(t, np.sin(t+1), color='#00ff00', nonselection_color='#888', line_width=5) | |
#l3 = p.line(t, np.sin(t+2), color='#0000ff', nonselection_color='#888', line_width=5) |
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
D:\dev>conda build pyapps\conda-recipes\freeimage | |
Removing old build environment | |
Removing old work directory | |
BUILD START: freeimage-3.17.0-vc10_1 | |
Fetching package metadata: ........ | |
Solving package specifications: ........... | |
The following NEW packages will be INSTALLED: | |
msvc_runtime: 1.0.1-vc10_0 [vc10] | |
pip: 7.1.2-py34_0 |
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
# Copyright 2016 (C) Almar Klein. Consider this 2-clause BSD licensed. | |
""" | |
I initially wrote this to be included in flexx for multiple processes | |
on the same machine to communicate, more specifically, to allow a Flexx | |
CLI to get info on and terminate running server processes. I tested it | |
to work on Windows and Linux. I eventuially discarded this approach | |
because I don't fully get how UDP multicast works. It's important for | |
this to only work for localhost, and I am not sure if it does, or how | |
hard it is to compromise this. I went with a simpler approach based on | |
http requests using Tornado. |
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
## Option 1 - strings for verbatim html, dicts for elements with attributes | |
class MyReactlikeWidget(ReactLike): | |
name = event.StringProp('john', settable=True) | |
def render(self): | |
return ['greet: ', | |
dict(type='b', | |
onclick=lambda:print('clicked!'), | |
innerHTML='hi ' + self.name), |
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
"use strict"; | |
function base64encode(b, last_two) { | |
"use strict"; | |
console.assert(b.BYTES_PER_ELEMENT == 1); | |
// Most Base64 encoders use +/ for the last two characters, but not all | |
if (last_two === undefined) last_two = '+/'; | |
// Init charcodes array | |
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + last_two; | |
var charcodes = new Uint8Array(64); |
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 os | |
def trim_py_files(*directories): | |
"""Remove trailing whitespace on all .py files in the given directories. | |
""" | |
nchanged = 0 | |
for directory in directories: | |
for root, dirs, files in os.walk(directory): | |
for fname in files: |
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
""" | |
Implementation of an iterator that yields the lines in a file in reverse order. | |
Copyright (C) 2018, Almar Klein | |
BSD licensed. | |
""" | |
## ===== The code ===== | |
def readlines_reversed(f): |
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
<html> | |
<script src='dist/plotly.js'></script> | |
<body> | |
<div id='myDiv'></div> | |
<script> | |
var source = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAlCAYAAAAA7LqSAAADmklEQVR4nO2XUWhTVxjHfyfdmKMN1oelK9QSLUVY2RWHrEKtLw66KQX30Ifpg0qxz31wb8O0UNjL1I3h09iDAy000D0Z0DJhEdslBXN7SwZBJmmbErKwNuU2UXDes4d4r700bib33KflD+Ge8+We78sv3/fdcy401VRTTTXVVFMIvxwnEhG5c97fP+lbLPARZHz8qBwY+AAA0zTp69MA/4B8cTo+flRq2n4MY42dMMFgEICRkZ+Uxw2odgigafudq2majn3nWLV8ATGMNdf44cPfd9lVyxeQwcF3MIw1gsEgY2OLzM9fYmDgPebnLzlQquVLj1y//pFcWan+R1eujLm+KxYTHDr0o/K4b6l2GI2efPnY3eTUqSMUiwmgBQDD+ANNC6sOCSgurUxmVAKUSpfp6tpHLJYiFksBL4AXaFr45Vy9lGUkkxmVhpEll9ukra1q6+raB+D68d3d76oK6ZKSjGQyozIWS5HLbVIujwCQyz0jHL4LVIHsT3f3r0xNfS3/zV8jUlpaNsT6eoS2tq/Q9TnSaZOZmRAzMyFKpcvo+hz5fEE5jGcQOxt2GeXzBQC2t6fY3p5y3bu+HnFsqmE8gdh9AThlZGtr67kzDoU6CIU6nPnGxioXLnzD0NCXLC7+rQTGE4jd3MePJ9H1OQBu3PjW2SO2tp6TTvfQ2dnhWjc9PSvs++2rVyl7aun6XTY2Vl22dLqHw4erp97Ozg6WlnqIRqfFqzVqIMADiL3x7cyGrb1733bGds8ArvK6f/+HRkPXVMNHhWj0pMzlNkkmw46tvT1NofAUTXtfPnnyrKbvgwf3yImJpPIznufSOns2C8Dt22EKhafMzq6Kf |
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>three.js sandbox</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
</head> | |
<body> | |
<div id='infodiv' style=""></div> | |
<script src='https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.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
from datetime import datetime | |
import numpy as np | |
import time | |
n = 100000 | |
mark1 = datetime.now() |