Skip to content

Instantly share code, notes, and snippets.

@jinhwanlazy
jinhwanlazy / SMQT.py
Created March 15, 2016 12:06
Successive Mean Quantization Transtform. Straightforward recursive implementation.
def SMQT(data, level):
ret = [0] * len(data)
def MQU(idx, depth):
if depth == 0 or not idx:
return
mean = sum(data[i] for i in idx) / len(idx)
D0, D1 = [], []
for i in idx:
(D0 if data[i] <= mean else D1).append(i)
@jinhwanlazy
jinhwanlazy / filter_algospot.py
Last active August 29, 2015 14:23
filter problems solved with python but not by me from algospot.com
import requests
from bs4 import BeautifulSoup as bs
from itertools import chain, filterfalse
langs = {'python': ['(py)', '(pypy)', '(py3)'],
'ruby': ['(rb)']}
def get_pids(maxpage=17):