Compare commits

...

3 Commits

16 changed files with 140 additions and 83 deletions

View File

@ -9,7 +9,7 @@ ci:
# the frequency of unnecessary PRs.
# https://github.com/pre-commit-ci/issues/issues/83
autoupdate_schedule: quarterly
skip: [pylint]
skip: [pylint, pnpm-prettier]
# use pypy3 for python
default_language_version:
@ -71,17 +71,24 @@ repos:
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.0"
- repo: local
hooks:
- id: prettier
exclude_types: [python, pyi, jupyter]
additional_dependencies: [
# https://www.npmjs.com/package/prettier
"prettier@3.2.5",
# https://www.npmjs.com/package/@prettier/plugin-ruby
"@prettier/plugin-ruby@4.0.4",
]
- id: pnpm-prettier
name: prettier
entry: pnpm exec prettier --cache --ignore-unknown --write
language: system
exclude_types: [json]
# - repo: https://github.com/rbubley/mirrors-prettier
# rev: "v3.3.0"
# hooks:
# - id: prettier
# exclude_types: [python, pyi, jupyter]
# additional_dependencies: [
# # https://www.npmjs.com/package/prettier
# "prettier@3.2.5",
# # https://www.npmjs.com/package/@prettier/plugin-ruby
# "@prettier/plugin-ruby@4.0.4",
# ]
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
@ -89,11 +96,11 @@ repos:
#Refer to pyproject.toml
#args: ["--line-length", "79", "--target-version", "py310"]
#- id: black-jupyter
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.8.0-1
hooks:
- id: shfmt
#- id: shfmt-docker
# - repo: https://github.com/scop/pre-commit-shfmt
# rev: v3.8.0-1
# hooks:
# - id: shfmt
#- id: shfmt-docker
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.3"
hooks:

View File

@ -0,0 +1,4 @@
{
"plugins": ["@prettier/plugin-ruby", "prettier-plugin-sh"],
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }]
}

View File

@ -64,7 +64,7 @@ chown -R oragono:oragono $ORAGONODIR
# WeeChat relay, remember to /relay sslcertkey
$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
chown -R mikaela:mikaela $WEECHATDIR

View File

@ -7,17 +7,17 @@
set -x
# XMPP
if hash dino 2>/dev/null; then
if hash dino 2> /dev/null; then
(dino &)
fi
if hash gajim 2>/dev/null; then
if hash gajim 2> /dev/null; then
(gajim &)
else
(flatpak run org.gajim.Gajim --quiet &)
fi
# Jami, mostly P2P app
if hash jami-gnome 2>/dev/null; then
if hash jami-gnome 2> /dev/null; then
(jami-gnome -r &)
fi
@ -25,18 +25,18 @@ fi
if [ -f ~/.local/Telegram/Updater ]; then
(~/.local/Telegram/Updater -many -startintray &)
else
if hash telegram-desktop 2>/dev/null; then
if hash telegram-desktop 2> /dev/null; then
(telegram-desktop -many -startintray &)
fi
fi
# Keybase
if hash run_keybase 2>/dev/null; then
if hash run_keybase 2> /dev/null; then
(run_keybase &)
fi
# Steam
if hash steam 2>/dev/null; then
if hash steam 2> /dev/null; then
(STEAM_FRAME_FORCE_CLOSE=1 steam -silent &)
fi

View File

@ -10,7 +10,7 @@ set -x
export LC_ALL=C.utf8
# 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
# accepting suite changes for Debian when testing becomes stable.
# Checking for updates or new packages.
@ -26,20 +26,20 @@ if hash apt-get 2>/dev/null; then
apt-get "$@" autoremove
fi
if hash dpkg 2>/dev/null; then
if hash dpkg 2> /dev/null; then
# 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
if hash fedora-third-party 2> /dev/null; then
fedora-third-party enable
# Are they enabled?
fedora-third-party query
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
# 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.
@ -59,12 +59,12 @@ if hash dnf 2>/dev/null; then
dnf -v "$@" autoremove
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
rpmconf -a -t
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
# KEEP --noninteractive IN PLACE! While it removes progress bar, it also
# 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
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
# > retain must be a number between 2 and 20, not "1"
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
# ./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
# 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
if hash apt-file 2> /dev/null; then
# So the local apt-file database is up-to-date.
apt-file update
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
# see https://github.com/liske/needrestart/blob/master/README.batch.md
needrestart -b

View File

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

View File

@ -17,7 +17,7 @@ PASSWORD=""
HOSTNAME=""
# 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)
else
WAN_IP4=$(curl -sL4 https://icanhazip.com/)
@ -30,7 +30,7 @@ else
fi
# 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)
else
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
@ -46,7 +46,7 @@ fi
if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then
echo "IP4 Unchanged"
else
echo $WAN_IP4 >$HOME/.wan_ip4-ydns.txt
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
@ -56,7 +56,7 @@ fi
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
echo "IP6 Unchanged"
else
echo $WAN_IP6 >$HOME/.wan_ip6-ydns.txt
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

View File

@ -22,7 +22,7 @@ PASSWORD=""
HOSTNAME=""
# 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)
else
WAN_IP6=$(curl -sL6 https://icanhazip.com/)
@ -38,7 +38,7 @@ fi
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
echo "IP6 Unchanged"
else
echo $WAN_IP6 >$HOME/.ydns6.txt
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

View File

@ -24,7 +24,7 @@ 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
if hash qrencode needrestart 2> /dev/null; then
# Remind of command to share
echo "To share credentials:
% iwctl dpp $WIFIDEVICE start-configurator

View File

@ -15,32 +15,32 @@ operand2=$3
# The main case/switch which was required in the exercise
case $operator in
'+')
result=$((operand1 + operand2))
operatorWord="plus"
;;
'-')
result=$((operand1 - operand2))
operatorWord="minus"
;;
'*')
result=$((operand1 * operand2))
operatorWord="multiplied by"
;;
'/')
if [ "$operand2" -eq 0 ]; then
echo "The laws of mathematics don't allow division by zero."
'+')
result=$((operand1 + operand2))
operatorWord="plus"
;;
'-')
result=$((operand1 - operand2))
operatorWord="minus"
;;
'*')
result=$((operand1 * operand2))
operatorWord="multiplied by"
;;
'/')
if [ "$operand2" -eq 0 ]; then
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
else
result=$((operand1 / operand2))
operatorWord="divided by"
fi
;;
# Let's not forget default case either
*)
echo "Please use operator +, -. * or /"
exit 1
;;
;;
esac
# and finally the output in format wanted by the task

View File

@ -2,7 +2,7 @@
# Ensure that the file is empty. -n is specified to avoid \n which would
# 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.
employees=0
@ -24,7 +24,7 @@ while true; do
# store employee_id and name to employees.csv
# 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
employees=$((employees + 1))

View File

@ -14,10 +14,10 @@ mkdir -p ~/.local/bin/
# 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
# 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
fi
if ! hash pypy3 2>/dev/null; then
if ! hash pypy3 2> /dev/null; then
ln -sf /usr/bin/python3 ~/.local/bin/pypy3
fi

View File

@ -5,7 +5,7 @@
set -x
if [ -f /usr/bin/code ]; then
/usr/bin/code --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform,WebContentsForceDark --ozone-platform-hint=x11 "$@"
/usr/bin/code --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform,WebContentsForceDark --ozone-platform-hint=wayland "$@"
elif [ -f /snap/bin/code ]; then
# https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491/comments/104

View File

@ -5,7 +5,7 @@
set -x
if [ -f /usr/bin/codium ]; then
/usr/bin/codium --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform,WebContentsForceDark --ozone-platform=x11 "$@"
/usr/bin/codium --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform,WebContentsForceDark --ozone-platform=wayland "$@"
elif [ -f /snap/bin/codium ]; then
# https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491/comments/104

View File

@ -1,6 +1,7 @@
{
"devDependencies": {
"@prettier/plugin-ruby": "4.0.4",
"prettier": "3.3.0"
"prettier": "3.3.1",
"prettier-plugin-sh": "0.14.0"
}
}

65
pnpm-lock.yaml generated vendored
View File

@ -9,10 +9,13 @@ importers:
devDependencies:
"@prettier/plugin-ruby":
specifier: 4.0.4
version: 4.0.4(prettier@3.3.0)
version: 4.0.4(prettier@3.3.1)
prettier:
specifier: 3.3.0
version: 3.3.0
specifier: 3.3.1
version: 3.3.1
prettier-plugin-sh:
specifier: 0.14.0
version: 0.14.0(prettier@3.3.1)
packages:
"@prettier/plugin-ruby@4.0.4":
@ -23,17 +26,59 @@ packages:
peerDependencies:
prettier: ^3.0.0
prettier@3.3.0:
mvdan-sh@0.10.1:
resolution:
{
integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==,
integrity: sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==,
}
prettier-plugin-sh@0.14.0:
resolution:
{
integrity: sha512-hfXulj5+zEl/ulrO5kMuuTPKmXvOg0bnLHY1hKFNN/N+/903iZbNp8NyZBTsgI8dtkSgFfAEIQq0IQTyP1ZVFQ==,
}
engines: { node: ">=16.0.0" }
peerDependencies:
prettier: ^3.0.3
prettier@3.3.1:
resolution:
{
integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==,
}
engines: { node: ">=14" }
hasBin: true
snapshots:
"@prettier/plugin-ruby@4.0.4(prettier@3.3.0)":
dependencies:
prettier: 3.3.0
sh-syntax@0.4.2:
resolution:
{
integrity: sha512-/l2UZ5fhGZLVZa16XQM9/Vq/hezGGbdHeVEA01uWjOL1+7Ek/gt6FquW0iKKws4a9AYPYvlz6RyVvjh3JxOteg==,
}
engines: { node: ">=16.0.0" }
prettier@3.3.0: {}
tslib@2.6.3:
resolution:
{
integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==,
}
snapshots:
"@prettier/plugin-ruby@4.0.4(prettier@3.3.1)":
dependencies:
prettier: 3.3.1
mvdan-sh@0.10.1: {}
prettier-plugin-sh@0.14.0(prettier@3.3.1):
dependencies:
mvdan-sh: 0.10.1
prettier: 3.3.1
sh-syntax: 0.4.2
prettier@3.3.1: {}
sh-syntax@0.4.2:
dependencies:
tslib: 2.6.3
tslib@2.6.3: {}