- Svelte
- SvelteKit
- Xinu Approach (halfway)
- Typescript
- FastAPI
- GraphQl
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
PORT=31337 | |
APPLICATION_ID=1337 |
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
import time | |
def time_cache(ttl: int): | |
def decorator(func): | |
ttls = {} | |
return_cache = {} | |
def wrapper(*args, **kwargs): | |
key = (*args,) + tuple([(k, v) for k, v in kwargs.items()]) |
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
import time | |
import socket | |
OUTPUT = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Hello World!</title></head><body>Hello World!</body></html>' | |
class WebServer: | |
def __init__(self, connection): | |
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
self.socket.bind(connection) |
I compared 7 functions, which solely purpose was to figure out the indices of every uppercase letter.
I used timeit
and plot the results using pyplot.
I wrote 6 testcases:
TEST_CASES = (
"Hello World!",
"".join(random.choice(string.ascii_letters) for _ in range(50)),
"".join(random.choice(string.ascii_letters) for _ in range(100)),
"".join(random.choice(string.ascii_letters) for _ in range(200)),
NewerOlder