Skip to content

Instantly share code, notes, and snippets.

@Justman100
Justman100 / maca
Created March 26, 2024 19:21
Script to control Caddy (ManageCaddy)
#/bin/bash
[ $(pwd) != "/home" ] && cd /home
[[ -n $(lsof -ti:80) ]] && caddy stop --config /home/Caddyfile
[[ $1 != "-os" ]] && caddy start --config /home/Caddyfile
@Justman100
Justman100 / checkFor
Last active February 13, 2024 15:08
Checks whether server-side languages (NodeJS, Python, Java etc) and databases (MariaDB / PostgreSQL etc) are installed and linked
#/bin/bash
# Usage:
## . checkFor
## checkFor PACKAGE
checkFor() {
langs=(
mysql
mariadb
@Justman100
Justman100 / getComposerSuggests.sh
Created January 19, 2024 19:56
Script, to detect not installed Composer dependencies, wich are suggeted by another Composer packages
if ! command -v composer > /dev/null ; then
echo "Composer is not installed"
exit 1
do
suggests=$(composer suggests | grep -ioP '[A-Za-z0-9]+/[A-Za-z0-9]+:')
suggests=$(echo $suggests | grep -ioP '[A-Za-z0-9]+/[A-Za-z0-9]+')
echo "$suggests" > suggests
@Justman100
Justman100 / grs.sh
Last active February 21, 2024 19:12
GenerateRandomString
#!/bin/bash
if [[ $1 ]]; then
length=$1
else
length=64
fi
tr -dc A-Za-z0-9_ < /dev/urandom | head -c $length | xargs