From fd6def1ae1dfac893d6de4f397325b3e23a7dbe2 Mon Sep 17 00:00:00 2001 From: ange Date: Fri, 20 Jun 2025 04:36:33 +0000 Subject: [PATCH] cleanup --- .config/bash/10-aliases.bash | 5 ++--- .config/bookmarks | 5 ----- .config/suckless/install.sh | 4 +--- .local/bin/ddev | 6 +++--- .local/bin/ffcapture | 3 +-- .local/bin/ffreduce | 1 - .local/bin/lock | 2 +- .local/bin/vm | 37 +++++++++++++++++++++--------------- .local/bin/wallpaper | 3 +-- .local/bin/wlp | 2 +- 10 files changed, 32 insertions(+), 36 deletions(-) diff --git a/.config/bash/10-aliases.bash b/.config/bash/10-aliases.bash index 72ea7e7..af0f3c6 100644 --- a/.config/bash/10-aliases.bash +++ b/.config/bash/10-aliases.bash @@ -26,7 +26,7 @@ bat() { if [ -z "$1" ]; then return 1 fi - TERM='tty' $EDITOR --cmd "set lines=$(grep -c '' "$1")" +redraw +q "$1" + TERM='tty' $EDITOR --cmd "set lines=$(wc -l "$1")" +redraw +q "$1" } bd() { @@ -96,9 +96,8 @@ alias -- \ sudo='sudo ' \ vi='$EDITOR' \ watch='watch -c ' \ - waydroid='cage -- waydroid' \ xargs='xargs ' \ - xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file $XDG_CONFIG_HOME/monero/ange' + xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file="$XDG_STATE_HOME/monero.log" --wallet-file "$XDG_DATA_HOME/monero/ange"' . /usr/share/git/completion/git-completion.bash $(complete -p git) g c diff --git a/.config/bookmarks b/.config/bookmarks index 4f859d2..37f9202 100644 --- a/.config/bookmarks +++ b/.config/bookmarks @@ -1,16 +1,11 @@ # vim: tabstop=8 nowrap # TODO -https://www.seek.com.au/devops-jobs/remote?worktype=245%2C244 -https://www.sncf-connect.com/app/catalogue/description/carte-avantage-jeune https://anubis.techaro.lol/docs/admin/installation -https://wiki.nftables.org/wiki-nftables/index.php/Scripting https://tech.yahoo.com/articles/mozilla-vpns-per-controls-too-182238290.html https://help.gnome.org/users/zenity/stable/notification.html.en -https://serverfault.com/questions/1150627/bind9-behind-nginx-reverse-proxy-doh/1168780#1168780 https://www.grepular.com/Automatically_Encrypting_all_Incoming_Email https://www.grepular.com/Protecting_a_Laptop_from_Simple_and_Sophisticated_Attacks -https://www.rtcsec.com/article/slack-webrtc-turn-compromise-and-bug-bounty comm/discord https://discord.com/app diff --git a/.config/suckless/install.sh b/.config/suckless/install.sh index 44fade5..7886bea 100755 --- a/.config/suckless/install.sh +++ b/.config/suckless/install.sh @@ -1,6 +1,4 @@ -#!/bin/bash -set -e - +#!/bin/bash -eu cd "$(dirname "$0")" for d in */; do diff --git a/.local/bin/ddev b/.local/bin/ddev index 2d0999a..dfa1210 100755 --- a/.local/bin/ddev +++ b/.local/bin/ddev @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/bash -e dkr() { - local ep="$1"; shift + local shell="$1"; shift (set -x - podman run --rm -it -v "$PWD:/mnt/" -w /mnt/ --entrypoint "$ep" \ + podman run --rm -it -v "$PWD:/mnt/" -w /mnt/ --entrypoint "$shell" \ "$img" "$@" ) } diff --git a/.local/bin/ffcapture b/.local/bin/ffcapture index fad3eb2..78ac710 100755 --- a/.local/bin/ffcapture +++ b/.local/bin/ffcapture @@ -12,8 +12,7 @@ audio=( -i default ) -ffmpeg \ - -framerate 10 \ +ffmpeg -framerate 30 \ "${video[@]}" \ "${audio[@]}" \ "$output" diff --git a/.local/bin/ffreduce b/.local/bin/ffreduce index 3f8a6d4..40176fd 100755 --- a/.local/bin/ffreduce +++ b/.local/bin/ffreduce @@ -14,7 +14,6 @@ if ! [ -r "$in" ]; then exit 1 fi - set -x #ffmpeg -i "$in" -r 24 -vcodec libx265 -vf "scale=-2:$smallside,setpts=0.5*PTS" "$@" "$out" ffmpeg -i "$in" -r 24 -vcodec libx265 -vf "scale=-2:$smallside" "$@" "$out" diff --git a/.local/bin/lock b/.local/bin/lock index 8ba88c9..2954d78 100755 --- a/.local/bin/lock +++ b/.local/bin/lock @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/bash -eu i3lock -ftni "$XDG_CONFIG_HOME/wallpapers/lock.png" diff --git a/.local/bin/vm b/.local/bin/vm index c8affb0..49716c5 100755 --- a/.local/bin/vm +++ b/.local/bin/vm @@ -1,28 +1,35 @@ -#!/bin/bash -e +#!/bin/bash -eu -ISO="$1" +getmaxram() { + local ram; ram="$(free -g | awk '/^Mem:/{print $2 - 2}')" + + if [ "$ram" -le 2 ]; then ram=2 + elif [ "$ram" -gt 32 ]; then ram=32; fi + echo "${ram}G" +} + +ISO="$1"; shift DISK="$HOME/${ISO%.*}.qcow2" -MAXMEM="$(free -g | awk '/^Mem:/{print $6 / 2}')G" -OVMF_CODE=/usr/share/edk2/x64/OVMF_CODE.4m.fd -OVMF_VARS=/tmp/OVMF_VARS.4m.fd +MAXMEM="$(getmaxram)" -set -x -if [ -f "$OVMF_VARS" ]; then - cp -f /usr/share/edk2/x64/OVMF_VARS.4m.fd "$OVMF_VARS" -fi -if ! [ -f "$DISK" ]; then - qemu-img create -f qcow2 "$DISK" 20G -fi +if ! [ -f "$DISK" ]; then (set -x + qemu-img create -f qcow2 "$DISK" 64G +) fi +(set -x qemu-system-x86_64 \ -accel kvm \ -M q35 \ + -bios /usr/share/edk2/x64/OVMF.4m.fd \ -monitor stdio \ -cpu host \ -m "2G,maxmem=$MAXMEM" \ -vga virtio \ -audio pipewire,model=hda \ -nic model=virtio-net-pci,type=user \ - -drive "if=pflash,format=raw,file=$OVMF_CODE,readonly=on" \ - -drive "if=pflash,format=raw,file=$OVMF_VARS" \ + -device qemu-xhci \ + -object "memory-backend-ram,id=mem,size=$ram,share=on" \ + -numa node,memdev=mem \ -drive "if=virtio,file=$DISK" \ - -drive "file=$ISO,media=cdrom,readonly=on" + -drive "file=$ISO,media=cdrom,readonly=on" \ + "$@" +) diff --git a/.local/bin/wallpaper b/.local/bin/wallpaper index 1fab660..9243640 100755 --- a/.local/bin/wallpaper +++ b/.local/bin/wallpaper @@ -1,5 +1,4 @@ -#!/bin/bash - +#!/bin/bash -eu shopt -s extglob feh --bg-fill "$(shuf -en1 "$XDG_CONFIG_HOME/wallpapers/"!(lock.png))" --no-fehbg diff --git a/.local/bin/wlp b/.local/bin/wlp index 088c878..a720917 100755 --- a/.local/bin/wlp +++ b/.local/bin/wlp @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash -eu iwctl=(iwctl station "$(find /sys/class/net/wlan* -printf '%f' -quit)")