From 04eab0e211c8b4b45cca9d38ee4385cdddd4aa0f Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 6 Apr 2023 12:03:10 +0300 Subject: [PATCH] fix indent style --- .editorconfig | 1 - bash/acmesh-ssl.bash | 4 +- bash/addusers | 30 ++--- bash/comms.bash | 20 ++-- bash/deb-update.bash | 104 +++++++++--------- bash/deprecated/ydns-simple | 40 +++---- bash/deprecated/ydns6 | 20 ++-- bash/fixgrub.bash | 4 +- bash/iwd-wifi.bash | 10 +- ...enerator-wellBeingRegionElections2022.bash | 8 +- bash/transmission-export-magnets.bash | 12 +- bash/usr-local-bin/firefox | 8 +- bash/usr-local-bin/fluffychat | 6 +- bash/usr-local-bin/go | 4 +- bash/usr-local-bin/thunderbird | 8 +- python/pin.py | 8 +- 16 files changed, 143 insertions(+), 144 deletions(-) diff --git a/.editorconfig b/.editorconfig index 4f1cf4a..94f408a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,4 +17,3 @@ indent_size = 2 [*.{txt,markdown,md}] trim_trailing_whitespace = false indent_style = space -indent_size = 2 diff --git a/bash/acmesh-ssl.bash b/bash/acmesh-ssl.bash index a3fd37b..09345f2 100755 --- a/bash/acmesh-ssl.bash +++ b/bash/acmesh-ssl.bash @@ -9,8 +9,8 @@ # Echo a warning and exit if NOT running as root if [ "$(id -u)" != "0" ]; then - echo "acme.sh prefers root, this script demands it." 1>&2 - exit 1 + echo "acme.sh prefers root, this script demands it." 1>&2 + exit 1 fi # The domain the certs are mainly issued for diff --git a/bash/addusers b/bash/addusers index a8fd882..874b297 100755 --- a/bash/addusers +++ b/bash/addusers @@ -6,24 +6,24 @@ # Loop with the users for user in mikaela matti tommi tiina nenne anneli do - # To see that it works - echo "Current user: $user" - # Create the user & homedir if it doesn't exist - useradd -m $user - # Add the user to normal Debian groups - usermod -a -G lp,cdrom,floppy,audio,dip,plugdev,netdev,bluetooth,lpadmin "$user" - # Set user & group as the owner (in case fresh install with old /home) - chown -R $user:$user /home/$user - # Remove password & force new to be given during first login - passwd -de $user - # Does this still work? - echo "User ready: $user" + # To see that it works + echo "Current user: $user" + # Create the user & homedir if it doesn't exist + useradd -m $user + # Add the user to normal Debian groups + usermod -a -G lp,cdrom,floppy,audio,dip,plugdev,netdev,bluetooth,lpadmin "$user" + # Set user & group as the owner (in case fresh install with old /home) + chown -R $user:$user /home/$user + # Remove password & force new to be given during first login + passwd -de $user + # Does this still work? + echo "User ready: $user" done # And next sudoers for sudoer in mikaela matti tommi tiina do - # Add the user to sudo group (as they are administrator) - echo "Current sudoer: $sudoer" - usermod -a -G wheel $sudoer + # Add the user to sudo group (as they are administrator) + echo "Current sudoer: $sudoer" + usermod -a -G wheel $sudoer done diff --git a/bash/comms.bash b/bash/comms.bash index 5ab052f..029be55 100755 --- a/bash/comms.bash +++ b/bash/comms.bash @@ -8,37 +8,37 @@ set -x # XMPP if hash dino 2>/dev/null; then - (dino&) + (dino&) fi if hash gajim 2>/dev/null; then - (gajim&) + (gajim&) else - (flatpak run org.gajim.Gajim --quiet&) + (flatpak run org.gajim.Gajim --quiet&) fi # Jami, mostly P2P app if hash jami-gnome 2>/dev/null; then - (jami-gnome -r&) + (jami-gnome -r&) fi # Telegram.org if [ -f ~/.local/Telegram/Updater ] then - (~/.local/Telegram/Updater -many -startintray&) + (~/.local/Telegram/Updater -many -startintray&) else - if hash telegram-desktop 2>/dev/null; then - (telegram-desktop -many -startintray&) - fi +if hash telegram-desktop 2>/dev/null; then + (telegram-desktop -many -startintray&) + fi fi # Keybase if hash run_keybase 2>/dev/null; then - (run_keybase&) + (run_keybase&) fi # Steam if hash steam 2>/dev/null; then - (STEAM_FRAME_FORCE_CLOSE=1 steam -silent&) + (STEAM_FRAME_FORCE_CLOSE=1 steam -silent&) fi # Signal diff --git a/bash/deb-update.bash b/bash/deb-update.bash index 9340369..3125508 100755 --- a/bash/deb-update.bash +++ b/bash/deb-update.bash @@ -14,100 +14,100 @@ export LC_ALL=en_US.utf8 # if hash checks that the command exists 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 - # accepting suite changes for Debian when testing becomes stable. - # Checking for updates or new packages. - apt-get -y update + # 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. + # Checking for updates or new packages. + apt-get -y update - # potentially unsafe first time, so there hopefully is space for new kernels - apt-get "$@" autoremove + # potentially unsafe first time, so there hopefully is space for new kernels + apt-get "$@" autoremove - # If arguments like -y are passed to the script, they become "$@" - apt-get "$@" upgrade --with-new-pkgs + # If arguments like -y are passed to the script, they become "$@" + apt-get "$@" upgrade --with-new-pkgs - # potentially unsafe, second time after new kernel is installed - apt-get "$@" autoremove + # potentially unsafe, second time after new kernel is installed + apt-get "$@" autoremove fi if hash dpkg 2>/dev/null; then - # In case dpkg was interrupted previously, configure packages. - dpkg --configure -a + # In case dpkg was interrupted previously, configure packages. + dpkg --configure -a fi # Enables Fedora third party repositories if not enabled, otherwise quiet. # My systems most likely have them already if hash fedora-third-party 2>/dev/null; then - fedora-third-party enable - # Are they enabled? - fedora-third-party query + fedora-third-party enable + # Are they enabled? + fedora-third-party query fi if hash dnf 2>/dev/null; then - # 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 - # say nothing to do or do nothing if mirrors haven't updated. - dnf check-update -y + # 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 + # say nothing to do or do nothing if mirrors haven't updated. + dnf check-update -y - # potentially unsafe first time, I am not sure if this is concern outside of Debian/Ubuntu though - dnf "$@" autoremove + # potentially unsafe first time, I am not sure if this is concern outside of Debian/Ubuntu though + dnf "$@" autoremove - # If arguments like -y are passed to the script, they become "$@" - dnf "$@" upgrade + # If arguments like -y are passed to the script, they become "$@" + dnf "$@" upgrade - # potentially unsafe, see a few lines above and the apt-get section - dnf "$@" autoremove + # potentially unsafe, see a few lines above and the apt-get section + dnf "$@" autoremove fi if hash rpmconf 2>/dev/null; then - # Tests if there are rpmsave/rpmnew files, hopefully is non-interactive - rpmconf -a -t + # Tests if there are rpmsave/rpmnew files, hopefully is non-interactive + rpmconf -a -t fi if hash flatpak 2>/dev/null; then - # Flatpak apps are sandboxed and should be safe to update automatically - # KEEP --noninteractive IN PLACE! While it removes progress bar, it also - # doesn't blink making it worth it in case of migraine attack. - flatpak update --noninteractive --assumeyes - # Note to self - echo '!!! In case of weird errors e.g. while trying to checkout, try running: flatpak repair' - echo ' 404 is not a weird error, try flatpak --no-static-deltas' - # Flatpak's version of `apt autoremove` - flatpak uninstall --unused --assumeyes --noninteractive + # Flatpak apps are sandboxed and should be safe to update automatically + # KEEP --noninteractive IN PLACE! While it removes progress bar, it also + # doesn't blink making it worth it in case of migraine attack. + flatpak update --noninteractive --assumeyes + # Note to self + echo '!!! In case of weird errors e.g. while trying to checkout, try running: flatpak repair' + echo ' 404 is not a weird error, try flatpak --no-static-deltas' + # Flatpak's version of `apt autoremove` + flatpak uninstall --unused --assumeyes --noninteractive fi if hash snap 2>/dev/null; then - # Snap packages auto-update anyway though, but I like checking them while - # doing everything else too - snap refresh - # so I may have some sort of an idea when snap packages have been updated - # if they have auto-refreshed - snap changes + # Snap packages auto-update anyway though, but I like checking them while + # doing everything else too + snap refresh + # so I may have some sort of an idea when snap packages have been updated + # if they have auto-refreshed + snap changes fi # I don't have flatpak or snap going to background, because I often do # ./deb-update.bash && poweroff if hash pkcon 2>/dev/null; then - # So PackageKit using KDE Plasma and possibly GNOME stop alerting about - # already installed updates. It has backends for all other package managers, - # so it needs to be after them. - pkcon refresh force + # So PackageKit using KDE Plasma and possibly GNOME stop alerting about + # already installed updates. It has backends for all other package managers, + # so it needs to be after them. + pkcon refresh force fi if hash apt-file 2>/dev/null; then - # So the local apt-file database is up-to-date. - apt-file update + # So the local apt-file database is up-to-date. + apt-file update fi if hash needrestart 2>/dev/null; then - # needrestart batch mode, should be visible on bottom of scrollback - # see https://github.com/liske/needrestart/blob/master/README.batch.md - needrestart -b + # needrestart batch mode, should be visible on bottom of scrollback + # see https://github.com/liske/needrestart/blob/master/README.batch.md + needrestart -b fi # Sedric workaround, located in this repo. I trust /root/ if [ -f /root/fixgrub.bash ] then - /root/fixgrub.bash + /root/fixgrub.bash fi # Hide commands being executed again diff --git a/bash/deprecated/ydns-simple b/bash/deprecated/ydns-simple index ea20c5b..1ffe41a 100755 --- a/bash/deprecated/ydns-simple +++ b/bash/deprecated/ydns-simple @@ -19,46 +19,46 @@ HOSTNAME="" # Get IPv4 address 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 - WAN_IP4=$(curl -sL4 https://icanhazip.com/) + WAN_IP4=$(curl -sL4 https://icanhazip.com/) fi if [ -f $HOME/.wan_ip4-ydns.txt ]; then - OLD_WAN_IP4=$(cat $HOME/.wan_ip4-ydns.txt) + OLD_WAN_IP4=$(cat $HOME/.wan_ip4-ydns.txt) else - echo "No file, need IP4" - OLD_WAN_IP4="" + echo "No file, need IP4" + OLD_WAN_IP4="" fi # Get IPv6 address 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 - WAN_IP6=$(curl -sL6 https://icanhazip.com/) + WAN_IP6=$(curl -sL6 https://icanhazip.com/) fi if [ -f $HOME/.wan_ip6-ydns.txt ]; then - OLD_WAN_IP6=$(cat $HOME/.wan_ip6-ydns.txt) + OLD_WAN_IP6=$(cat $HOME/.wan_ip6-ydns.txt) else - echo "No file, need IP6" - OLD_WAN_IP6="" + echo "No file, need IP6" + OLD_WAN_IP6="" fi # Update IPv4 if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then - echo "IP4 Unchanged" + echo "IP4 Unchanged" else - echo $WAN_IP4 > $HOME/.wan_ip4-ydns.txt - echo "Updating DNS to $WAN_IP4" - curl -4 --basic -u "$USEREMAIL:$PASSWORD" --silent \ - https://ydns.eu/api/v1/update/?host=$HOSTNAME + echo $WAN_IP4 > $HOME/.wan_ip4-ydns.txt + echo "Updating DNS to $WAN_IP4" + curl -4 --basic -u "$USEREMAIL:$PASSWORD" --silent \ + https://ydns.eu/api/v1/update/?host=$HOSTNAME fi # Update IPv6 if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then - echo "IP6 Unchanged" + echo "IP6 Unchanged" else - echo $WAN_IP6 > $HOME/.wan_ip6-ydns.txt - echo "Updating DNS to $WAN_IP6" - curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ - https://ydns.eu/api/v1/update/?host=$HOSTNAME + echo $WAN_IP6 > $HOME/.wan_ip6-ydns.txt + echo "Updating DNS to $WAN_IP6" + curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ + https://ydns.eu/api/v1/update/?host=$HOSTNAME fi diff --git a/bash/deprecated/ydns6 b/bash/deprecated/ydns6 index ac4d0ba..e4fa739 100755 --- a/bash/deprecated/ydns6 +++ b/bash/deprecated/ydns6 @@ -24,23 +24,23 @@ HOSTNAME="" # Get IPv6 address 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 - WAN_IP6=$(curl -sL6 https://icanhazip.com/) + WAN_IP6=$(curl -sL6 https://icanhazip.com/) fi if [ -f $HOME/.ydns6.txt ]; then - OLD_WAN_IP6=$(cat $HOME/.ydns6.txt) + OLD_WAN_IP6=$(cat $HOME/.ydns6.txt) else - echo "No file, need IP6" - OLD_WAN_IP6="" + echo "No file, need IP6" + OLD_WAN_IP6="" fi # Update IPv6 if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then - echo "IP6 Unchanged" + echo "IP6 Unchanged" else - echo $WAN_IP6 > $HOME/.ydns6.txt - echo "Updating DNS to $WAN_IP6" - curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ - https://ydns.io/api/v1/update/?host=$HOSTNAME\&ip=$WAN_IP6 + echo $WAN_IP6 > $HOME/.ydns6.txt + echo "Updating DNS to $WAN_IP6" + curl -6 --basic -u "$USEREMAIL:$PASSWORD" --silent \ + https://ydns.io/api/v1/update/?host=$HOSTNAME\&ip=$WAN_IP6 fi diff --git a/bash/fixgrub.bash b/bash/fixgrub.bash index 507296a..322f219 100755 --- a/bash/fixgrub.bash +++ b/bash/fixgrub.bash @@ -11,8 +11,8 @@ set -x # There is no reason to run if dnf hasn't moved the proper config aside. if [ -f /boot/efi/EFI/fedora/grub.cfg.rpmsave ] then - rm -f /boot/efi/EFI/fedora/grub.cfg.rpmsave - grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg + rm -f /boot/efi/EFI/fedora/grub.cfg.rpmsave + grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg fi set +x diff --git a/bash/iwd-wifi.bash b/bash/iwd-wifi.bash index c67a12f..bc5e48d 100755 --- a/bash/iwd-wifi.bash +++ b/bash/iwd-wifi.bash @@ -25,14 +25,14 @@ echo "To connect: # Device Provisioning Protocol https://iwd.wiki.kernel.org/device_provisioning # requires qrencode, so let's check it exists if hash qrencode needrestart 2>/dev/null; then - # Remind of command to share - echo "To share credentials: + # Remind of command to share + echo "To share credentials: % iwctl dpp $WIFIDEVICE start-configurator " - # It needs to be stopped too - echo "To stop sharing credentials: + # It needs to be stopped too + echo "To stop sharing credentials: % iwctl dpp $WIFIDEVICE stop" # Remind me that this part exists if qrencode is not found. else - echo "WARNING! qrencode not found." + echo "WARNING! qrencode not found." fi diff --git a/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash b/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash index 7101835..1cffd3c 100755 --- a/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash +++ b/bash/piratepartyfinland/qr-generator-wellBeingRegionElections2022.bash @@ -12,10 +12,10 @@ echo "Creating to $TARGETDIR" # Function to generate QRs based on our URL scheme function generateQr () { - # $2 is first for the output as there are more regions than associations, - # avoids overwriting - # -H = 30 % damage allowing highest error correction - qrencode -l H -o $2.png "https://piraattipuolue.fi/yhdistykset/$1/aluevaaliehdokkaat-2022-$2" + # $2 is first for the output as there are more regions than associations, + # avoids overwriting + # -H = 30 % damage allowing highest error correction + qrencode -l H -o $2.png "https://piraattipuolue.fi/yhdistykset/$1/aluevaaliehdokkaat-2022-$2" } # Calling the function with associations and regions, they should be diff --git a/bash/transmission-export-magnets.bash b/bash/transmission-export-magnets.bash index 358bb64..8707d3b 100755 --- a/bash/transmission-export-magnets.bash +++ b/bash/transmission-export-magnets.bash @@ -7,10 +7,10 @@ CURRENT=1 # until $CURRENT equals $TORRENTS ? until [ $CURRENT -gt $TORRENTS ] - do - # get the information for $CURRENT? Grep the magnet line and cut out the - # frist field ("Magnet: ") using awk? - transmission-remote -l -t $CURRENT -i | grep -i magnet | awk -F': ' '{print $2}' - # increase $CURRENT - ((CURRENT++)) + do + # get the information for $CURRENT? Grep the magnet line and cut out the + # frist field ("Magnet: ") using awk? + transmission-remote -l -t $CURRENT -i | grep -i magnet | awk -F': ' '{print $2}' + # increase $CURRENT + ((CURRENT++)) done diff --git a/bash/usr-local-bin/firefox b/bash/usr-local-bin/firefox index a2468cf..6042d4d 100755 --- a/bash/usr-local-bin/firefox +++ b/bash/usr-local-bin/firefox @@ -13,18 +13,18 @@ FlagsForFirefox="--ProfileManager $@" # Developer edition (and signatures): https://releases.mozilla.org/pub/devedition/releases/ if [ -f ~/.local/firefox/firefox ] then - ~/.local/firefox/firefox $FlagsForFirefox + ~/.local/firefox/firefox $FlagsForFirefox # Fallback to global wayland installation elif [ -f /usr/bin/firefox-wayland ] then - /usr/bin/firefox-wayland $FlagsForFirefox + /usr/bin/firefox-wayland $FlagsForFirefox # Fallback to global installation elif [ -f /usr/bin/firefox ] then - /usr/bin/firefox $FlagsForFirefox + /usr/bin/firefox $FlagsForFirefox # Fallback to flatpak, don't care if it doesn't exist else - flatpak run org.mozilla.firefox $FlagsForFirefox + flatpak run org.mozilla.firefox $FlagsForFirefox fi set +x diff --git a/bash/usr-local-bin/fluffychat b/bash/usr-local-bin/fluffychat index c13997c..7ff9854 100755 --- a/bash/usr-local-bin/fluffychat +++ b/bash/usr-local-bin/fluffychat @@ -7,11 +7,11 @@ set -x if [ -f /snap/bin/fluffychat ] then - snap run fluffychat $@ + snap run fluffychat $@ elif [ -f /var/lib/flatpak/exports/bin/im.fluffychat.Fluffychat ] then - flatpak run im.fluffychat.Fluffychat $@ + flatpak run im.fluffychat.Fluffychat $@ else - /usr/bin/fluffychat + /usr/bin/fluffychat fi set +x diff --git a/bash/usr-local-bin/go b/bash/usr-local-bin/go index 6261935..82574e0 100755 --- a/bash/usr-local-bin/go +++ b/bash/usr-local-bin/go @@ -7,11 +7,11 @@ set -x # Check if go is installed through snap if [ -f /snap/bin/go ] then - snap run go $@ + snap run go $@ # Fallback to system installation else - /usr/bin/go $@ + /usr/bin/go $@ fi set +x diff --git a/bash/usr-local-bin/thunderbird b/bash/usr-local-bin/thunderbird index b3c2f0a..de9202a 100755 --- a/bash/usr-local-bin/thunderbird +++ b/bash/usr-local-bin/thunderbird @@ -12,18 +12,18 @@ FlagsForThunderbird="--ProfileManager $@" # Thunderbird (stable, beta) and signatures: https://releases.mozilla.org/pub/thunderbird/releases/ if [ -f ~/.local/thunderbird/thunderbird ] then - ~/.local/thunderbird/thunderbird $FlagsForThunderbird + ~/.local/thunderbird/thunderbird $FlagsForThunderbird # Fallback to global installation elif [ -f /usr/bin/thunderbird-wayland ] then - /usr/bin/thunderbird-wayland $FlagsForThunderbird + /usr/bin/thunderbird-wayland $FlagsForThunderbird # Fallback to global installation elif [ -f /usr/bin/thunderbird ] then - /usr/bin/thunderbird $FlagsForThunderbird + /usr/bin/thunderbird $FlagsForThunderbird # Fallback to flatpak, don't care if it doesn't exist else - flatpak run org.mozilla.Thunderbird $FlagsForThunderbird + flatpak run org.mozilla.Thunderbird $FlagsForThunderbird fi set +x diff --git a/python/pin.py b/python/pin.py index 4c02ad3..50d7adb 100755 --- a/python/pin.py +++ b/python/pin.py @@ -3,13 +3,13 @@ import sys import secrets try: - wantedCount = int(sys.argv[1]) + wantedCount = int(sys.argv[1]) except IndexError as noarg: - print("Enter a digit as an argument!") + print("Enter a digit as an argument!") try: - for i in range(int(wantedCount)): - print(secrets.randbelow(10),end="") + for i in range(int(wantedCount)): + print(secrets.randbelow(10),end="") except NameError as noWantedCount: print() print()