Skip to content

Instantly share code, notes, and snippets.

View YontiLevin's full-sized avatar
👀
Looking for the umph

Yonti Levin YontiLevin

👀
Looking for the umph
View GitHub Profile
@YontiLevin
YontiLevin / chen.py
Last active August 14, 2019 02:57
n to the power of 3 dict inflation for 18 million records
from random import randint
from collections import defaultdict
from itertools import combinations
from tqdm import tqdm
P = defaultdict(int)
n = int(1e6)
for j in range(18):
print(j, len(P))
for i in tqdm(range(n)):
@YontiLevin
YontiLevin / shuffle_even_pair_constraint.py
Last active January 8, 2019 19:17
Shuffling with constraints on pairs
# stackoverflow q
# https://stackoverflow.com/questions/54041705/shuffling-with-constraints-on-pairs?fbclid=IwAR1WT2KRYX2YHcgwb1MPt8mRHMZbcLFonWlIwGvpcSCnb5yh9LxYKqdw_X4
from random import randint
from operator import itemgetter
def pop(tmp_d, last_g=1e6):
tmp = []
lens = {}
@YontiLevin
YontiLevin / create_signature_for_amazon_api.py
Created December 14, 2016 13:56
creating signed GET/POST request for Amazon Product Advertising API using python
import base64
import hmac
import hashlib
import re
def sort_by_ascii_value(left, right):
if not len(left) and not len(right):
return 0
elif not len(left) and len(right):