From 34c606d965029032e4c0564ad2ad0e81021ad22a Mon Sep 17 00:00:00 2001 From: tosu Date: Mon, 17 Jun 2024 16:58:12 +0200 Subject: [PATCH] Shebangs, alacritty bell --- .config/alacritty/alacritty.toml | 5 ++- .config/nvim/lua/tosu/set.lua | 12 +++--- .local/bin/connect_to_mx5.sh | 17 ++------- .local/bin/cut_term_width.py | 2 +- .local/bin/dp1_mirror | 4 +- .local/bin/dp1_only | 4 +- .local/bin/dp1_right | 4 +- .local/bin/edp1_only | 4 +- .local/bin/hdmi1_mirror | 4 +- .local/bin/hdmi1_only | 4 +- .local/bin/hdmi1_right | 4 +- .local/bin/hist | 2 +- .local/bin/new_key.sh | 2 +- .local/bin/pair_to_mx5_bluetooth_reset.sh | 13 +++---- .local/bin/path | 2 +- .local/bin/pub | 45 ++++++++++++++--------- .local/bin/qr | 6 +-- .local/bin/rank_mirrors.sh | 2 +- .local/bin/simple_timer.sh | 2 +- .local/bin/squote_escape | 2 +- .local/bin/system_update.sh | 4 +- .local/bin/tmux_urls.py | 2 +- .local/bin/tui_choice.sh | 2 +- .local/bin/updatebar | 2 +- 24 files changed, 75 insertions(+), 75 deletions(-) diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index 69ed5e2..ad52dcd 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -2,8 +2,9 @@ live_config_reload = true [bell] animation = "EaseOutExpo" -color = "0xffffff" -duration = 0 +# color = "0xffffff" +color = "0x111111" +duration = 100 [colors.bright] black = "#5b6268" diff --git a/.config/nvim/lua/tosu/set.lua b/.config/nvim/lua/tosu/set.lua index 25b0fc9..2bd8173 100644 --- a/.config/nvim/lua/tosu/set.lua +++ b/.config/nvim/lua/tosu/set.lua @@ -43,9 +43,9 @@ vim.opt.colorcolumn = '80' vim.opt.paste = false vim.opt.splitright = false --- vim.diagnostic.config({ --- virtual_lines = false, --- virtual_text = false, --- underline = false, --- signs = true, --- }) +vim.diagnostic.config({ + virtual_lines = false, + virtual_text = false, + underline = false, + signs = true, +}) diff --git a/.local/bin/connect_to_mx5.sh b/.local/bin/connect_to_mx5.sh index 9ec98c0..b3ceddd 100755 --- a/.local/bin/connect_to_mx5.sh +++ b/.local/bin/connect_to_mx5.sh @@ -1,10 +1,6 @@ -#!/bin/bash +#! /bin/sh - -set -euo pipefail -###################### STOP ################### -# Put device in pairing mode!!! - -# MUST be uppercase +# hex MUST be uppercase MX5_MAC="AC:80:0A:6D:F3:7B" MX5_SINK="bluez_sink.AC_80_0A_6D_F3_7B.a2dp_sink" MX3_MAC="14:3F:A6:A8:7F:CD" @@ -12,14 +8,9 @@ MX3_MAC="14:3F:A6:A8:7F:CD" DEVICE_MAC="${MX5_MAC}" DEVICE_SINK="${MX5_SINK}" -function log () { - printf "\n\033[31m%s\033[m\n" "${@}" >/dev/tty -} +bluetoothctl power on && bluetoothctl connect "${DEVICE_MAC}" -bluetoothctl power on \ - && bluetoothctl connect "${DEVICE_MAC}" - -pactl set-default-sink "${DEVICE_SINK}" || true +pactl set-default-sink "${DEVICE_SINK}" bluetoothctl connect "${DEVICE_MAC}" || { sleep 3; bluetoothctl connect "${DEVICE_MAC}"; } diff --git a/.local/bin/cut_term_width.py b/.local/bin/cut_term_width.py index 1fa3029..8f9b798 100755 --- a/.local/bin/cut_term_width.py +++ b/.local/bin/cut_term_width.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#! /bin/python3 -- import os import re diff --git a/.local/bin/dp1_mirror b/.local/bin/dp1_mirror index f941f8b..58e129e 100755 --- a/.local/bin/dp1_mirror +++ b/.local/bin/dp1_mirror @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output eDP-1 --auto --output DP-1 --same-as eDP-1 --auto +#! /bin/sh - +exec xrandr --output eDP-1 --auto --output DP-1 --same-as eDP-1 --auto diff --git a/.local/bin/dp1_only b/.local/bin/dp1_only index 8f76f2d..52f4806 100755 --- a/.local/bin/dp1_only +++ b/.local/bin/dp1_only @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output DP-1 --auto --output eDP-1 --off +#! /bin/sh - +exec xrandr --output DP-1 --auto --output eDP-1 --off diff --git a/.local/bin/dp1_right b/.local/bin/dp1_right index 3176eae..4782516 100755 --- a/.local/bin/dp1_right +++ b/.local/bin/dp1_right @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output eDP-1 --auto --output DP-1 --right-of eDP-1 --auto +#! /bin/sh - +exec xrandr --output eDP-1 --auto --output DP-1 --right-of eDP-1 --auto diff --git a/.local/bin/edp1_only b/.local/bin/edp1_only index 08eab74..251f928 100755 --- a/.local/bin/edp1_only +++ b/.local/bin/edp1_only @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --off +#! /bin/sh - +exec xrandr --output eDP-1 --auto --output HDMI-1 --off --output DP-1 --off diff --git a/.local/bin/hdmi1_mirror b/.local/bin/hdmi1_mirror index 456defb..21a42d9 100755 --- a/.local/bin/hdmi1_mirror +++ b/.local/bin/hdmi1_mirror @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output eDP-1 --auto --output HDMI-1 --same-as eDP-1 --auto +#! /bin/sh - +exec xrandr --output eDP-1 --auto --output HDMI-1 --same-as eDP-1 --auto diff --git a/.local/bin/hdmi1_only b/.local/bin/hdmi1_only index aa6b526..ea2ba3f 100755 --- a/.local/bin/hdmi1_only +++ b/.local/bin/hdmi1_only @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output HDMI-1 --auto --output eDP-1 --off +#! /bin/sh - +exec xrandr --output HDMI-1 --auto --output eDP-1 --off diff --git a/.local/bin/hdmi1_right b/.local/bin/hdmi1_right index e567214..bd627bf 100755 --- a/.local/bin/hdmi1_right +++ b/.local/bin/hdmi1_right @@ -1,2 +1,2 @@ -#!/bin/sh -xrandr --output eDP-1 --auto --output HDMI-1 --right-of eDP-1 --auto +#! /bin/sh - +exec xrandr --output eDP-1 --auto --output HDMI-1 --right-of eDP-1 --auto diff --git a/.local/bin/hist b/.local/bin/hist index a968c81..33ddcb6 100755 --- a/.local/bin/hist +++ b/.local/bin/hist @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - command -v squote_escape >/dev/null 2>&1 || { echo "${0} depends on squote_escape"; exit 1; } diff --git a/.local/bin/new_key.sh b/.local/bin/new_key.sh index 725def3..1c241b9 100755 --- a/.local/bin/new_key.sh +++ b/.local/bin/new_key.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#! /bin/bash -- set -e diff --git a/.local/bin/pair_to_mx5_bluetooth_reset.sh b/.local/bin/pair_to_mx5_bluetooth_reset.sh index f5e9c70..75371f5 100755 --- a/.local/bin/pair_to_mx5_bluetooth_reset.sh +++ b/.local/bin/pair_to_mx5_bluetooth_reset.sh @@ -1,17 +1,16 @@ -#!/bin/bash +#! /bin/sh - -set -euo pipefail ###################### STOP ################### # Put device in pairing mode!!! -# MUST be uppercase +# hex MUST be uppercase MX5_MAC="AC:80:0A:6D:F3:7B" MX3_MAC="14:3F:A6:A8:7F:CD" -DEVICE_MAC="${MX5_MAC}" +DEVICE_MAC="$MX5_MAC" -function log () { - printf "\n\033[31m%s\033[m\n" "${@}" >/dev/tty +log () { + printf "\n\033[31m%s\033[m\n" "$*" >/dev/tty } log "rfkill block bluetooth..." @@ -33,7 +32,7 @@ sleep 3 log "Powering on bluetooth agent..." cat <<- CMDS - power on + power on agent on default-agent pairable on diff --git a/.local/bin/path b/.local/bin/path index e5b6e02..7425ba0 100755 --- a/.local/bin/path +++ b/.local/bin/path @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - # POSIX-compliant shell script to print the PATH contents line by line, # without duplicated, in order, without empty lines. diff --git a/.local/bin/pub b/.local/bin/pub index 51f229d..ac196db 100755 --- a/.local/bin/pub +++ b/.local/bin/pub @@ -1,27 +1,36 @@ -#!/bin/sh +#! /bin/sh - err () { printf '\033[31m%s\033[m\n' "$*" } -# mia's 0x0.st -- fast! -curl -sfSL -F"file=@${1:--}" 0x0.st && exit 0 -err "Mia's (0x0.st) pastebin failed!" +trap 'rm -f "$file"' EXIT -# pb1n.de -- fast! -curl -sfSL -F"f=@${1:--}" pb1n.de && exit 0 -err "pb1n.de pastebin failed!" +[ ! -t 0 ] && [ -z "$1" ] && file=$(mktemp) && cat >"$file" || [ -n "$1" ] && file="$1" -# chris titus' hastebin -- not that fast -response="$(curl -sfSL --data-binary @"${1:--}" bin.christitus.com/documents)" && - { hasteKey="$(printf %s "$response" | jq -r '.key')" && [ -n "${hasteKey}" ] && - echo "http://bin.christitus.com/raw/$hasteKey" && exit 0 || err "Couldn't extract hasteKey. Sorry!"; } -err "Chris' pastebin failed!" +# mia's 0x0.st -- fast! -- prints \n +# curl -sfSL -F"file=@$file" 0x0.st && exit 0 ; err "Mia's (0x0.st) pastebin failed!" -# paste.rs -- damn slow -curl -sfSL --data-binary @"${1:--}" paste.rs && exit 0 -err "paste.rs pastebin failed!" +# pb1n.de -- fast! -- prints \n +# curl -sfSL -F"f=@$file" pb1n.de && exit 0 ; err "pb1n.de pastebin failed!" -# ix.io, broken -curl -sfSL -F"f=@${1:--}" pb1n.de && exit 0 -err "ix.io pastebin failed!" +# chris titus' hastebin -- not that fast -- prints \n +# response="$(curl -sfSL --data-binary @"$file" bin.christitus.com/documents)" && +# { hasteKey="$(printf %s "$response" | jq -r '.key')" && [ -n "${hasteKey}" ] && +# echo "http://bin.christitus.com/raw/$hasteKey" && exit 0 || err "Couldn't extract hasteKey. Sorry!"; } +# err "Chris' pastebin failed!" + +# paste.rs -- damn slow -- prints without \n +# curl -sfSL --data-binary @"$file" paste.rs && exit 0 ; err "paste.rs pastebin failed!" + +# transfer.sh -- requires https -- not that fast -- prints \n +curl -sfSL --upload-file "$file" https://transfer.sh && exit 0 ; err "transfer.sh pastebin failed!" + +# clbin.com -- requires https -- not that fast -- prints \n +curl -sfSL -F"clbin=<$file" https://clbin.com && exit 0 ; err "clbin.com pastebin failed!" + +# sprunge.us -- RIP +curl -sfSL -F"sprunge=<$file" http://sprunge.us && exit 0 ; err "sprunge.us pastebin failed!" + +# ix.io, "taking a break" -- RIP +curl -sfSL -F"f:1=<$file" ix.io && exit 0 ; err "ix.io pastebin failed!" diff --git a/.local/bin/qr b/.local/bin/qr index 98ab27d..5b2ef0a 100755 --- a/.local/bin/qr +++ b/.local/bin/qr @@ -1,5 +1,5 @@ -#!/bin/sh +#! /bin/sh - [ -t 1 ] && -qrencode -m2 -t ANSI256UTF8 "$@" || -qrencode -m2 -t UTF8 "$@" +exec qrencode -m2 -t ANSI256UTF8 "$@" || +exec qrencode -m2 -t UTF8 "$@" diff --git a/.local/bin/rank_mirrors.sh b/.local/bin/rank_mirrors.sh index cebc032..1415586 100755 --- a/.local/bin/rank_mirrors.sh +++ b/.local/bin/rank_mirrors.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#! /bin/bash -- curl -s "https://archlinux.org/mirrorlist/?country=DE&protocol=https&use_mirror_status=on" \ | sed -e 's/^#Server/Server/' -e '/^#/d' \ diff --git a/.local/bin/simple_timer.sh b/.local/bin/simple_timer.sh index a340f3b..227b49c 100755 --- a/.local/bin/simple_timer.sh +++ b/.local/bin/simple_timer.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - min="${1-}" sec="${2-}" diff --git a/.local/bin/squote_escape b/.local/bin/squote_escape index 9aac598..4759b62 100755 --- a/.local/bin/squote_escape +++ b/.local/bin/squote_escape @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - if [ -t 0 ] && [ -n "${1}" ]; then while [ -n "${1}" ]; do diff --git a/.local/bin/system_update.sh b/.local/bin/system_update.sh index ddc3ba2..9053915 100755 --- a/.local/bin/system_update.sh +++ b/.local/bin/system_update.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - run () { if [ "$(date "+%H")" = "06" ] ; then @@ -6,7 +6,7 @@ run () { fi sleep 10 export PATH="${PATH}:/home/tosuman/.local/bin" - export SHELL='/usr/bin/bash' + export SHELL='/bin/bash' number_of_tmux_sessions="$(tmux ls | wc -l)" diff --git a/.local/bin/tmux_urls.py b/.local/bin/tmux_urls.py index 74e0c6e..19c9b9e 100755 --- a/.local/bin/tmux_urls.py +++ b/.local/bin/tmux_urls.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#! /usr/bin/python3 -- # -*- coding: utf-8 -*- import re diff --git a/.local/bin/tui_choice.sh b/.local/bin/tui_choice.sh index 5deb31d..a723cf1 100755 --- a/.local/bin/tui_choice.sh +++ b/.local/bin/tui_choice.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#! /bin/bash -- choose_from_menu () { local prompt="${1}" diff --git a/.local/bin/updatebar b/.local/bin/updatebar index 44aaed2..50ad838 100755 --- a/.local/bin/updatebar +++ b/.local/bin/updatebar @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh - for pid in $(pgrep -f "updatebar") ; do [ "${pid}" != "${$}" ] && 2>/dev/null kill -9 "${pid}"