Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
license: gpl-3.0 | |
height: 960 | |
border: no | |
redirect: https://observablehq.com/@d3/hierarchical-edge-bundling |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import httplib | |
import ssl | |
import socket | |
import sys | |
import urllib2 | |
class HTTPSConnectionV3(httplib.HTTPSConnection): | |
def __init__(self, *args, **kwargs): | |
httplib.HTTPSConnection.__init__(self, *args, **kwargs) |
{ | |
"cmd": ["build_java.sh", "$file_base_name"] | |
} |
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |
package socket.proxy; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.AsynchronousChannelGroup; | |
import java.nio.channels.AsynchronousServerSocketChannel; | |
import java.nio.channels.AsynchronousSocketChannel; | |
import java.nio.channels.CompletionHandler; | |
import java.util.Queue; |
/* | |
`arc4random_uniform` is very useful but limited to `UInt32`. | |
This defines a generic version of `arc4random` for any type | |
expressible by an integer literal, and extends some numeric | |
types with a `random` method that mitigates for modulo bias | |
in the same manner as `arc4random`. | |
`lower` is inclusive and `upper` is exclusive, thus: | |
import AVFoundation | |
import Foundation | |
// The maximum number of audio buffers in flight. Setting to two allows one | |
// buffer to be played while the next is being written. | |
private let kInFlightAudioBuffers: Int = 2 | |
// The number of audio samples per buffer. A lower value reduces latency for | |
// changes but requires more processing but increases the risk of being unable | |
// to fill the buffers in time. A setting of 1024 represents about 23ms of |
import networkx as nx | |
import graph_tool as gt | |
def get_prop_type(value, key=None): | |
""" | |
Performs typing and value conversion for the graph_tool PropertyMap class. | |
If a key is provided, it also ensures the key is in a format that can be |