Skip to content

Instantly share code, notes, and snippets.

View SubhadityaMukherjee's full-sized avatar

Subhaditya Mukherjee SubhadityaMukherjee

View GitHub Profile
dls.show_batch()
#How many categories of fruits do we have?
dls.c # no of categories
```py
import os
from fastai.vision.all import *
from fastai.vision.widgets import *
# Set the base directory where Kaggle saves its data. Change this if you are on your machine.
root_dir = "../input/fruits/fruits-360_dataset/fruits-360/Training"
```
path = Path(root_dir) # base path
fields = DataBlock(
blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
get_y=get_parent_name,
splitter=RandomSplitter(valid_pct=0.2, seed=42),
item_tfms=RandomResizedCrop(64, min_scale=0.5),
batch_tfms=aug_transforms(),
)
dls = fields.dataloaders(path)
def get_parent_name(x):
return x.parent.name
list_of_orgs = [
] # Enter a list of organizations you created
"""
eg: list_of_orgs = [
"backups", "image-process", "old-codes"
]
"""
sites = '''
''' # A comma separated list of repository names
#eg : algos, dsa, theylia, zeus
for i, site in tqdm(enumerate(sites.split(",")), total=len(sites.split(","))):
site = f"https://github.com/{user_name}/{site}"
repo_name = str(site).split("/")[-1].strip()
# Go to site
browser.get(site+"/settings")
# Choose organization
puts = to_put[i]
if puts == "D":
browser.find_element_by_xpath(
'//*[@id="options_bucket"]/div[10]/ul/li[4]/details/summary').click()
sites = sites.replace(" ", "") # Just make sure it works
assert len(sites.split(",")) == len(to_put)
actions = ActionChains(browser) # Syntax for selenium to send a bunch of keypresses
browser.get('https://github.com/login')
time.sleep(1)
chain_actions(actions, [email, Keys.TAB, passw, Keys.TAB, Keys.ENTER])
time.sleep(1)
if browser.lower() == "chrome":
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
opts = Options()
browser = Chrome(options=opts)
elif browser.lower() == "firefox":
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
opts = Options()
browser = Firefox(options=opts)
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from tqdm import tqdm
browser = "chrome" # or firefox
user_name = "" # github username
email = "" # your login creds
passw = "" # your password (please please do not push this to github)
pip freeze > requirements.txt #for pip
conda list --export #for conda