A basic example of using the higher level asyncio constructs such as streams in a server and client where both pass messages with regular cadence.
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
package main | |
import ( | |
"log" | |
) | |
func main() { | |
log.Println("Hello world!") | |
} |
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
{ | |
"mode": "patterns", | |
"proxySettings": [ | |
{ | |
"title": "EMR SOCKS Proxy", | |
"type": 3, | |
"color": "#cc8c2a", | |
"address": "localhost", | |
"port": 8157, | |
"proxyDNS": true, |
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 inspect | |
import pkgutil | |
from importlib import import_module | |
def get_package_modules(package): | |
"""Recursively get all modules of a package, including modules of any | |
subpackages. | |
""" | |
modules = [] | |
for _, name, ispkg in pkgutil.iter_modules(package.__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
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs). | |
# So here's a minimal Gist which worked for me as an install on a new M1 Pro. | |
# Inspired by https://github.com/malob/nixpkgs I highly recommend looking at malob's repo for a more thorough configuration | |
# | |
# Let's get started | |
# | |
# Let's install nix (at the time of writing this is version 2.5.1 | |
curl -L https://nixos.org/nix/install | sh | |
# I might not have needed to, but I rebooted |
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 merge(d1: dict, d2: dict) -> dict: | |
"""Return a new dict instance containing the recursive | |
merge of d2 into d1. Neither input is mutated. | |
""" | |
d1 = deepcopy(d1) | |
d2 = deepcopy(d2) | |
for k2, v2 in d2.items(): | |
if isinstance(v2, dict) and isinstance(v1 := d1.get(k2), dict): | |
v2 = merge(v1, v2) | |
d1[k2] = v2 |