Compare commits

..

No commits in common. "04eab0e211c8b4b45cca9d38ee4385cdddd4aa0f" and "8d0e562024dc55713a688a40363596ed5037c0c1" have entirely different histories.

28 changed files with 154 additions and 159 deletions

View File

@ -1,14 +1,14 @@
root = true
[*]
# Future: https://github.com/editorconfig/editorconfig/issues/89
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
# Accessibility reasons. Vim: :%retab! (note also :set ts=4)
indent_style = tab
indent_size = tab
max_line_length = 78
end_of_line = lf
#tab_width =
[*.{cff,yaml,yml}]
indent_style = space
@ -17,3 +17,4 @@ indent_size = 2
[*.{txt,markdown,md}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

3
.gitattributes vendored
View File

@ -1,4 +1,5 @@
* text=auto eol=lf linguist-detectable
# Line ending normalisatsion, force linguist to consider everything
* text=auto linguist-detectable
# bash scripts are most likely ran on Linux so they have lf endings
*.bash text eol=lf

View File

@ -10,12 +10,6 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- repo: https://github.com/thlorenz/doctoc
rev: v2.2.0
hooks:
- id: doctoc
# https://github.com/Mikaela/gist/blob/master/doctoc.txt
args: [--update-only]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.6"
hooks:
@ -25,4 +19,3 @@ repos:
hooks:
- id: editorconfig-checker
alias: ec
args: [-disable-max-line-length]

View File

@ -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

View File

@ -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

0
bash/backup-relpda.bash Executable file → Normal file
View File

0
bash/borgbackup-etro.bash Executable file → Normal file
View File

View File

@ -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

View File

@ -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 <subcommand> --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 <subcommand> --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

0
bash/deprecated/certbot-ssl.sh Executable file → Normal file
View File

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
VERSION=1.19.0-3
VERSION=1.18.3-2
PLATFORM=linux-amd64
# If the signature is already downloaded, don't redownload it

View File

@ -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

View File

@ -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

0
bash/oneliner/start-transmission-daemon.bash Executable file → Normal file
View File

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

0
php/IP.php Normal file → Executable file
View File

0
php/IPTITLE.php Normal file → Executable file
View File

6
php/gravatar.php Normal file → Executable file
View File

@ -18,7 +18,7 @@ Size: <input type="text" name="size">
<p>* marks required field. Only email address is required.</p>
<p>Size can be anything from 1 to 2048. If it's empty, size is
<p>Size can be anything from 1 to 2048. If it's empty, size is
80.</p>
<p>For Steam profile pictures, set size as 184.</p>
@ -28,12 +28,12 @@ Size: <input type="text" name="size">
<?php
$email = trim( $_REQUEST["email"] );
$email = trim( $_REQUEST["email"] );
$size = $_REQUEST["size"];
echo "<p>Email<br> $email<br></p>";
$email = strtolower( $email );
$email = strtolower( $email );
$md5email = md5( $email );

4
php/libravatar.php Normal file → Executable file
View File

@ -27,12 +27,12 @@ Size: <input type="text" name="size">
<?php
$email = trim( $_REQUEST["email"] );
$email = trim( $_REQUEST["email"] );
$size = $_REQUEST["size"];
echo "<p>Email<br> $email<br></p>";
$email = strtolower( $email );
$email = strtolower( $email );
$md5email = md5( $email );

View File

@ -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()

0
ruby/ipfsbin.rb Executable file → Normal file
View File