Compare commits

..

11 Commits

Author SHA1 Message Date
6b8f7c297d clean utils fix 2026-03-09 14:45:14 +08:00
0370ee7308 new drotate util 2026-03-09 09:48:55 +08:00
fda5997f50 new clean util 2026-03-09 09:44:20 +08:00
c748863d30 new space util 2026-03-08 23:03:04 +08:00
f7088631b2 qwerty tool 2026-03-06 17:44:35 +08:00
e8247ba2ab JAVA_PATH fix in .profile 2026-03-06 13:43:07 +08:00
18e03a83b5 easyeffects misc 2026-03-06 13:42:02 +08:00
c99b5a2117 audio --switch 2026-03-04 08:37:22 +08:00
939289f172 vscode misc 2026-03-04 01:35:42 +08:00
35cdffa984 refactored sound to audio 2026-03-04 01:28:50 +08:00
f7b59f9d81 sound utility 2026-02-26 22:28:12 +08:00
9 changed files with 305 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
"input-gain": 0.0,
"link": -9.1,
"loudness": -3.0000000000000013,
"output": -6.0,
"output": -6.499999999999998,
"output-gain": 0.0
},
"blocklist": [],

View File

@@ -1,7 +1,7 @@
{
"output": {
"bass_enhancer#0": {
"amount": 2.5000000000000058,
"amount": 4.000000000000007,
"blend": 0.0,
"bypass": false,
"floor": 20.0,
@@ -41,7 +41,7 @@
},
"band10": {
"frequency": 15336.699231206312,
"gain": -9.65,
"gain": -7.65,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -74,7 +74,7 @@
},
"band4": {
"frequency": 354.2976439525226,
"gain": -22.9,
"gain": -23.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -85,7 +85,7 @@
},
"band5": {
"frequency": 663.8890981166219,
"gain": -18.08,
"gain": -15.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -96,7 +96,7 @@
},
"band6": {
"frequency": 1244.006958897993,
"gain": -12.57,
"gain": -10.57,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -107,7 +107,7 @@
},
"band7": {
"frequency": 2331.041913742621,
"gain": -6.2,
"gain": -5.2,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -118,7 +118,7 @@
},
"band8": {
"frequency": 4367.946951388736,
"gain": -2.62,
"gain": -0.62,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -129,7 +129,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": -1.81,
"gain": 0.19,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -169,7 +169,7 @@
},
"band10": {
"frequency": 15336.699231206312,
"gain": -9.65,
"gain": -7.65,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -202,7 +202,7 @@
},
"band4": {
"frequency": 354.2976439525226,
"gain": -22.9,
"gain": -23.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -213,7 +213,7 @@
},
"band5": {
"frequency": 663.8890981166219,
"gain": -18.08,
"gain": -15.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -224,7 +224,7 @@
},
"band6": {
"frequency": 1244.006958897993,
"gain": -12.57,
"gain": -10.57,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -235,7 +235,7 @@
},
"band7": {
"frequency": 2331.041913742621,
"gain": -6.2,
"gain": -5.2,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -246,7 +246,7 @@
},
"band8": {
"frequency": 4367.946951388736,
"gain": -2.62,
"gain": -0.62,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -257,7 +257,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": -1.81,
"gain": 0.19,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,

View File

@@ -17,7 +17,9 @@ fi
### AAA ##########################################
export EDITOR="nano"
export JAVA_HOME="/usr/bin/"
# export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
export PATH="$JAVA_HOME/bin/:$PATH"
export PATH="$PATH:/opt/nvim/bin/"
export PATH="$PATH:$HOME/.local/bin/"
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
@@ -51,4 +53,4 @@ export NVM_DIR="$HOME/.nvm"
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
# misc
[[ -f $HOME/.profile.local ]] && source $HOME/.profile.local
[[ -f "$HOME/.profile.local" ]] && source "$HOME/.profile.local"

75
utils/.local/bin/audio Executable file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# available sinks listed here: pactl list sinks
CURRENT_SINK="$(pactl get-default-sink)"
CURRENT_PRESET="$(easyeffects --active-preset output)"
LOUD_SINK="alsa_output.pci-0000_00_1f.3.analog-stereo"
LOUD_PRESET="Defender"
HEAD_SINK="alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo"
HEAD_PRESET="Techno"
set_head() {
if [ "$CURRENT_SINK" != "$HEAD_SINK" ]; then
pactl set-default-sink "$HEAD_SINK" || exit 1
easyeffects --load-preset "$HEAD_PRESET" || exit 2
echo -e "Current sink\t: $HEAD_SINK"
echo -e "Current preset\t: $HEAD_PRESET"
fi
}
set_loud() {
if [ "$CURRENT_SINK" != "$LOUD_SINK" ]; then
pactl set-default-sink "$LOUD_SINK" || exit 1
easyeffects --load-preset "$LOUD_PRESET" || exit 2
echo -e "Current sink\t: $LOUD_SINK"
echo -e "Current preset\t: $LOUD_PRESET"
fi
}
show_help() {
echo "Usage: $(basename "$0") [-h|--help|--loud|--head|--switch]"
echo
echo "Switch audio output and apply appropriate easyffects preset."
echo
echo "Options:"
echo " -h, --help Show this help message"
echo " --loud Enable loud speakers"
echo " --head Enable headphones"
echo " --switch Switch between loud and headphones"
echo
}
if [ -z "$1" ]; then
echo -e "Loud sink\t: $LOUD_SINK"
echo -e "Loud preset\t: $LOUD_PRESET"
echo -e "Head sink\t: $HEAD_SINK"
echo -e "Head preset\t: $HEAD_PRESET"
echo
echo -e "Current sink\t: $CURRENT_SINK"
echo -e "Current preset\t: $CURRENT_PRESET"
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
show_help
exit
fi
if [ "$1" == "--loud" ]; then
set_loud
exit
fi
if [ "$1" == "--head" ]; then
set_head
exit
fi
if [ "$1" == "--switch" ]; then
case "$CURRENT_SINK" in
*$LOUD_SINK*) set_head ;;
*$HEAD_SINK*) set_loud ;;
*) show_help ;;
esac
fi

136
utils/.local/bin/clean Executable file
View File

@@ -0,0 +1,136 @@
#!/usr/bin/env bash
#
# Скрипт для очистки системных логов
# Требует права root
#
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] [1|2|3]
Clean system logs and data to free some space on system disk.
Options:
-h, --help Show this help message
1|2|3 Safe, normal or aggressive clean level
EOF
exit 0
fi
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*"; }
show_size() {
local path="$1"
sudo du -sh "$path" 2>/dev/null | awk '{print $1}'
}
# Показываем текущее использование
log_info "Текущее использование:"
df -hx tmpfs
echo
log_info "По директориям:"
sudo du -h --max-depth=0 \
/var/log/ \
/var/cache/apt/ \
/var/lib/docker/ \
"$HOME"/.local/share/Trash/files/ \
"$HOME"/.cache/thumbnails/ \
2>/dev/null \
| sort -rh
echo
choice="$1"
if [ -z "$choice" ]; then
echo "Выберите режим очистки:"
echo " 1) Безопасный"
echo " 2) Средний"
echo " 3) Агрессивный"
echo
read -rp "Выбор [1-3]: " choice
echo
fi
case "$choice" in
1)
log_info "Выбран безопасный (1) режим..."
set -x
sudo journalctl --vacuum-size=100M
sudo find /var/log -name "*.gz" -mtime +7 -delete 2>/dev/null || true
sudo find /var/log -name "*.log.*" -mtime +7 -delete 2>/dev/null || true
[ -d "$HOME"/.local/share/Trash/files/ ] && sudo rm -rfv "$HOME"/.local/share/Trash/files/*
[ -d "$HOME"/.cache/thumbnails/ ] && sudo rm -rfv "$HOME"/.cache/thumbnails/*
set +x
;;
2)
log_info "Выбран средний (2) режим..."
set -x
sudo journalctl --vacuum-size=50M
sudo find /var/log -name "*.gz" -mtime +3 -delete 2>/dev/null || true
sudo find /var/log -name "*.log.*" -mtime +3 -delete 2>/dev/null || true
sudo find /var/log -name "dpkg.log.*" -mtime +3 -delete 2>/dev/null || true
[ -d "$HOME"/.local/share/Trash/files/ ] && sudo rm -rfv "$HOME"/.local/share/Trash/files/* 2>/dev/null || true
[ -d "$HOME"/.cache/thumbnails/ ] && sudo rm -rfv "$HOME"/.cache/thumbnails/* 2>/dev/null || true
sudo rm -rfv /var/cache/apt/archives/*.deb 2>/dev/null || true
sudo apt clean 2>/dev/null || true
set +x
;;
3)
log_info "Выбран агрессивный (3) режим!"
read -rp "Продолжить? (y|yes|n|no): " confirm
if [[ "$confirm" != "yes" ]] && [[ "$confirm" != "y" ]]; then
log_info "Отменено"
exit 0
fi
set -x
sudo journalctl --vacuum-time=1d
sudo find /var/log -name "*.gz" -delete 2>/dev/null || true
sudo find /var/log -name "*.log.*" -delete 2>/dev/null || true
sudo rm -rfv /var/log/journal/user-*@* 2>/dev/null || true
sudo rm -rfv /var/log/journal/system*@* 2>/dev/null || true
sudo rm -fv /var/log/{syslog,dmesg,btmp}.* 2>/dev/null || true
sudo apt autoremove --purge
sudo apt autoclean
sudo apt clean
sudo rm -rfv /var/cache/apt/archives/* 2>/dev/null || true
hash docker && docker system prune -f
snap list 2>/dev/null && snap refresh --list 2>/dev/null || true
sudo snap list --all \
| awk '/disabled/{print $1, $3}' \
| while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
set +x
;;
*)
log_error "Неверный выбор"
exit 1
;;
esac
echo
log_info "Очистка завершена!"
log_info "Текущее использование:"
df -hx tmpfs
echo
log_info "По директориям:"
sudo du -h --max-depth=0 \
/var/log/ \
/var/cache/apt/ \
/var/lib/docker/ \
"$HOME"/.local/share/Trash/files/ \
"$HOME"/.cache/thumbnails/ \
2>/dev/null \
| sort -rh

28
utils/.local/bin/drotate Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# X11:
# xrandr --listactivemonitors
# xrandr --output $OUTPUT --rotate (normal|left|right|...)
# Wayland KDE: https://www.reddit.com/r/kde/comments/11vrbwc/how_do_i_rotate_the_screen_on_kde_with_wayland/
# kscreen-doctor --outputs
OUTPUT='HDMI-A-1'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] [normal|left|right|inverted]
Rotate a display.
Options:
-h, --help Show this help message
Arguments:
normal|left|right|inverted Direction
EOF
exit 0
fi
[ "$1" ] && DIRECTION="$1" || DIRECTION="normal"
kscreen-doctor "output.$OUTPUT.rotation.$DIRECTION"

20
utils/.local/bin/qwerty Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import sys
en = "qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
ru = "йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,"
def toggle(text):
if any('а' <= c <= 'я' or 'А' <= c <= 'Я' for c in text):
trans = str.maketrans(ru, en)
else:
trans = str.maketrans(en, ru)
return text.translate(trans)
if len(sys.argv) > 1:
input_text = " ".join(sys.argv[1:])
else:
input_text = sys.stdin.read().strip()
if input_text:
print(toggle(input_text))

24
utils/.local/bin/space Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] PATH [-N]
Display used space on disk by PATH or show top N most heavy paths inside a PATH
Options:
-h, --help Show this help message
EOF
exit 0
fi
if [ -n "$2" ]; then
du -ah "$1" 2>/dev/null \
| sort -rh 2>/dev/null \
| head -"$2" 2>/dev/null
else
du -ah --max-depth=1 "$1" 2>/dev/null \
| sort -rh 2>/dev/null
fi

View File

@@ -32,10 +32,10 @@
"chat.commandCenter.enabled": false,
"window.enableMenuBarMnemonics": false,
"window.restoreFullscreen": true,
"window.newWindowProfile": "По умолчанию",
"window.customTitleBarVisibility": "auto",
"window.commandCenter": false,
"window.menuBarVisibility": "compact",
"window.menuStyle": "custom",
"window.menuBarVisibility": "toggle",
"debug.toolBarLocation": "docked",
"testing.coverageToolbarEnabled": true,