Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2302,12 +2302,22 @@ def parse_script_metadata(filepath):
"name": os.path.basename(filepath).replace(".sh", "").replace("_", " ").title(),
"desc": "",
"tag": "",
"url": "",
"path": filepath,
}
try:
with open(filepath, "r", encoding="utf-8", errors="replace") as f:
for line in f:
line = line.strip()
if line.startswith("# name:"):
metadata["name"] = line[7:].strip()
elif line.startswith("# desc:"):
metadata["desc"] = line[7:].strip()
elif line.startswith("# tag:"):
metadata["tag"] = line[6:].strip()
elif line.startswith("# url:"):
metadata["url"] = line[6:].strip()
elif not line.startswith("#") and line:
if line.startswith('# name:'):
name_val = line[7:].strip()
if name_val:
Expand Down
2 changes: 1 addition & 1 deletion favorites.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["docker/list_containers.sh", "linux/test123.sh"]
["docker/list_containers.sh", "linux/test123.sh", "devops-tools/docker_status.sh"]
29 changes: 29 additions & 0 deletions scripts/dev-tools/base64_tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
# name: Base64 Utility
# desc: Quick base64 encoder and decoder.
# tag: dev-tools

GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'

echo -e "${BLUE}====================================================${NC}"
echo -e "${GREEN} BASE64 UTILITY ${NC}"
echo -e "${BLUE}====================================================${NC}"

echo -e "Select action:"
echo -e "1) ${YELLOW}Encode${NC} text to Base64"
echo -e "2) ${YELLOW}Decode${NC} Base64 to text"
read -p "Enter Choice (1 or 2): " CHOICE

if [ "${CHOICE}" = "1" ]; then
read -p "Enter text to encode: " PLAIN_TEXT
echo -n "${PLAIN_TEXT}" | base64
elif [ "${CHOICE}" = "2" ]; then
read -p "Enter base64 string to decode: " B64_TEXT
echo -n "${B64_TEXT}" | base64 --decode
echo ""
else
echo "Invalid option selected."
fi
36 changes: 36 additions & 0 deletions scripts/devops-tools/docker_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# name: Docker Status
# desc: Checks docker service status and lists containers and images.
# tag: devops-tools

GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'

echo -e "${BLUE}====================================================${NC}"
echo -e "${GREEN} DOCKER STATUS REPORT ${NC}"
echo -e "${BLUE}====================================================${NC}"

if ! command -v docker &> /dev/null; then
echo -e "${RED}Error: Docker CLI is not installed on this machine.${NC}"
exit 1
fi

echo -e "\n${YELLOW}[Docker Daemon Health]${NC}"
if docker info &> /dev/null; then
echo -e "${GREEN}Docker daemon is running perfectly.${NC}"
else
echo -e "${RED}Docker daemon is not running or accessible without root.${NC}"
exit 1
fi

echo -e "\n${YELLOW}[Running Containers]${NC}"
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"

echo -e "\n${YELLOW}[Resource Usage Summary]${NC}"
docker stats --no-stream --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" 2>/dev/null || echo "Stats unavailable"

echo -e "\n${YELLOW}[Active Images]${NC}"
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" | head -n 10
60 changes: 60 additions & 0 deletions scripts/devops-tools/resource_monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
# name: Resource Alarm Monitor
# desc: Continuously checks CPU, Memory, and Disk, throwing colorful alerts when thresholds are breached.
# tag: devops-tools

GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'

CPU_THRESHOLD=80
MEM_THRESHOLD=85
DISK_THRESHOLD=90

echo -e "${BLUE}====================================================${NC}"
echo -e "${GREEN} RESOURCE ALARM MONITOR ${NC}"
echo -e "${BLUE}====================================================${NC}"

echo -e "CPU Alert Limit: ${YELLOW}${CPU_THRESHOLD}%${NC}"
echo -e "RAM Alert Limit: ${YELLOW}${MEM_THRESHOLD}%${NC}"
echo -e "Disk Alert Limit: ${YELLOW}${DISK_THRESHOLD}%${NC}\n"

DISK_USAGE=$(df -h / | tail -1 | awk '{print $5}' | sed 's/%//')
if [ "${DISK_USAGE}" -gt "${DISK_THRESHOLD}" ]; then
echo -e "${RED}[ALERT] Disk usage is critically high: ${DISK_USAGE}%${NC}"
else
echo -e "${GREEN}[OK] Disk Usage: ${DISK_USAGE}%${NC}"
fi

if [ "$(uname)" = "Darwin" ]; then
MEM_USAGE=$(memory_pressure | grep "System-wide memory free percentage" | awk '{print 100 - $5}')
if [ -z "${MEM_USAGE}" ]; then
MEM_USAGE=$(vm_stat | awk '/free/ {free=$3} /active/ {active=$3} /inactive/ {inactive=$3} END {total=free+active+inactive; print (active+inactive)/total*100}' | cut -d. -f1)
fi
else
MEM_USAGE=$(free | grep Mem | awk '{print int($3/$2 * 100)}')
fi

if [ -n "${MEM_USAGE}" ]; then
if [ "${MEM_USAGE}" -gt "${MEM_THRESHOLD}" ]; then
echo -e "${RED}[ALERT] Memory usage is critically high: ${MEM_USAGE}%${NC}"
else
echo -e "${GREEN}[OK] Memory Usage: ${MEM_USAGE}%${NC}"
fi
fi

if [ "$(uname)" = "Darwin" ]; then
CPU_USAGE=$(ps -A -o %cpu | awk '{s+=$1} END {print int(s)}')
else
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)}')
fi

if [ -n "${CPU_USAGE}" ]; then
if [ "${CPU_USAGE}" -gt "${CPU_THRESHOLD}" ]; then
echo -e "${RED}[ALERT] CPU load is high: ${CPU_USAGE}%${NC}"
else
echo -e "${GREEN}[OK] CPU Load: ${CPU_USAGE}%${NC}"
fi
fi
23 changes: 23 additions & 0 deletions scripts/devops-tools/ssl_expiry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# name: SSL Expiry Checker
# desc: Check and verify SSL/TLS certificate validity and expiration for any web host.
# tag: devops-tools, ssl
# url: https://www.ssllabs.com/ssltest/

echo "=== SSL Expiry Checker ==="
read -p "Enter domain (e.g. google.com): " domain
if [ -z "$domain" ]; then
domain="google.com"
fi
echo "Connecting to $domain:443..."
echo ""
if ! command -v openssl >/dev/null 2>&1; then
echo "Error: openssl utility is not installed."
exit 1
fi
res=$(echo | openssl s_client -servername "$domain" -connect "$domain":443 2>/dev/null | openssl x509 -noout -dates -issuer)
if [ -z "$res" ]; then
echo "Failed to retrieve SSL certificate details."
else
echo "$res"
fi
Loading
Loading