Skip to content

Instantly share code, notes, and snippets.

View ayushkalani's full-sized avatar
💻

Ayush Kalani ayushkalani

💻
View GitHub Profile
@VarunVats9
VarunVats9 / ConsumerTask.java
Last active April 15, 2024 02:44
Count Min Sketch
import java.util.concurrent.BlockingQueue;
public class ConsumerTask implements Runnable {
private static final int H1 = 0;
private static final int H2 = 1;
private static final int H3 = 2;
private static final int H4 = 3;
final static int LIMIT = 100;
@pmcao
pmcao / thread-safe-hit-counter.py
Created March 17, 2016 22:24
Thread-safe hit counter
import time
import random
import threading
class HitCounter():
"""A thread-safe website hit counter using circular array
N: last N seconds we want to keep the number of hits
Assumption: number of hit per second < sys.maxsize of Python
"""
def __init__(self, N=300): # default 5 minutes (300 seconds)
@voidfiles
voidfiles / textrank.py
Created January 20, 2012 08:22
An implmentation of TextRank in python
"""
From this paper: http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Mihalcea.pdf
I used python with nltk, and pygraph to do an implmentation of of textrank.
for questions: http://twitter.com/voidfiles
"""
import nltk
import itertools