Skip to content

Instantly share code, notes, and snippets.

View Ajax12345's full-sized avatar
:atom:
Busy....

James Petullo Ajax12345

:atom:
Busy....
View GitHub Profile
import asyncio, aiohttp, typing
import bs4, collections, re, itertools
from bs4 import BeautifulSoup as soup
import requests, urllib.parse
def format_keyword_block(block, _type):
if any((l:=i.lstrip()) and l[0]=='|' for i in block):
return ['\n'.join(i.lstrip() for i in block)]
if _type:
#Output from https://stackoverflow.com/questions/70009362/how-can-i-scrape-who-influenza-data-without-using-selenium/70013344#70013344
[{'Country, area or territory': 'United States of America', 'WHO region': 'Region of the Americas of WHO', 'Influenza transmission zone': 'North America', 'Year': '2020', 'Week': '2', 'Start date': '2020-01-06', 'End date': '2020-01-12', 'Received/ collected': '4531', 'Processed': '4531', 'A (H1)': '1338', 'A (H1N1)pdm09': '86', 'A (H3)': '34', 'A (H5)': '1458', 'A (not subtyped)': '20', 'A (Total)': '1145', 'B (Yamagata lineage)': '223', 'B (Victoria lineage)': '1388', 'B (lineage not determined)': '2846', 'B (Total)': '1685', 'Total number of influenza positive viruses': 'No Report'}, {'Country, area or territory': 'United States of America', 'WHO region': 'Region of the Americas of WHO', 'Influenza transmission zone': 'North America', 'Year': '2020', 'Week': '3', 'Start date': '2020-01-13', 'End date': '2020-01-19', 'Received/ collected': '4932', 'Processed': '4932', 'A (H1
import itertools as it, time
import random, matplotlib.pyplot as plt
from collections import Counter
def timeit(_f):
def wrapper(*args, **kwargs):
t = time.time()
_ = _f(*args, **kwargs)
return time.time() - t
return wrapper
def appler():
a = "apple"
# `return` is missing
def bananer():
b = "banana"
return b
def deeper_test(val, val1):
if val and val1:
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
"url","Vote Count","View Count","Status Strong","Status Block","Views","Question","Question_link","Excerpt","Post Tag","Post Tag_link","Asked","User Image","User Image_alt","User Image_link","User Details","User Details_link","Flair","_url_input"
"https://stackoverflow.com/questions/tagged/python","0","votes","0","answers","4 views","How to drop '_merge' column in Pandas.merge","https://stackoverflow.com/questions/61720614/how-to-drop-merge-column-in-pandas-merge","I am sorting 2 dataframes according to its accuracy. So I merge 2 df with strict conditions with how='outer', indicator=True at first then save it to a df called 'perfect'. Later I extract left_only ...","python; pandas; dataframe","https://stackoverflow.com/questions/tagged/python; https://stackoverflow.com/questions/tagged/pandas; https://stackoverflow.com/questions/tagged/dataframe","1 min ago","https://lh3.googleusercontent.com/-kEKkOCAuwhA/AAAAAAAAAAI/AAAAAAAAAAA/AAKWJJN8KMQW5vl54XYFzsMshq_5KuFm8A/photo.jpg?sz=32","","https://stackoverflow.com
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
title,price,item_num,availability,quantity,img,description,details
Baxton Studio Kima Modern and Contemporary Black Finished Wood Dresser Mirror,$70.00,KIM-Mirror,In Stock,1,http://www.wholesale-interiors.com/resize/Shared/Images/Products/Batch%20160/4194-1.jpg?bw=575&w=575,"Give any bedroom the illusion of space with the Kima mirror. The Kima features a sleek black finish on its rectangular wood frame, giving it a clean, modern look. Its large mirror adds depth and brightness to smaller spaces. Mounting hardware is included so you can attach this mirror to your dresser. The Kima mirror is made in Malaysia and requires assembly.Features:Modern and contemporary mirrorConstructed from rubberwood and mirrorBlack finishRectangular shapeDresser mounting hardware includedAssembly requiredMade in MalaysiaNatural raw materials used for construction of our furnishings will have variations in areas such as (but not limited to) color, pattern, grain and texture. This includes substances such as wood and leather. These v
We can't make this file beautiful and searchable because it's too large.
title,price,item_num,availability,quantity,img,description,details
Baxton Studio Corina Mid-Century Modern Two-Tone Walnut and Black Finished Wood TV Stand,$101.00,ET 3215-00-Columbia/Black-TV,In Stock,0,http://www.wholesale-interiors.com/resize/Shared/Images/Products/Batch%20163/10457-1.jpg?bw=575&w=575,"A retro silhouette is paired with rustic tones to give the Corina TV stand a unique, contemporary look. This wood TV stand features a chic walnut brown finish that adds warmth to any space. Two spacious shelves, fitted with cord management holes, provide room to place entertainment consoles. Additional storage space is located behind doors on either side of the shelves. Black metal hairpin legs add a cool, contemporary feel. The Corina TV stand is made in Malaysia and requires assembly.Features:Constructed from engineered wood and metalTwo-tone walnut brown and black finishTwo (2) open shelves and two (2) compartments behind doorsCord management holesBlack hairpin legsAssembly requiredMade in MalaysiaNatural
from selenium import webdriver
from bs4 import BeautifulSoup as soup
import re, time, contextlib, urllib.parse, csv
links = ['http://www.wholesale-interiors.com/wholesale-living-room-furniture.html', 'http://www.wholesale-interiors.com/wholesale-living-room-furniture/wholesale-mirrors.html']
d = webdriver.Chrome('/Users/jamespetullo/Downloads/chromedriver')
d.get('https://www.wholesale-interiors.com/store/login.aspx')
d.find_elements_by_class_name('EmailAddressTextbox')[0].send_keys('Khaslem@thehomedilly.com')
d.find_elements_by_class_name('PasswordTextbox')[0].send_keys('@Arms1984')
d.find_element_by_id('btnSignIn').send_keys('\n')
from collections import deque
import typing
class Dot:
def __init__(self):
self.pl = '*'
def __bool__(self) -> bool:
return False
def __repr__(self):
return '*'
import requests
def send_feedback(email:str) -> None:
r = requests.post(url='http://www.gutcheck.dev/api/users/HTTP/1.1',
headers={'Authorization':'Basic <username: 12625977451732, password: af05055c087e9c98b77a81f0406915a8c742551efff4c8ec241c2f73b01553de>', 'Content-Type':'application/json'},
json={
"email": email,
"first_name": "",
"last_name": "",
"first_seen": "",