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
#!/usr/bin/env bash | |
# Function to parse and clone repositories | |
clone_repositories() { | |
local requirements_file="$1" | |
local projects_dir="${HOME}/Projects" | |
# Validate requirements file | |
if [ ! -f "$requirements_file" ]; then | |
echo "Error: Requirements file not found." >&2 |
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
# Script Name: Cleanup-OldBackups.ps1 | |
# Description: This script deletes files older than 3 months in the specified folder on the F: drive. | |
# Define the path to the backup folder | |
$backupFolderPath = "F:\Data" # Double check path | |
# Define the age in days (3 months = 90 days) | |
$ageInDays = 90 | |
# Get the current date |
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
set-option -g history-limit 10000 | |
# Options to make tmux more pleasant | |
set -g default-terminal "tmux-256color" | |
# Configure the catppuccin plugin | |
set -g @catppuccin_flavor "mocha" # latte, frappe, macchiato, or mocha | |
set -g @catppuccin_window_status_style "rounded" # basic, rounded, slanted, custom, or none | |
run ~/.config/tmux/plugins/catppuccin/tmux/catppuccin.tmux |
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
#!/bin/bash | |
# Script to stop Kubernetes and container services on any node (control or worker) | |
echo "This script is running on node: $(hostname)" | |
# Drain the node if it's a worker (assuming hostnames like 'worker1', 'worker2', etc.) | |
kubectl drain $(hostname) --ignore-daemonsets | |
# Stopping all running containers | |
echo "Stopping containers on $(hostname)..." |
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 bs4 import BeautifulSoup | |
def scrape_page(url): | |
response = requests.get(url) | |
soup = BeautifulSoup(response.text,'lxml') | |
print(soup) | |
quotes = soup.find_all("span", class_="text") | |
authors = soup.find_all("small", class_="author") | |
tags = soup.find_all("div", class_="tags") |
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
def fileIO(inputFile='inputFile.txt'): | |
f = open(inputFile,'r') | |
output1 = "PassFile.txt" | |
output2 = "FailFile.txt" | |
passFile = open(output1,'w') | |
failFile = open(output2, 'w') | |
for line in f: | |
line_split = line.split() | |
if line_split[2] == "P": |
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 numpy | |
list_2d = [['Volkswagen', 'Mercedes', 'BMW'], ['Honda', 'Toyota', 'Mazda']] | |
def convertList(list_2d): | |
return list(numpy.concatenate(list_2d).flat) | |
print(convertList(list_2d)) # Output ['Volkswagen', 'Mercedes', 'BMW', 'Honda', 'Toyota', 'Mazda'] |
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
|
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 re | |
def convert_phone_number(phone): | |
result = re.sub(r"\b(\d{3})-(\d{3})-(\d{4})\b",r"(\1) \2-\3", phone) | |
return result | |
print(convert_phone_number("My number is 212-345-9999.")) # My number is (212) 345-9999. | |
print(convert_phone_number("Please call 888-555-1234")) # Please call (888) 555-1234 | |
print(convert_phone_number("123-123-12345")) # 123-123-12345 | |
print(convert_phone_number("Phone number of Buckingham Palace is +44 303 123 7300")) # Phone number of Buckingham Palace is +44 303 123 7300 |
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
|
NewerOlder