1
0
Fork 0

add bin scripts

This commit is contained in:
Vladimír Dudr 2022-05-12 11:31:44 +02:00
parent b707165a25
commit 0fc00b599c
3 changed files with 62 additions and 0 deletions

39
bin/executable_jwg Normal file
View file

@ -0,0 +1,39 @@
#!/bin/bash
enable() {
if [[ -e /etc/systemd/network/wg0.netdev ]]
then
echo 'Config already enabled'
elif [[ ! -e /etc/systemd/network/wg0.netdev.disabled ]]
then
echo 'No disabled config found!'
else
mv -v /etc/systemd/network/wg0.netdev{.disabled,}
fi
systemctl restart systemd-networkd
}
disable() {
if [[ -e /etc/systemd/network/wg0.netdev ]]
then
mv -v /etc/systemd/network/wg0.netdev{,.disabled}
else
echo 'No config found!'
fi
networkctl delete wg0
systemctl restart systemd-networkd
}
if (( "$(id -u)" != 0 ))
then
exec sudo "$0" "$@"
fi
case "$1" in
enable|up) enable ;;
disable|down) disable ;;
*) wg ;;
esac

3
bin/executable_phpactor Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
exec /bin/php "$HOME/devel/phpactor/bin/phpactor" "$@"

20
bin/executable_showcert Normal file
View file

@ -0,0 +1,20 @@
#!/bin/zsh
coproc ( : | openssl s_client -connect $1:443 2>/dev/null| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/' | openssl x509 -in - -noout -startdate -enddate -ext subjectAltName | sed '/X509v3 Subject Alternative Name/ {n ; s/DNS://g ; s/, /\n /g;}' )
exec 3> >(LC_ALL=C sort)
sort=0
while read -p line
do
if [[ $line = notBefore=* ]]
then
if (( sort == 1 ))
then
echo " $line" >&3
else
[[ $line = 'X509v3 Subject Alternative Name:' ]] && sort=1
echo $line
fi
done