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 cx_Oracle | |
| import pandas as pd | |
| from datetime import datetime | |
| # Connection details | |
| dsn_tns = cx_Oracle.makedsn('hostname', 'port', service_name='servicename') | |
| conn = None | |
| # Accept user input for the date | |
| user_date = input("Enter the date to check (format DD.MM.YYYY): ") |
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 zipfile | |
| # Function to unzip all files in the current directory | |
| def unzip_files_in_directory(password): | |
| # Get the directory where the script is located | |
| script_directory = os.path.dirname(os.path.realpath(__file__)) | |
| # List all files in the directory | |
| files = os.listdir(script_directory) |
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
| # PowerShell script to check network connectivity and send email alerts if servers are not reachable | |
| Set-ExecutionPolicy Bypass -Scope Process -Force | |
| # The servers to check for | |
| $serverNames = @("server1", "server2", "server3", "server4") | |
| # Email settings | |
| $recipients = 'mail1@ofrecipient.com','mail2@ofrecipient.com','mail3@ofrecipient.com' # Replace with the actual recipient email addresses | |
| $from = "sender@mail.com" |
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 cx_Oracle | |
| import pandas as pd | |
| import smtplib | |
| import os | |
| from email.message import EmailMessage | |
| # Database Connection Details | |
| DB_CONNECTION_STRING = "add connection string here" | |
| # Email Configuration |
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 pandas as pd | |
| def html_table_to_excel(html_file, output_excel_file): | |
| try: | |
| # Read the HTML file and extract all tables | |
| tables = pd.read_html(html_file) | |
| # Create a Pandas Excel writer using openpyxl | |
| with pd.ExcelWriter(output_excel_file, engine='openpyxl') as writer: | |
| # Loop through each table found in the HTML |
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 fitz # PyMuPDF | |
| from docx import Document | |
| from docx.shared import Pt | |
| from docx.enum.text import WD_ALIGN_PARAGRAPH | |
| def extract_text_from_pdf(pdf_path, pages=None): | |
| document = fitz.open(pdf_path) | |
| text = [] | |
| if pages is None: |
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 | |
| def replace_text_in_file(file_path, search_text, replace_text, edited_lines): | |
| try: | |
| with open(file_path, 'r', encoding='utf-8', errors='ignore') as file: | |
| lines = file.readlines() | |
| modified = False | |
| new_lines = [] | |
| for i, line in enumerate(lines): |
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.webdriver.edge.service import Service | |
| from selenium.webdriver.common.by import By | |
| from selenium.webdriver.support.ui import WebDriverWait | |
| from selenium.webdriver.support import expected_conditions as EC | |
| import time | |
| webdriver_service = Service('Path to \msedgedriver.exe') | |
| driver = webdriver.Edge(service=webdriver_service) | |
| driver.get("https://sitetorefresh.com") |
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 pyautogui | |
| import time | |
| import keyboard # For detecting the Escape key press, install with pip install keyboard | |
| def main(): | |
| # Get the screen width and height | |
| screen_width, screen_height = pyautogui.size() | |
| # Calculate the center of the screen | |
| center_x, center_y = screen_width / 2, screen_height / 2 |
OlderNewer