This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get the github api personal access token from here ! | |
| # https://github.blog/2013-05-16-personal-api-tokens/ | |
| from github3 import GitHub | |
| from github3.repos.repo import Repository | |
| def create_and_get_repo(git_auth, name, description, private): | |
| repo: Repository = git_auth.create_repository( | |
| name=name, description=description, private=private | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from readability import Document | |
| def get_webpage_content(url: str): | |
| response = requests.get(url) | |
| content = "" | |
| if response.ok: | |
| content = response.content | |
| response.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from readability import Document | |
| def get_webpage_content(url: str): | |
| response = requests.get(url) | |
| content = "" | |
| if response.ok: | |
| content = response.content | |
| response.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| from collections import defaultdict | |
| from hashlib import md5 | |
| def find_duplicates(directory): | |
| # collect the hashes against file path | |
| duplicate_files_dict = defaultdict(list) | |
| # recursively iterate over each file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # imports | |
| from instapy import InstaPy | |
| from instapy import smart_run | |
| # login credentials | |
| insta_username = '' # <- enter username here | |
| insta_password = '' # <- enter password here | |
| # get an InstaPy session! | |
| # set headless_browser=True to run InstaPy in the background |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spacy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy import create_engine | |
| default_query = ("select * from pg_catalog.pg_tables where schemaname !=" | |
| "'information_schema' and schemaname != 'pg_catalog'") | |
| def create_engine_custom(username, password=None, host='localhost', db=None): | |
| password = ':' + password if password else '' | |
| db = db if db else '' | |
| engine = create_engine(f'postgresql+psycopg2://{username}{password}@{host}/{db}') | |
| return engine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy import create_engine | |
| default_query = ("select * from pg_catalog.pg_tables where schemaname !=" | |
| "'information_schema' and schemaname != 'pg_catalog'") | |
| def create_engine_custom(username, password=None, host='localhost', db=None): | |
| password = ':' + password if password else '' | |
| db = db if db else '' | |
| engine = create_engine(f'postgresql+psycopg2://{username}{password}@{host}/{db}') | |
| return engine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| from pathlib import Path | |
| import requests | |
| from tqdm import tqdm | |
| # get the size of in human readable format | |
| def sizeof_fmt(num): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import time | |
| import logging | |
| from pathlib import Path | |
| from watchdog.observers import Observer | |
| from watchdog.events import LoggingEventHandler | |
| if __name__ == "__main__": | |
| # Set the format for logging info |