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
export const CHAT_CHANNEL = "chat" | |
export function waitForAllICE(peerConnection) { | |
return waitForEvent((fulfill) => { | |
peerConnection.onicecandidate = (iceEvent) => { | |
if (iceEvent.candidate === null) | |
fulfill() | |
} | |
}) |
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
<html> | |
<head> | |
<title>WebRTC</title> | |
<script type="module"> | |
import * as common from './common.js'; | |
async function start() { | |
const peerConnection = initializeBeforeReceivingOffer() | |
await receiveOfferSDP(peerConnection) | |
await sendAnswerSDP(peerConnection) |
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
from concurrent.futures import process | |
import os | |
from typing import Iterable, Iterator | |
import time | |
from dask.distributed import Client | |
def main(): | |
folder_path = "data" | |
filepaths = get_filepaths(folder_path) | |
lines = get_lines(filepaths) |
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
/* Fonts */ | |
/* Family */ | |
h1 { | |
font-family: 'Julius Sans One', sans-serif; | |
} | |
h2 { /* Contact, Skills, Education, About me, Work Experience */ | |
font-family: 'Archivo Narrow', sans-serif; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
background: rgb(204,204,204); | |
width: 21cm; | |
height: 29.7cm; | |
margin: 0 auto; | |
} |
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 redis | |
DISTRIBUTED_CACHE_TOP_PHRASES_KEY = 'top-phrases:' | |
class Frontend: | |
def __init__(self): | |
self._distributed_cache = redis.Redis(host=os.getenv("DISTRIBUTED_CACHE_HOST"), port=6379, db=0) | |
# Using Cache Aside Pattern | |
def top_phrases_for_prefix(self, prefix): |
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
min_lexicographic_char = chr(0) | |
max_lexicographic_char = chr(255) | |
PARTITIONS = (min_lexicographic_char, 'mod'), ('mod', max_lexicographic_char) | |
class Backend: | |
def __init__(self): | |
self.backend_number = self.find_self_partition() | |
def _attempt_to_join_target(self, target_id): | |
if (not target_id or self._zk.exists(f'/phrases/distributor/{target_id}') is None): |
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
... | |
class Backend: | |
def __init__(self): | |
self._trie = Trie() | |
self.partition_index = self.find_self_partition() | |
def find_self_partition(self): | |
cli = docker.Client(base_url='unix://var/run/docker.sock') | |
all_containers = cli.containers() | |
# filter out ourself by HOSTNAME |
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
... | |
min_lexicographic_char = chr(0) | |
max_lexicographic_char = chr(255) | |
PARTITIONS = (min_lexicographic_char, 'mod'), ('mod', max_lexicographic_char) | |
... | |
class TrieBuilder: | |
def build(self, target_id): | |
for start, end in PARTITIONS: |
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
... | |
from hdfs import InsecureClient | |
from hdfs.ext.avro import AvroReader | |
class HdfsClient: | |
def __init__(self, namenode_host, datanode_host): | |
self._namenode_host = namenode_host | |
self._datanode_host = datanode_host | |
self._client = InsecureClient(f'http://{self._namenode_host}:9870') |
NewerOlder