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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func main() { | |
m := http.NewServeMux() |
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 flask import Flask | |
import psutil | |
import time | |
import datetime | |
app = Flask(__name__) | |
start_time = time.time() | |
def in_docker(): | |
""" Returns: True if running in a Docker container, else False """ |
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 math import ceil | |
from random import randint, random | |
from math import e, pow | |
from copy import deepcopy | |
from time import time | |
def swap(transmission: list, period: list, i=None, j=None) -> tuple: | |
if i is None: | |
i, j = randint(0, n-1), randint(0, n-1) | |
transmission_time[i], transmission_time[j] = transmission_time[j],transmission_time[i] |
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 matplotlib.pyplot as plt | |
import os | |
def read_thread_time(): | |
with open('thread_time', 'r') as file: | |
s = file.read() | |
s = s.split(',')[:-1] | |
s = [round(float(i),3) for i in s] | |
return s |
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
def Compress(s): | |
dictionary = {chr(i):i for i in range(0,255)} # create dictionary according to ascii code | |
last = 256 # the size of dictionary | |
p = "" | |
result = [] | |
for c in s: | |
pc = p+c | |
if pc in dictionary: | |
p = pc # if pc in dictionary then try to append next character until pc is not in dictionary | |
else: |