Skip to content

Instantly share code, notes, and snippets.

View wasi0013's full-sized avatar
💤

Wasi wasi0013

💤
View GitHub Profile
@wasi0013
wasi0013 / optimized_image_check.py
Created March 23, 2019 10:51
Find un-optimized images of a webpage using requests_html python
import requests_html
def unoptimized_images(url):
"""
find unoptimized images in a webpage
:param url: webpage_url
:return : tuple of image_count in int, images list of dict
"""
session = requests_html.HTMLSession()
response = session.get(url)
images = []
@wasi0013
wasi0013 / http_version.py
Created March 23, 2019 10:31
HTTP/2 Test using requests_html by parsing keycdn website https://tools.keycdn.com/http2-test
import requests_html
def http2_enabled(url):
"""
scrape https://tools.keycdn.com/http2-test to find http 2/0 support of the given domain url
"""
url = url.replace("https://", "").replace("http://", "")
session = requests_html.HTMLSession()
response = session.get("https://tools.keycdn.com/http2-test")
@wasi0013
wasi0013 / keybase.md
Created March 14, 2019 14:42
keybase proof

Keybase proof

I hereby claim:

  • I am wasi0013 on github.
  • I am wasi0013 (https://keybase.io/wasi0013) on keybase.
  • I have a public key ASCAGYNlyVRTqJo6mqNbusXrz5U2eWcFuYYLhCB4EkhYfAo

To claim this, I am signing this object:

from abc import ABC, abstractmethod
class Polygon(ABC):
@abstractmethod
def area(self):
pass
@abstractmethod
def perimeter(self):
@wasi0013
wasi0013 / captcha_solver.py
Last active August 4, 2018 12:53
Solves basic alpha numeric captchas using pytesseract and PIL
"""
Solves basic alpha numeric captchas using pytesseract and PIL
NOTE: This program is written for testing difficulties of captchas generated by captcha generator.
PLEASE, DO NOT USE IT FOR SPAMMING OR, ABUSING SYSTEMS!
Usage:
>>> get_captcha_text("https://i.imgur.com/4u7PESk.png")
'hWA K n h'
It is also possible to use proxy i.e:
>>> proxies = {"http": "http://104.236.13.100:8888", "https": "http://104.236.13.100:8888"}
@wasi0013
wasi0013 / tkinter_autocomplete_listbox.py
Created August 25, 2017 20:27
Tkinter - Entry with Auto complete Suggestion
import tkinter as tk
import re
"""
This is slight modification of the script: https://gist.github.com/uroshekic/11078820
Changes:
- Fixed value selection
- Added Support for tab or, enter key press to select value
"""
def matches(fieldValue, acListEntry):
@wasi0013
wasi0013 / brainfry.py
Created August 4, 2016 16:46
encrypts text as unicode-emoji and decrypts encrypted unicode-emoji as text
__author__ = "wasi0013"
import urllib2
from bs4 import BeautifulSoup
import re
from fractions import gcd
import random
def affine_encrypt(text, a, b, m=26):
@wasi0013
wasi0013 / anagram.py
Created July 31, 2016 16:18
A naive implementation of an Anagram Generator
__author__ = "wasi0013"
import glob
def get_dictionary(path):
"""
returns: a dictionary of words (with sorted string as key)
from files in the path
"""
words = set()
@wasi0013
wasi0013 / digits_of_pi.py
Last active August 29, 2015 14:25
Calculates digits of pi using the Gauss-Legendre Algorithm
__author__ = "wasi0013"
'''
Calculates digits of pi using the Gauss-Legendre Algorithm
Link: https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm
'''
import decimal
import requests, bs4
@wasi0013
wasi0013 / spoj_bd_ranklist_parser.py
Created June 29, 2015 15:52
parses spoj's Bangladesh ranklist (http://www.spoj.com/ranks/users/BD/) to get 100 top users of Spoj from country Bangladesh
__author__ = "wasi0013"
"""
parses spoj's Bangladesh ranklist (http://www.spoj.com/ranks/users/BD/) to get
100 top users of Spoj from country Bangladesh
"""
import requests, bs4
url = 'http://spoj.com/ranks/users/BD'