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 | |
# Note: Adjust rsync flags as needed for your specific requirements | |
# Author: Hiran P | |
# Date: 2024-07-19 | |
# Description: A script to perform parallel rsync operations with optional continuous sync using inotifywait | |
#### Usage #### | |
## ./para_rsync.sh --exclude-from /path/to/exclude_me.txt |
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 | |
# Get the current time in UTC | |
CURRENT_TIME=$(date -u +'%FT%T') | |
EARLIER=$(date -u -d '-1 hour' +'%FT%T') | |
echo "Current Time: $CURRENT_TIME" | |
echo "One Hour Earlier: $EARLIER" | |
# Calculate four hours earlier |
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 av | |
import streamlink | |
streams = streamlink.streams('https://www.youtube.com/watch?v=7DtRPJ2crTA') | |
s = streams['720p'] | |
c = av.open(s.url, format='segment') | |
for f in c.decode(video=0): | |
print(f) |
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 | |
# Version: 1.0.2 | |
# ORGIGNAL: https://github.com/f5devcentral/f5-oci-failover/blob/master/oci-curl | |
# Updated by: hiran.patel on 2024-06-25 | |
# Usage: | |
# oci-curl <host> <method> [file-to-send-as-body] <request-target> [extra-curl-args] | |
# | |
# ex: | |
# oci-curl iaas.us-ashburn-1.oraclecloud.com get "/20160918/instances?compartmentId=some-compartment-ocid" | |
# oci-curl iaas.us-ashburn-1.oraclecloud.com post ./request.json "/20160918/vcns" |
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 pandas | |
import json | |
excel_data_df = pandas.read_excel('Security-List.xls', sheet_name='Ingress') | |
excel_data_ds = pandas.read_excel('Security-List.xls', sheet_name='Egress') | |
#Ingress Rules JSON | |
json_str = excel_data_df.to_json(orient='records') | |
#Egress Rules JSON |
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 | |
import random | |
import re | |
import string | |
## OCI Console: | |
## Password must be 9 to 30 characters and contain at least 2 uppercase, 2 lowercase, 2 special, and 2 numeric characters. | |
## The special characters must be _, #, or -. | |
MAX_LENGTH = 30 |
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 | |
# https://github.com/first20hours/google-10000-english | |
CWD = os.path.dirname(os.path.realpath(__file__)) | |
with open(os.path.join(CWD, "google-10000-english.txt")) as f: | |
words = [line.strip() for line in f] | |
# Convert single alphabet letters to their numeric values | |
for i in range(len(words)): | |
word = words[i] |
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 env | |
# Purge sensitive files from a git repo | |
# Based on https://help.github.com/articles/remove-sensitive-data/ | |
# Better option: https://rtyley.github.io/bfg-repo-cleaner/ | |
# Get current repo from .git/config | |
CURRENT_REPO=$(git config --get remote.origin.url) | |
echo $CURRENT_REPO | |
CURRENT_REPO_NAME=$(basename $CURRENT_REPO) | |
echo $CURRENT_REPO_NAME |
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 | |
# Get list of processes writing to /var using lsof | |
# https://serverfault.com/questions/315091/find-out-which-process-is-writing-into-a-specific-directory | |
# output_file="processes.csv" | |
# if [ ! -f "$output_file" ]; then | |
# touch "$output_file" | |
# fi |
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
def convert_json_to_yaml(json_string: str) -> str: | |
"""Converts a JSON string to YAML format. | |
Handles both JSON objects and arrays. | |
Args: | |
json_string: The JSON string to convert. | |
Returns: | |
The YAML representation of the JSON string. |
NewerOlder