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
# Deeplearning Environment Setup for tensorflow_2.3.1 with CUDA 10.1 and cuDNN 7.6.0 | |
### If you have previous installation remove it first. | |
sudo apt-get purge nvidia* | |
sudo apt remove nvidia-* | |
sudo apt remove --autoremove nvidia-cuda-toolkit | |
sudo rm /etc/apt/sources.list.d/cuda* | |
sudo apt-get autoremove && sudo apt-get autoclean | |
sudo rm -rf /usr/local/cuda* |
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 mysql.connector | |
from mysql.connector import errorcode | |
def mysql_connection(f): | |
def with_connection_(*args, **kwargs): | |
conn = mysql.connector.connect( | |
host=host, | |
user=user, |
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 jira import JIRA | |
import uvicorn | |
from pydantic import BaseModel | |
from fastapi import FastAPI | |
from fastapi.middleware.cors import CORSMiddleware | |
from fastapi.encoders import jsonable_encoder | |
from fastapi.responses import JSONResponse | |
# REST API Settings | |
app = FastAPI(title="JiraTicketApp", |
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 | |
from os.path import dirname, abspath | |
print("Path at terminal when executing this file") | |
print(os.getcwd() + "\n") | |
print("This file path, relative to os.getcwd()") | |
print(__file__ + "\n") | |
print("This file full path (following symlinks)") | |
full_path = os.path.realpath(__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
from selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
from selenium.webdriver.chrome.options import Options | |
import time | |
try: | |
language_code = "te" | |
chrome_options = Options() | |
#chrome_options.add_argument("--disable-extensions") | |
#chrome_options.add_argument("--disable-gpu") | |
chrome_options.add_argument("--headless") |
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 multiprocessing import Pool | |
# import time | |
def square(x): | |
# calculate the square of the value of x | |
# time.sleep(2) | |
return x*x | |
if __name__ == '__main__': | |
# Define the dataset |
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
# pip install --user numba | |
from numba import jit, cuda | |
import numpy as np | |
# to measure exec time | |
from timeit import default_timer as timer | |
# normal function to run on cpu | |
def func(a): | |
for i in range(10000000): |
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
# https://en.wikipedia.org/wiki/Python_(programming_language) | |
# https://www.mediawiki.org/wiki/API:Main_page | |
# 1. Get a plain text representation of either the entire page or the page "extract" straight from the API with the extracts prop | |
# Note that this approach only works on MediaWiki sites with the TextExtracts extension. This notably includes Wikipedia, but not some smaller Mediawiki sites like, say, http://www.wikia.com/ | |
# You want to hit a URL like | |
# https://en.wikipedia.org/w/api.php?action=query&format=json&titles=Bla_Bla_Bla&prop=extracts&exintro&explaintext |
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 PIL import Image as pillowimg | |
import numpy as np | |
import cv2 | |
import pytesseract | |
# PIL image | |
def check_orientation(img): | |
newdata = pytesseract.image_to_osd(np.array(img)) | |
orgi_orientation = re.search('(?<=Rotate: )\d+', newdata).group(0) | |
# check image orientation | |
if orgi_orientation != 0: |
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
***** round robin macthes ***** | |
(Even number participants) | |
---------- | |
n = no of participants | |
matches = n(n-1)/2 | |
rounds = n-1 | |
byes = 0 | |
Eg. | |
participants = 10 |
NewerOlder