Skip to content

Instantly share code, notes, and snippets.

View clearnote01's full-sized avatar

Utkarsh Raj clearnote01

  • Hamirpur, Himachal Pradesh, India
View GitHub Profile
#!/usr/bin/python3
# I hadn't considered using a max-heap for this question as I believed it would have an O(nlog(n)) solution,
# but having considered it again this is better solution than what I thought of yesterday
# O(n) to build the heap and O(klog(n)) to get k largest numbers
# This puts the complexity via this method at O(n + klog(n)) which should be better than both, my O(kn) solution or the general O(nlog(n))
# via sorting method
class MaxHeap:
def __init__(self, arr):
// Written by utkarsh raj
Text here
#!/bin/python3
# Python 3 required !!
# do 'pip3 install pysocks' for socks module
import sys
import socket
try:
import socks
except ImportError:
print('Pysocks not installed, do "pip3 install pysocks"')
#!/usr/bin/env/python3
import sys
import subprocess
import random
import threading
import logging
import time
import re
INFI = float('inf')
@clearnote01
clearnote01 / scrapper.py
Created March 9, 2016 09:54 — forked from madjar/scrapper.py
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))