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 argparse | |
import random | |
import math | |
import queue | |
import time | |
import logging | |
import threading | |
import dns.resolver | |
import datetime |
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 slider | |
import "time" | |
type Window struct { | |
start int64 | |
count int64 | |
} | |
func (window *Window) Start() time.Time{ |
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 selectors import DefaultSelector, EVENT_READ, EVENT_WRITE | |
import socket | |
import time | |
selector = DefaultSelector() | |
jobs = 0 | |
class Future: | |
def __init__(self): | |
self.callback = 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
// An algorithm that randomly chooses an item from this stream such that | |
// each item is equally likely to be selected. | |
// AKA : Reservoir Sampling | |
package main | |
import ( | |
"math" | |
"math/rand" | |
"sync" |
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 ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
) |
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 multiprocessing import Process | |
import threading | |
import queue | |
import time | |
import dns.resolver | |
from queue import Queue | |
TERM_SIGNAL = "TERM" | |
ServerListFile = "./example.txt" | |
MaxWorker = 10 |
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
# -*- coding: utf-8 -*- | |
pattern = "acabacacd" | |
text = "acaacabacabacacda" | |
def create_prefix_table(p): | |
size = len(p) | |
table = [0]*size |
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 | |
from threading import Thread | |
from queue import Queue | |
# class style generator | |
class Ticker(): | |
def __init__(self, second): | |
self.sleep = second | |
def __iter__(self): |
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 argparse | |
import random | |
import math | |
import queue | |
import time | |
import logging | |
import threading | |
import dns.resolver | |
import datetime |
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 Queue: | |
def __init__(self): | |
self.queue = [] | |
def enqueue(self, item): | |
self.queue.append(item) | |
def dequeue(self): | |
if self.size() < 1: | |
return None |
NewerOlder