Skip to content

Instantly share code, notes, and snippets.

import asyncio
import aiohttp
import time
import json
import statistics
from dataclasses import dataclass, asdict
from typing import List, Dict, Tuple, Optional
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from collections import deque
@gamer496
gamer496 / .vimrc
Last active September 11, 2017 09:35
My vimrc for easy portability
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@gamer496
gamer496 / Flask - Logging Requests
Created March 28, 2017 13:06 — forked from ivanleoncz/flask_app_logging.py
Logging every request received from Flask.
#/usr/bin/python
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
import traceback
app = Flask(__name__)
@gamer496
gamer496 / ser.py
Created February 24, 2017 11:47
A simple script to copy the post data to clipboard. Useful when using no-machine
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from sys import argv
import subprocess
def write_to_clipboard(output):
process = subprocess.Popen('pbcopy', env = {'LANG': 'en_US.UTF-8'}, stdin = subprocess.PIPE)
process.communicate(output.encode('utf-8'))
class S(BaseHTTPRequestHandler):
@gamer496
gamer496 / haz.py
Created February 14, 2017 17:24
selenium-brok
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from BeautifulSoup import BeautifulSoup
import requests
import time
def page_has_loaded(driver):
# driver.log.info("Checking if {} page is loaded.".format(driver.driver.current_url))
@gamer496
gamer496 / leet.js
Created February 14, 2017 17:23
Js snippet to find out how many questions left in leetcode this excludes locked and already solved problems.
var a=document.getElementsByTagName("td");
var j=0;
for(var i=0;i<a.length;i++){
if(a[i].innerText=="Easy" || a[i].innerText=="Medium" || a[i].innerText=="Hard"){
j++;
}
}
var z=0;
var b=document.getElementsByTagName("i")
for(var i=0;i<b.length;i++){