Skip to content

Instantly share code, notes, and snippets.

import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import polars as pl
import matplotlib as mpl
import requests
from datetime import datetime, timedelta
import enum
import time
from playsound import playsound
import threading
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
class QueueCachedTaskRunner<T> implements Runnable {
private final BlockingQueue<T> queue;
private ExecutorService executor;
private AtomicLong taskCount = new AtomicLong();
QueueCachedTaskRunner(int queueSize, int numThread) {
this.queue = new LinkedBlockingQueue<>(queueSize);
@yanfenglee
yanfenglee / tcp_stupid.c
Last active September 11, 2015 06:01
stupid tcp
/*
* stupid congestion control
*
*/
#include <linux/module.h>
#include <net/tcp.h>
static int fixed_cwnd __read_mostly = 1000;
module_param(fixed_cwnd, int, 0644);
(defn get-hash [type data]
(.digest (java.security.MessageDigest/getInstance type) (.getBytes data) ))
(defn sha1-hash [data]
(get-hash "sha1" data))
(defn get-hash-str [data-bytes]
(apply str
(map
#(.substring