Skip to content

Instantly share code, notes, and snippets.

View VanishMax's full-sized avatar
🧠
Buildin' my own open-source

Max Korsunov VanishMax

🧠
Buildin' my own open-source
View GitHub Profile
// Tag can be string or a function if we parse the functional component
type Tag = string | ((props: any, children: any[]) => JSX.Element);
// Attributes of the element – object or null
type Props = Record<string, string> | null;
// Element children – return value from the h()
type Children = (Node | string)[];
export const h = (tag: Tag, props: Props, ...children: Children) => {
@VanishMax
VanishMax / main.py
Created September 27, 2020 07:23
Vector clock algorithm for DS Lab8
"""
This is the improved version of the code given in the article
https://towardsdatascience.com/understanding-lamport-timestamps-with-pythons-multiprocessing-library-12a6427881c6
Shows three communicating processes with the vector clock for synchronization.
Result of running this code is:
Final vector in A is [7, 8, 3]
Final vector in B is [4, 8, 3]
Final vector in C is [1, 5, 4]
@VanishMax
VanishMax / client.py
Created September 19, 2020 11:24
Socket file transfer client-server implementation by Maxim Korsunov
import sys
import os
import time
import socket
# Create connection with the server on specific port
sock = socket.socket()
sock.connect((sys.argv[2], int(sys.argv[3])))
address = sys.argv[1]