Skip to content

Commit

Permalink
rm unused scripts, fix shellcheck/ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elohmeier committed Jun 5, 2024
1 parent 5b15779 commit 43cd1d9
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 239 deletions.
8 changes: 4 additions & 4 deletions modules/nixos/nix-security-box/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e

tmpdir=$(mktemp -d)

trap "rm -rf $tmpdir" EXIT
trap 'rm -rf "$tmpdir"' EXIT

wget https://github.com/fabaff/nix-security-box/archive/refs/heads/main.zip -O $tmpdir/nix-security-box.zip
unzip $tmpdir/nix-security-box.zip -d $tmpdir
cp -r $tmpdir/nix-security-box-main/*.nix .
wget https://github.com/fabaff/nix-security-box/archive/refs/heads/main.zip -O "$tmpdir"/nix-security-box.zip
unzip "$tmpdir"/nix-security-box.zip -d "$tmpdir"
cp -r "$tmpdir"/nix-security-box-main/*.nix .
4 changes: 2 additions & 2 deletions packages/firefox-configs/extract-prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
prefs = {}

with open(sys.stdin.fileno()) as f:
for l in f:
for line in f:
m = re.match(
r"(defaultPref|pref|lockPref)\(\"(?P<key>[a-zA-Z\.0-9_\-]+)\",\s+(?P<value>[%\?=#,:/\- _\.a-zA-Z\"0-9]+)\);",
l,
line,
)
if m:
val = m.group("value")
Expand Down
1 change: 1 addition & 0 deletions packages/logseq-query/generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i sh -p nodePackages.node2nix
#shellcheck shell=sh

exec node2nix --development --input package.json --output node-packages.nix --composition node-composition.nix
23 changes: 0 additions & 23 deletions scripts/bwrap-chromium.sh

This file was deleted.

31 changes: 0 additions & 31 deletions scripts/bwrap-firefox.sh

This file was deleted.

23 changes: 0 additions & 23 deletions scripts/bwrap-wlfreerdp.sh

This file was deleted.

5 changes: 3 additions & 2 deletions scripts/choose-browser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ case "$profile" in
--dir /run/user/"$(id -u)" \
--ro-bind /run/current-system/sw/bin /run/current-system/sw/bin \
--ro-bind /run/user/"$(id -u)"/pulse /run/user/"$(id -u)"/pulse \
--ro-bind /run/user/"$(id -u)"/$WAYLAND_DISPLAY /run/user/"$(id -u)"/$WAYLAND_DISPLAY \
--ro-bind /run/user/"$(id -u)"/"$WAYLAND_DISPLAY" /run/user/"$(id -u)"/"$WAYLAND_DISPLAY" \
--proc /proc \
--bind ~/.mozilla ~/.mozilla \
--bind ~/.cache/mozilla ~/.cache/mozilla \
Expand All @@ -49,6 +49,7 @@ case "$profile" in
--setenv PATH /run/current-system/sw/bin \
--die-with-parent \
--new-session \
$(readlink $(which firefox)) "$@"
"$(readlink "$(which firefox)")" -P bwrap-enno "$@"

;;
esac
2 changes: 1 addition & 1 deletion scripts/domain-search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
pwgen -s 3 -A -1 200 |
while read -r line; do
domain="${line}.de"
whois "$domain" | egrep -q 'Status: free' && echo "$domain is available"
whois "$domain" | grep -E -q 'Status: free' && echo "$domain is available"
done
2 changes: 1 addition & 1 deletion scripts/imapdedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def process(options, mboxes: List[str]):
try:
if not options.process:
server.login(options.user, options.password)
except:
except imaplib.IMAP4.error:
sys.stderr.write("\nError: Login failed\n")
sys.exit(1)

Expand Down
1 change: 1 addition & 0 deletions scripts/iommu-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p pciutils
#shellcheck shell=bash
shopt -s nullglob
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}
Expand Down
2 changes: 2 additions & 0 deletions scripts/make-pdf-look-scanned.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

convert -density 150 input.pdf -colorspace gray -linear-stretch 3.5%x10% -blur 0x0.5 -attenuate 0.25 +noise Gaussian -rotate 0.5 temp.pdf

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -sColorConversionStrategy=LeaveColorUnchanged dAutoFilterColorImages=true -dAutoFilterGrayImages=true -dDownsampleMonoImages=true -dDownsampleGrayImages=true -dDownsampleColorImages=true -sOutputFile=output.pdf temp.pdf
4 changes: 2 additions & 2 deletions scripts/read-co2-status.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

export $(grep -v '^#' /run/keys/hass-cli.env | xargs -d '\n')
export "$(grep -v '^#' /run/keys/hass-cli.env | xargs -d '\n')"
json=$(hass-cli -o json state get sensor.fraam_co2_mhz19b_carbondioxide)
state=$(echo $json | jq -r '.[0].state')
state=$(echo "$json" | jq -r '.[0].state')
class=""

if ((state > 1000)); then
Expand Down
144 changes: 0 additions & 144 deletions scripts/read-mediaplayer-status.py

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/unlock-rpi4.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
#!/usr/bin/env bash

for disk in "mysql" "photoprism" "syncthing"; do
echo "Sending key for $disk"
pass admin/rpi4/${disk}.luks | ssh [email protected] "cat >/run/keys/${disk}.luks"
pass admin/rpi4/${disk}.luks | ssh [email protected] 'cat > /run/keys/${disk}.luks'
done

echo "Unlocking disks"
Expand Down
8 changes: 4 additions & 4 deletions scripts/xrandr-utm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
w="${1?provide width}"
h="${2?provide height}"

modeline=$(cvt $w $h 60 | sed -n 2p | cut -c 10-)
mode=$(perl -pe 's/(\"[\w\.]+\").*/$1/' <<<$modeline)
modeline=$(cvt "$w" "$h" 60 | sed -n 2p | cut -c 10-)
mode=$(perl -pe 's/(\"[\w\.]+\").*/$1/' <<<"$modeline")
if ! xrandr | grep -q "$mode"; then
echo adding new mode $mode
xrandr --newmode $modeline
echo adding new mode "$mode"
xrandr --newmode "$modeline"
xrandr --addmode "Virtual-1" "$mode"
fi

Expand Down

0 comments on commit 43cd1d9

Please sign in to comment.