Skip to content

Instantly share code, notes, and snippets.

@aydinemre
aydinemre / wunderground_crawler.py
Last active June 19, 2023 06:26
Crawler for wunderground website
import os
from datetime import datetime
from time import sleep
import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import json
import os
import sys
from Crypto.Cipher import AES
default_paths = [
'~/Library/DBeaverData/workspace6/General/.dbeaver/credentials-config.json',
'~/.local/share/DBeaverData/workspace6/General/.dbeaver/credentials-config.json',
'~/.local/share/.DBeaverData/workspace6/General/.dbeaver/credentials-config.json',
@aydinemre
aydinemre / codility1.py
Created February 24, 2022 08:06
Codility Test Case
def solution(A: list) -> int:
"""
Get list of integers and return the number of trees with aesthetics if remove one element.
:param A: List of integers
:return: Number of trees with aesthetics if remove one element from the list
"""
cutting_way_count = 0
if is_tree_aesthetics(A):
# if the original list is a tree with aesthetics return 0
# pip install docxcompose
# Combines all word files under docs folder
import os
from pathlib import Path
from docxcompose.composer import Composer
from docx import Document as Document_compose
@aydinemre
aydinemre / trello2csv.py
Created July 1, 2021 08:47
Trello Board to csv
import math
import pandas as pd
from trello import TrelloClient
client = TrelloClient(
api_key='',
api_secret='',
)
@aydinemre
aydinemre / lyrics_collector.py
Created March 20, 2021 00:13
Get all song lyrics for single artist from sarkisozlerihd
#!/usr/bin/env python
# coding: utf-8
from time import sleep
import requests
from bs4 import BeautifulSoup
import pandas as pd
from tqdm import tqdm
from unidecode import unidecode
@aydinemre
aydinemre / selenium_test.py
Created February 27, 2021 21:39
Docker Selenium Multi Client Test.
# docker run -d -p 4444:4444 selenium/standalone-chrome:4.0.0-beta-1-20210215
# python selenium_test.py
import uuid
from datetime import datetime
from multiprocessing import Pool
from random import randint
from time import sleep
import pandas as pd
from selenium import webdriver
@aydinemre
aydinemre / json2df.py
Created February 24, 2021 15:30
pandas json type columns converter
import pandas as pd
def json2df(json_df):
def normalize_column(dataframe, column):
df = pd.json_normalize(dataframe[column]) # Normalize column
df.columns = [f"{column}.{col}" for col in df.columns]
return pd.concat([dataframe, df], axis=1).drop(columns=column)
# id
json_df['_id'] = json_df['_id'].apply(lambda _id: _id.get('$oid'))
import os
from urllib.request import urlretrieve
import pandas as pd
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from webdriver_manager.chrome import ChromeDriverManager
import itertools
import pandas as pd
from selenium import webdriver
from selenium.webdriver.support.select import Select
driver = webdriver.Chrome(executable_path='./chromedriver')
belediyeler = ['basaksehir-belediyesi-arsa-rayic']