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
mkdir -vp $(dirname "$(nginx -t |& grep '\[emerg\]' | awk '{print $4}' | sed 's/"//g')") |
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 | |
print_cron_rules() { echo "ClNFVCBDUk9OVEFCOgoKQGhvdXJseSAvdXNyL2Jpbi9tZXJnZV9uZ2lueF9sb2dyb3RhdGVkLnNoIC92YXIvbG9nL25naW54IGhvdXIKQGRhaWx5IC91c3IvYmluL21lcmdlX25naW54X2xvZ3JvdGF0ZWQuc2ggL3Zhci9sb2cvbmdpbnggZGF5CkB3ZWVrbHkgL3Vzci9iaW4vbWVyZ2VfbmdpbnhfbG9ncm90YXRlZC5zaCAvdmFyL2xvZy9uZ2lueCB3ZWVrCkBtb250aGx5IC91c3IvYmluL21lcmdlX25naW54X2xvZ3JvdGF0ZWQuc2ggL3Zhci9sb2cvbmdpbnggbW9udGgKCg==" | base64 -d; } | |
usage() { echo "Usage: ${BASH_SOURCE[0]} [DIR] [ hour | day | week | month ] <error>"; print_cron_rules; exit 1; } ; if [[ "$#" -lt 1 ]]; then usage; fi | |
DIR="$(realpath "${1}")" | |
TIME="${2:-hour}" | |
ERROR_LOG="${3:-false}" | |
ZSTD_LEVEL="19" | |
MERGE_ROTATED_LOCKFILE="/tmp/MERGE_ROTATED_IS_RUNNING.${TIME}.lock" | |
hour() { date +hour.%d-%m-%Y_%Hh%Mm%Ss.%A ; } | |
day() { date +day.%d-%m-%Y_%Hh%Mm.%A ; } |
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 | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: `basename $0` <access.log>" | |
exit 1 | |
fi | |
awk '{print $1}' "${1}" | sort | uniq -c | sort -nr |
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 | |
#SOURCE: https://janikvonrotz.ch/2021/03/09/parse-url-in-shell-script/ | |
set -e | |
# Get script name | |
SCRIPT=$(basename "$0") | |
# Display Help | |
Help() { |
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
date +"%Y-%m-%dT%H:%M:%S%:z" |
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 | |
# Emulate systemctl for runit installed termux. | |
function check_command() { [ -x "$(command -v ${1})" ] || { echo -e "\e[31m${1} not found, please install it.\e[0m" ; return 1 ; } } | |
if ! check_command sv; then | |
if ! check_command sv-enable; then | |
if ! check_command sv-disable; then | |
exit 1 | |
fi |
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 | |
cd "$(dirname "${BASH_SOURCE[0]}")" | |
LIST=".nosend" | |
[ -f ${LIST} ] || touch ${LIST} | |
shopt -s expand_aliases | |
SLEEP="2" | |
USAGE="--send | --dry" | |
function check_command() { [ -x "$(command -v ${1})" ] || { echo -e "\e[31m${1} not found, please install it.\e[0m" ; return 1 ; } } |
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 | |
# stats function to docker-compose | |
docker-compose ps -q | xargs docker stats |
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 | |
# Installation: | |
# | |
# 1. nano /etc/ssh/sshd_config | |
# PrintMotd no | |
# | |
# 2. nano /etc/profile | |
# /usr/bin/dynmotd # Place at the bottom | |
# |
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 | |
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range | |
while : | |
do | |
PORT="`shuf -i $LOWERPORT-$UPPERPORT -n 1`" | |
ss -lpn | grep -q ":$PORT " || break | |
done | |
echo $PORT |