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/env python | |
""" | |
A simple example of using Python sockets for a client HTTPS connection. | |
""" | |
import ssl | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(('github.com', 443)) |
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
"""Simple implementation of a B+ tree, a self-balancing tree data structure that (1) maintains sort | |
data order and (2) allows insertions and access in logarithmic time. | |
""" | |
class Node(object): | |
"""Base node object. | |
Each node stores keys and values. Keys are not unique to each value, and as such values are | |
stored as a list under each key. |
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
# aproducer.py | |
# | |
# Async Producer-consumer problem. | |
# Challenge: How to implement the same functionality, but no threads. | |
import time | |
from collections import deque | |
import heapq | |
class Scheduler: |