mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-11-22 11:19:25 +01:00
pre-commit run --all-files
This commit is contained in:
parent
cbbe880f05
commit
803adb405f
@ -64,7 +64,7 @@ chown -R oragono:oragono $ORAGONODIR
|
|||||||
|
|
||||||
# WeeChat relay, remember to /relay sslcertkey
|
# WeeChat relay, remember to /relay sslcertkey
|
||||||
$ACMESH -d $DOMAINNAME --fullchain-file $WEECHATDIR/fullchain.pem --key-file $WEECHATDIR/privkey.pem
|
$ACMESH -d $DOMAINNAME --fullchain-file $WEECHATDIR/fullchain.pem --key-file $WEECHATDIR/privkey.pem
|
||||||
cat $WEECHATDIR/{fullchain,privkey}.pem >$WEECHATDIR/relay.pem
|
cat $WEECHATDIR/{fullchain,privkey}.pem > $WEECHATDIR/relay.pem
|
||||||
chmod -R 700 $WEECHATDIR
|
chmod -R 700 $WEECHATDIR
|
||||||
chown -R mikaela:mikaela $WEECHATDIR
|
chown -R mikaela:mikaela $WEECHATDIR
|
||||||
|
|
||||||
|
@ -7,17 +7,17 @@
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
# XMPP
|
# XMPP
|
||||||
if hash dino 2>/dev/null; then
|
if hash dino 2> /dev/null; then
|
||||||
(dino &)
|
(dino &)
|
||||||
fi
|
fi
|
||||||
if hash gajim 2>/dev/null; then
|
if hash gajim 2> /dev/null; then
|
||||||
(gajim &)
|
(gajim &)
|
||||||
else
|
else
|
||||||
(flatpak run org.gajim.Gajim --quiet &)
|
(flatpak run org.gajim.Gajim --quiet &)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Jami, mostly P2P app
|
# Jami, mostly P2P app
|
||||||
if hash jami-gnome 2>/dev/null; then
|
if hash jami-gnome 2> /dev/null; then
|
||||||
(jami-gnome -r &)
|
(jami-gnome -r &)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -25,18 +25,18 @@ fi
|
|||||||
if [ -f ~/.local/Telegram/Updater ]; then
|
if [ -f ~/.local/Telegram/Updater ]; then
|
||||||
(~/.local/Telegram/Updater -many -startintray &)
|
(~/.local/Telegram/Updater -many -startintray &)
|
||||||
else
|
else
|
||||||
if hash telegram-desktop 2>/dev/null; then
|
if hash telegram-desktop 2> /dev/null; then
|
||||||
(telegram-desktop -many -startintray &)
|
(telegram-desktop -many -startintray &)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Keybase
|
# Keybase
|
||||||
if hash run_keybase 2>/dev/null; then
|
if hash run_keybase 2> /dev/null; then
|
||||||
(run_keybase &)
|
(run_keybase &)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Steam
|
# Steam
|
||||||
if hash steam 2>/dev/null; then
|
if hash steam 2> /dev/null; then
|
||||||
(STEAM_FRAME_FORCE_CLOSE=1 steam -silent &)
|
(STEAM_FRAME_FORCE_CLOSE=1 steam -silent &)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ set -x
|
|||||||
export LC_ALL=C.utf8
|
export LC_ALL=C.utf8
|
||||||
|
|
||||||
# if hash checks that the command exists
|
# if hash checks that the command exists
|
||||||
if hash apt-get 2>/dev/null; then
|
if hash apt-get 2> /dev/null; then
|
||||||
# I am not sure if -y here even does anything, at least it won't work for
|
# I am not sure if -y here even does anything, at least it won't work for
|
||||||
# accepting suite changes for Debian when testing becomes stable.
|
# accepting suite changes for Debian when testing becomes stable.
|
||||||
# Checking for updates or new packages.
|
# Checking for updates or new packages.
|
||||||
@ -26,20 +26,20 @@ if hash apt-get 2>/dev/null; then
|
|||||||
apt-get "$@" autoremove
|
apt-get "$@" autoremove
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash dpkg 2>/dev/null; then
|
if hash dpkg 2> /dev/null; then
|
||||||
# In case dpkg was interrupted previously, configure packages.
|
# In case dpkg was interrupted previously, configure packages.
|
||||||
dpkg --configure -a
|
dpkg --configure -a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enables Fedora third party repositories if not enabled, otherwise quiet.
|
# Enables Fedora third party repositories if not enabled, otherwise quiet.
|
||||||
# My systems most likely have them already
|
# My systems most likely have them already
|
||||||
if hash fedora-third-party 2>/dev/null; then
|
if hash fedora-third-party 2> /dev/null; then
|
||||||
fedora-third-party enable
|
fedora-third-party enable
|
||||||
# Are they enabled?
|
# Are they enabled?
|
||||||
fedora-third-party query
|
fedora-third-party query
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash dnf 2>/dev/null; then
|
if hash dnf 2> /dev/null; then
|
||||||
# I don't know if -y does anything here either and I think this may be
|
# I don't know if -y does anything here either and I think this may be
|
||||||
# useless, but I am used to it coming from apt and I think it will just
|
# useless, but I am used to it coming from apt and I think it will just
|
||||||
# say nothing to do or do nothing if mirrors haven't updated.
|
# say nothing to do or do nothing if mirrors haven't updated.
|
||||||
@ -59,12 +59,12 @@ if hash dnf 2>/dev/null; then
|
|||||||
dnf -v "$@" autoremove
|
dnf -v "$@" autoremove
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash rpmconf 2>/dev/null; then
|
if hash rpmconf 2> /dev/null; then
|
||||||
# Tests if there are rpmsave/rpmnew files, hopefully is non-interactive
|
# Tests if there are rpmsave/rpmnew files, hopefully is non-interactive
|
||||||
rpmconf -a -t
|
rpmconf -a -t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash flatpak 2>/dev/null; then
|
if hash flatpak 2> /dev/null; then
|
||||||
# Flatpak apps are sandboxed and should be safe to update automatically
|
# Flatpak apps are sandboxed and should be safe to update automatically
|
||||||
# KEEP --noninteractive IN PLACE! While it removes progress bar, it also
|
# KEEP --noninteractive IN PLACE! While it removes progress bar, it also
|
||||||
# doesn't blink making it worth it in case of migraine attack.
|
# doesn't blink making it worth it in case of migraine attack.
|
||||||
@ -81,7 +81,7 @@ if hash flatpak 2>/dev/null; then
|
|||||||
flatpak uninstall --user --unused --assumeyes --noninteractive
|
flatpak uninstall --user --unused --assumeyes --noninteractive
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash snap 2>/dev/null; then
|
if hash snap 2> /dev/null; then
|
||||||
# I don't want my systems full of old snaps
|
# I don't want my systems full of old snaps
|
||||||
# > retain must be a number between 2 and 20, not "1"
|
# > retain must be a number between 2 and 20, not "1"
|
||||||
snap set system refresh.retain=2
|
snap set system refresh.retain=2
|
||||||
@ -95,19 +95,19 @@ fi
|
|||||||
# I don't have flatpak or snap going to background, because I often do
|
# I don't have flatpak or snap going to background, because I often do
|
||||||
# ./deb-update.bash && poweroff
|
# ./deb-update.bash && poweroff
|
||||||
|
|
||||||
if hash pkcon 2>/dev/null; then
|
if hash pkcon 2> /dev/null; then
|
||||||
# So PackageKit using KDE Plasma and possibly GNOME stop alerting about
|
# So PackageKit using KDE Plasma and possibly GNOME stop alerting about
|
||||||
# already installed updates. It has backends for all other package managers,
|
# already installed updates. It has backends for all other package managers,
|
||||||
# so it needs to be after them.
|
# so it needs to be after them.
|
||||||
pkcon refresh force
|
pkcon refresh force
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash apt-file 2>/dev/null; then
|
if hash apt-file 2> /dev/null; then
|
||||||
# So the local apt-file database is up-to-date.
|
# So the local apt-file database is up-to-date.
|
||||||
apt-file update
|
apt-file update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash needrestart 2>/dev/null; then
|
if hash needrestart 2> /dev/null; then
|
||||||
# needrestart batch mode, should be visible on bottom of scrollback
|
# needrestart batch mode, should be visible on bottom of scrollback
|
||||||
# see https://github.com/liske/needrestart/blob/master/README.batch.md
|
# see https://github.com/liske/needrestart/blob/master/README.batch.md
|
||||||
needrestart -b
|
needrestart -b
|
||||||
|
@ -16,4 +16,4 @@ chown -R mumble-server:mumble-server /var/lib/mumble-server/ssl/
|
|||||||
pkill $(cat /var/run/mumble-server/mumble-server.pid) -USR1
|
pkill $(cat /var/run/mumble-server/mumble-server.pid) -USR1
|
||||||
|
|
||||||
# ZNC via https://wiki.znc.in/Signed_SSL_certificate#Certbot
|
# ZNC via https://wiki.znc.in/Signed_SSL_certificate#Certbot
|
||||||
cat /etc/letsencrypt/live/relpda.mikaela.info/{privkey,fullchain}.pem >/home/znc/.znc/znc.pem
|
cat /etc/letsencrypt/live/relpda.mikaela.info/{privkey,fullchain}.pem > /home/znc/.znc/znc.pem
|
||||||
|
@ -17,7 +17,7 @@ PASSWORD=""
|
|||||||
HOSTNAME=""
|
HOSTNAME=""
|
||||||
|
|
||||||
# Get IPv4 address
|
# Get IPv4 address
|
||||||
if hash dig 2>/dev/null; then
|
if hash dig 2> /dev/null; then
|
||||||
WAN_IP4=$(dig +short myip.opendns.com. A @208.67.220.220)
|
WAN_IP4=$(dig +short myip.opendns.com. A @208.67.220.220)
|
||||||
else
|
else
|
||||||
WAN_IP4=$(curl -sL4 https://icanhazip.com/)
|
WAN_IP4=$(curl -sL4 https://icanhazip.com/)
|
||||||
@ -30,7 +30,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get IPv6 address
|
# Get IPv6 address
|
||||||
if hash dig 2>/dev/null; then
|
if hash dig 2> /dev/null; then
|
||||||
WAN_IP6=$(dig +short myip.opendns.com. AAAA @2620:0:ccd::2)
|
WAN_IP6=$(dig +short myip.opendns.com. AAAA @2620:0:ccd::2)
|
||||||
else
|
else
|
||||||
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
|
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
|
||||||
@ -46,7 +46,7 @@ fi
|
|||||||
if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then
|
if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then
|
||||||
echo "IP4 Unchanged"
|
echo "IP4 Unchanged"
|
||||||
else
|
else
|
||||||
echo $WAN_IP4 >$HOME/.wan_ip4-ydns.txt
|
echo $WAN_IP4 > $HOME/.wan_ip4-ydns.txt
|
||||||
echo "Updating DNS to $WAN_IP4"
|
echo "Updating DNS to $WAN_IP4"
|
||||||
curl -4 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
curl -4 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
||||||
https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
||||||
@ -56,7 +56,7 @@ fi
|
|||||||
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
|
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
|
||||||
echo "IP6 Unchanged"
|
echo "IP6 Unchanged"
|
||||||
else
|
else
|
||||||
echo $WAN_IP6 >$HOME/.wan_ip6-ydns.txt
|
echo $WAN_IP6 > $HOME/.wan_ip6-ydns.txt
|
||||||
echo "Updating DNS to $WAN_IP6"
|
echo "Updating DNS to $WAN_IP6"
|
||||||
curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
||||||
https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
||||||
|
@ -22,7 +22,7 @@ PASSWORD=""
|
|||||||
HOSTNAME=""
|
HOSTNAME=""
|
||||||
|
|
||||||
# Get IPv6 address
|
# Get IPv6 address
|
||||||
if hash dig 2>/dev/null; then
|
if hash dig 2> /dev/null; then
|
||||||
WAN_IP6=$(dig +short myip.opendns.com. AAAA @2620:0:ccd::2)
|
WAN_IP6=$(dig +short myip.opendns.com. AAAA @2620:0:ccd::2)
|
||||||
else
|
else
|
||||||
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
|
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
|
||||||
@ -38,7 +38,7 @@ fi
|
|||||||
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
|
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
|
||||||
echo "IP6 Unchanged"
|
echo "IP6 Unchanged"
|
||||||
else
|
else
|
||||||
echo $WAN_IP6 >$HOME/.ydns6.txt
|
echo $WAN_IP6 > $HOME/.ydns6.txt
|
||||||
echo "Updating DNS to $WAN_IP6"
|
echo "Updating DNS to $WAN_IP6"
|
||||||
curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \
|
||||||
https://ydns.io/api/v1/update/?host=$HOSTNAME\&ip=$WAN_IP6
|
https://ydns.io/api/v1/update/?host=$HOSTNAME\&ip=$WAN_IP6
|
||||||
|
@ -24,7 +24,7 @@ echo "To connect:
|
|||||||
|
|
||||||
# Device Provisioning Protocol https://iwd.wiki.kernel.org/device_provisioning
|
# Device Provisioning Protocol https://iwd.wiki.kernel.org/device_provisioning
|
||||||
# requires qrencode, so let's check it exists
|
# requires qrencode, so let's check it exists
|
||||||
if hash qrencode needrestart 2>/dev/null; then
|
if hash qrencode needrestart 2> /dev/null; then
|
||||||
# Remind of command to share
|
# Remind of command to share
|
||||||
echo "To share credentials:
|
echo "To share credentials:
|
||||||
% iwctl dpp $WIFIDEVICE start-configurator
|
% iwctl dpp $WIFIDEVICE start-configurator
|
||||||
|
@ -15,32 +15,32 @@ operand2=$3
|
|||||||
|
|
||||||
# The main case/switch which was required in the exercise
|
# The main case/switch which was required in the exercise
|
||||||
case $operator in
|
case $operator in
|
||||||
'+')
|
'+')
|
||||||
result=$((operand1 + operand2))
|
result=$((operand1 + operand2))
|
||||||
operatorWord="plus"
|
operatorWord="plus"
|
||||||
;;
|
;;
|
||||||
'-')
|
'-')
|
||||||
result=$((operand1 - operand2))
|
result=$((operand1 - operand2))
|
||||||
operatorWord="minus"
|
operatorWord="minus"
|
||||||
;;
|
;;
|
||||||
'*')
|
'*')
|
||||||
result=$((operand1 * operand2))
|
result=$((operand1 * operand2))
|
||||||
operatorWord="multiplied by"
|
operatorWord="multiplied by"
|
||||||
;;
|
;;
|
||||||
'/')
|
'/')
|
||||||
if [ "$operand2" -eq 0 ]; then
|
if [ "$operand2" -eq 0 ]; then
|
||||||
echo "The laws of mathematics don't allow division by zero."
|
echo "The laws of mathematics don't allow division by zero."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
result=$((operand1 / operand2))
|
||||||
|
operatorWord="divided by"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
# Let's not forget default case either
|
||||||
|
*)
|
||||||
|
echo "Please use operator +, -. * or /"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
;;
|
||||||
result=$((operand1 / operand2))
|
|
||||||
operatorWord="divided by"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
# Let's not forget default case either
|
|
||||||
*)
|
|
||||||
echo "Please use operator +, -. * or /"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# and finally the output in format wanted by the task
|
# and finally the output in format wanted by the task
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Ensure that the file is empty. -n is specified to avoid \n which would
|
# Ensure that the file is empty. -n is specified to avoid \n which would
|
||||||
# become obvious in the cat in the end.
|
# become obvious in the cat in the end.
|
||||||
echo -n '' >employees.csv
|
echo -n '' > employees.csv
|
||||||
|
|
||||||
# Begin at 0 so the incrementing later makes the first employee id 1.
|
# Begin at 0 so the incrementing later makes the first employee id 1.
|
||||||
employees=0
|
employees=0
|
||||||
@ -24,7 +24,7 @@ while true; do
|
|||||||
|
|
||||||
# store employee_id and name to employees.csv
|
# store employee_id and name to employees.csv
|
||||||
# I think tsv would be easier and better, but this is what the task requested.
|
# I think tsv would be easier and better, but this is what the task requested.
|
||||||
echo "$employee_id;$name" >>employees.csv
|
echo "$employee_id;$name" >> employees.csv
|
||||||
|
|
||||||
# increment employees so the next id will be 2
|
# increment employees so the next id will be 2
|
||||||
employees=$((employees + 1))
|
employees=$((employees + 1))
|
||||||
|
@ -14,10 +14,10 @@ mkdir -p ~/.local/bin/
|
|||||||
# come with and it was the original motivation for this script, so it's
|
# come with and it was the original motivation for this script, so it's
|
||||||
# difficult to start changing anything here. If you don't want it, just
|
# difficult to start changing anything here. If you don't want it, just
|
||||||
# install pypy or symlink it in path yourself!
|
# install pypy or symlink it in path yourself!
|
||||||
if ! hash pypy 2>/dev/null; then
|
if ! hash pypy 2> /dev/null; then
|
||||||
ln -sf /usr/bin/python ~/.local/bin/pypy
|
ln -sf /usr/bin/python ~/.local/bin/pypy
|
||||||
fi
|
fi
|
||||||
if ! hash pypy3 2>/dev/null; then
|
if ! hash pypy3 2> /dev/null; then
|
||||||
ln -sf /usr/bin/python3 ~/.local/bin/pypy3
|
ln -sf /usr/bin/python3 ~/.local/bin/pypy3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user