Skip to content

Instantly share code, notes, and snippets.

@yhcharles
yhcharles / a.md
Created October 5, 2022 03:41
test md

Title

head2

Inline code

Code block:

def hi():
 print('hi')
@yhcharles
yhcharles / ddp_jax.py
Created July 17, 2022 16:53
Compare distributed APIs of OneFlow and jax by implementing DistributedDataParallel
#%%
import jax
import jax.numpy as jnp
from jax import grad, pmap, lax
import numpy as np
from functools import partial
print(jax.devices())
# %%
@yhcharles
yhcharles / stage 1
Created July 16, 2020 14:45
Diagram for Godot WebRTC multiplayer connection
Title: Creating WebRTCMultiplayer using signaling server\nStage 1: init peer
p1 -> S: connect to signaling server
S -> p1: reply with ID
note over p1: init multiplayer with ID
p2 -> S: connect to signaling server
S -> p2: reply with ID
note over p2: init multiplayer with ID
S -> p2: notify p1 already connected
note over p2: init peer of p1
@yhcharles
yhcharles / function_and_generator_recursion.py
Created September 29, 2017 21:25
shows recursion using function and generator in python
#!/usr/bin/env python3
class Node(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def get_tree():
"""
@yhcharles
yhcharles / client.go
Last active August 29, 2015 14:13 — forked from spikebike/client.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)