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
#!/usr/bin/env bash | |
# you might want to add some user authentication here | |
sudo mysql -uroot -e "show variables; show status" | awk ' | |
{ | |
VAR[$1]=$2 | |
} | |
END { | |
MAX_CONN = VAR["max_connections"] |
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 | |
# Set client and server directories as environment variables | |
# if you don't want to enter them here | |
if [ -z $CLIENT_DIR ]; then | |
echo -n "Enter directory where client files are located: " | |
read CLIENT_DIR | |
if ! cd $CLIENT_DIR; then | |
echo "Cannot access $CLIENT_DIR" |
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 | |
#============================================================================== | |
#TITLE: mysql_backup.sh | |
#DESCRIPTION: script for automating the daily mysql backups | |
#AUTHOR: haeniken | |
#DATE: 2023-03-24 | |
#VERSION: 1.0 | |
#USAGE: ./mysql_backup.sh | |
#CRON: | |
# example cron for daily db backup @ 4:10 am |
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
# ! Mostly Debian 11 | |
# DOCKER | |
curl -fsSL https://get.docker.com -o get-docker.sh | bash | |
# HELM | |
# https://helm.sh/docs/intro/install/ | |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | |
# or "curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && bash get_helm.sh" | |
# KUBECTL CLIENT |
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 | |
echo '```' | |
echo -e "\e[1;33m$ curl -LI" $1 "\e[0m" | |
curl -LI $1; | |
echo '```' |
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
curl -L -q -o /dev/null -w "\nConnect: %{time_connect}\nTTFB: %{time_starttransfer}\nTotal time: %{time_total} \n" https://haeniken.com | |
# % Total % Received % Xferd Average Speed Time Time Time Current | |
# Dload Upload Total Spent Left Speed | |
#100 386 0 386 0 0 1892 0 --:--:-- --:--:-- --:--:-- 1882 | |
#100 31510 0 31510 0 0 56368 0 --:--:-- --:--:-- --:--:-- 56368 | |
# | |
#Connect: 0,053106 | |
#TTFB: 0,553761 | |
#Total time: 0,559337 |
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
for i in haeniken.com www.haeniken.com; do echo "Domain: $i" && dig NS +short $i && dig A +short $i $i;done | |
#Domain: haeniken.com | |
#chad.ns.cloudflare.com. | |
#jill.ns.cloudflare.com. | |
#104.21.57.64 | |
#172.67.189.95 | |
#104.21.57.64 | |
#172.67.189.95 | |
#Domain: www.haeniken.com | |
#104.21.57.64 |
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
rg haeniken.com access.log | awk '{print $10}' | sort | uniq -c | |
# 130 200 | |
# 65 301 | |
# 2 302 | |
# 3 403 | |
# 21 404 | |
# 3 503 |
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
for i in {12..17}; do echo $i:00 && rg haeniken.com access.log | rg 22/Oct/2021:$i: -c; done | |
#12:00 | |
#15 | |
#13:00 | |
#12 | |
#14:00 | |
#6 | |
#15:00 | |
#18 |
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 | |
logged_on=$(who | grep -i -m 1 $1 | awk '{print $1}') | |
if [ -z $logged_on ] | |
then | |
echo "$1 is not logged on." | |
echo "Exit" | |
exit | |
fi |
NewerOlder