Source:
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 random import sample | |
from itertools import product | |
def make_trie(words): | |
root = dict() | |
for word in words: | |
parent = root | |
for letter in word: | |
parent = parent.setdefault(letter, dict()) | |
return root |
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
#!/usr/bin/env python3 | |
from argparse import ArgumentParser | |
from datetime import datetime | |
from os import stat | |
from time import sleep | |
from xml.dom.minidom import Element, parse | |
def get_viewbox_dimensions(view_box_string): |
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 axum::{ | |
extract::{ | |
ws::{Message, WebSocket, WebSocketUpgrade}, | |
State, | |
}, | |
response::Response, | |
routing::get, | |
Router, | |
}; | |
use futures::{SinkExt, StreamExt}; |
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
let m = {} | |
for (let i = 0; i < 50_000_000; i++) { m[i] = i } | |
let start = performance.now() | |
for (const _ in m) { | |
break | |
} | |
console.log(performance.now() - start) |
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 y_sweet_sdk import DocumentManager | |
import pycrdt | |
from websockets import connect | |
from pycrdt_websocket import WebsocketProvider | |
import asyncio | |
CONNECTION_STRING = "ys://localhost:8080" | |
DOC_NAME = "test_doc" | |
TEXT_NAME = "some-text" | |
async def main(): |
OlderNewer