Skip to content

Instantly share code, notes, and snippets.

View Haeniken's full-sized avatar
:octocat:
Hello there

Haeniken Haeniken

:octocat:
Hello there
View GitHub Profile
@Haeniken
Haeniken / mysql_show_mem.sh
Created April 15, 2023 07:02
mysql memory
#!/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"]
@Haeniken
Haeniken / extractor.sh
Created March 23, 2023 08:25
Azeroth-core extractor
#!/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"
@Haeniken
Haeniken / mysql_backup.sh
Last active April 1, 2023 12:21
Bash Script to backup all MySQL databases with LZMA (long, very compressed)
#!/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
@Haeniken
Haeniken / Fast tulz install
Last active March 5, 2023 03:33
Fast tulz install
# ! 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
@Haeniken
Haeniken / c.sh
Created October 31, 2021 12:53
curl location and headers
#!/bin/bash
echo '```'
echo -e "\e[1;33m$ curl -LI" $1 "\e[0m"
curl -LI $1;
echo '```'
@Haeniken
Haeniken / ttfbbycurl.sh
Created October 22, 2021 18:25
TTFB by curl
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
@Haeniken
Haeniken / Fastdig
Created October 22, 2021 15:55
Fast dig ns and a
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
@Haeniken
Haeniken / sortrespcodes.sh
Created October 22, 2021 15:53
Sorting response codes Nginx
rg haeniken.com access.log | awk '{print $10}' | sort | uniq -c
# 130 200
# 65 301
# 2 302
# 3 403
# 21 404
# 3 503
@Haeniken
Haeniken / requestsbyhours.sh
Created October 22, 2021 15:51
Nginx requests by hours analyser
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
@Haeniken
Haeniken / message.sh
Created October 22, 2021 15:48
Messenger
#!/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