This file contains 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
#!/bin/bash | |
pattern="$1" | |
shopt -s nullglob | |
command="ls -t1 "$pattern" | head -1" | |
echo "Executing: $command" | |
fileName=$(eval $command) | |
shopt -u nullglob |
This file contains 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 time | |
from typing import Dict | |
import pyautogui as pag | |
from selenium import webdriver | |
from selenium.webdriver.chrome.service import Service | |
from webdriver_manager.chrome import ChromeDriverManager | |
def fill_form_tab_seq(form_data: Dict): |
This file contains 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 csv | |
from typing import Dict, List | |
import re | |
import requests | |
from requests.exceptions import RequestException | |
def expand_url(url): | |
try: |
This file contains 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 pathlib import Path | |
from urllib.parse import urlparse | |
from bs4 import BeautifulSoup | |
import requests | |
SAVE_DIR = Path(os.path.dirname(os.path.abspath(__file__))) / 'save' | |
TO_SAVE_DIR = ['Movies', 'TV Shows', 'Music', 'Books', 'Games', 'Software', 'Pictures'] |
This file contains 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
""" | |
Problem statement: Next week's winning lottery numbers are 8 different numbers all in the range 11 to 99 inclusive | |
Three, and only three of them are prime numbers and the sum of these three is 265 | |
Of the other 5, just two of them are even, and when these 2 are multiplied together they make 1332 | |
The mean of the remaining 3 is 23 | |
What are the eight winning lottery numbers? | |
""" | |
# (x + y + z) == 265 and all((is_prime(num) for num in (x, y, z))) | |
# all((is_even(num) for num in (p, q))) and p * q == 1332 |
This file contains 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 typing import Literal, List, Any, Union | |
from browser import document, prompt, html, window | |
def print_formatted(_header: List[str], _items: List[List[Union[str, Any]]], | |
padding=10, alignment="^"): | |
""" | |
Function to print header along with list of list in tabular format. | |
:param alignment: ^ -center alignment; | |
< -left alignment; |
This file contains 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
string = "XSmPyeyHlTFjlvoIM.ZCuTlvrLkyVYjdJBqtdM SozWLxOrayj" | |
# unscrambling start | |
x = 0 | |
result = "" | |
while True: | |
ch = string[x] | |
if ch == '.': | |
print(result[1:]) # print the result string omitting the first character | |
break |
This file contains 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 pprint | |
from math import radians, sin, cos | |
import numpy as np | |
class Angle: | |
""" | |
class for interconversion of angle in degrees and radians | |
""" |
This file contains 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 time | |
import typing | |
def profiler(fn: typing.Callable): | |
"""to be used as a function decorator for monitoring execution time of a function""" | |
def inner(): | |
start_time = time.perf_counter_ns() | |
fn() | |
elapsed = time.perf_counter_ns() - start_time |
This file contains 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 | |
from PyQt5.QtCore import (QRectF, Qt, QPropertyAnimation, pyqtProperty, | |
QPoint, QParallelAnimationGroup, QEasingCurve) | |
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen | |
from PyQt5.QtWidgets import (QLabel, QWidget, QVBoxLayout, QApplication, | |
QLineEdit, QPushButton) | |
class BubbleLabel(QWidget): |
NewerOlder