1
0
Fork 0

idc changed a lot of files

This commit is contained in:
Arthur Khachaturov 2024-11-28 22:19:16 +03:00
parent 628baf3eea
commit 94d2955ab0
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
31 changed files with 267 additions and 80 deletions

View file

@ -1,6 +1,21 @@
#!/bin/bash
API_ENDPOINT="http://ip-api.com/json/$1"'?fields=7876383'
printf "%s" "$(curl "${API_ENDPOINT}" 2>/dev/null)" | jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"'
get_stats() {
api_response=$(curl "${API_ENDPOINT}" 2>/dev/null)
ip=$(jq -r .query <<<"$api_response")
ptr="$(dig -x "$ip" | grep -A 1 'ANSWER SECTION' | grep -v 'ANSWER SECTION')"
jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"' <<<"$api_response"
[ -n "$ptr" ] && echo "PTR: $ptr"
}
if [ -t 0 ] && [ -t 1 ]; then
get_stats
elif [ -t 1 ]; then
notify-send -i /dev/null "Your IP address" "$(get_stats)"
else
curl -s ip.me
fi
# vim: ft=bash

View file

@ -67,6 +67,7 @@ die() {
main() {
msg=""
while [ $# -gt 0 ]; do
case "$1" in
'-h'|'--help') help; exit 0 ;;
@ -74,16 +75,19 @@ main() {
'-c'|'--code') tg__code=1; tg__params[parse_mode]='HTML' ;;
'-r'|'--print-response') print_response=1 ;;
'--tg'*) tg__params["${1#--tg}"]="$2"; shift ;;
*) msg+=" $1";;
esac
shift
done
[ -t 0 ] && die "Can't run on stdin!"
resp="$(tg::send_message "$@" 2>/dev/null)"
if [ -z "$msg" ]; then
[ -t 0 ] && die "Can't run on stdin!"
resp="$(tg::send_message "$@" 2>/dev/null)"
else
resp="$(tg::send_message "$@" 2>/dev/null <<<"$msg")"
fi
[ -n "${print_response:+_}" ] && echo "$resp"
[ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2
}

View file

@ -1,4 +1,4 @@
#!/bin/bash
SINK="$(pactl list sinks short | grep RUNNING | cut -d ' ' -f 1)"
SINK="$(pactl list sinks short | grep RUNNING | grep -v 'easyeffects' | cut -d ' ' -f 1)"
pactl set-sink-mute "$SINK" false ; pactl set-sink-volume "$SINK" "$1%"

View file

@ -1,7 +1,6 @@
#!/bin/bash
# supress stderr
exec 2> /dev/null
change_dpi() {
sed -i -E --follow-symlinks "s/Xft\.dpi: .*?/Xft\.dpi: $1/g" ~/.Xresources
@ -27,15 +26,16 @@ if [[ -z "${EXT_MON}" ]]; then
xrandr --rmmode "${INT_RES}"
change_dpi 192 48
else
xrandr --rmmode "${INT_RES}"
# shellcheck disable=all
xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution
xrandr --addmode eDP-1 "${INT_RES}"
xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary
change_dpi 96 24
xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}"
:
# xrandr --rmmode "${INT_RES}"
# # shellcheck disable=all
# xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution
# xrandr --addmode eDP-1 "${INT_RES}"
# xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary
# change_dpi 96 24
# xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}"
# xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}"
# xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}"
fi
"${HOME}/.config/X11/autostart"