Compare commits

...

12 Commits

Author SHA1 Message Date
f06be8c133 agents skills 2026-03-18 19:45:59 +08:00
f642e96112 misc 2026-03-18 19:45:11 +08:00
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
18 changed files with 634 additions and 45 deletions

View File

@@ -0,0 +1,141 @@
---
name: bash-script
description: Write robust bash scripts with proper error handling. Use when the user says "write a script", "bash script", "shell script", "automate this", "create a backup script", or asks to script a task.
allowed-tools: Read, Write, Edit, Bash, Glob
---
# Bash Script
Write robust, maintainable bash scripts with proper error handling.
## Instructions
1. Understand the task requirements
2. Design the script structure
3. Write with safety options and error handling
4. Test and validate
## Script template
```bash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# Description: Brief description of what this script does
# Usage: ./script.sh [options]
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
# Default values
VERBOSE="${VERBOSE:-false}"
usage() {
cat <<EOF
usage: ${SCRIPT_NAME} [options] <argument>
Description of what the script does.
Options:
-h, --help Show this help message
-v, --verbose Enable verbose output
Examples:
${SCRIPT_NAME} input.txt
${SCRIPT_NAME} --verbose /path/to/file
EOF
}
log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*" >&2
}
error() {
log "ERROR: $*"
exit 1
}
cleanup() {
# Remove temp files, restore state, etc.
rm -f "${TEMP_FILE:-}"
}
trap cleanup EXIT
main() {
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help) usage; exit 0 ;;
-v|--verbose) VERBOSE=true; shift ;;
--) shift; break ;;
-*) error "Unknown option: $1" ;;
*) break ;;
esac
done
[[ $# -lt 1 ]] && { usage; exit 1; }
local input="$1"
[[ -f "$input" ]] || error "File not found: $input"
# Main logic here
log "Processing $input"
}
main "$@"
```
## Safety options explained
| Option | Purpose |
| ----------------- | ----------------------------------- |
| `set -e` | Exit on error |
| `set -u` | Error on undefined variables |
| `set -o pipefail` | Pipeline fails if any command fails |
| `IFS=$'\n\t'` | Safer word splitting |
## Best practices
- MUST use `set -euo pipefail` at script start
- MUST quote all variables: `"$var"` not `$var`
- MUST use `[[` for conditionals (not `[`)
- MUST use `$()` for command substitution (not backticks)
- Use `readonly` for constants
- Use `local` for function variables
- Use `trap` for cleanup
- Use `mktemp` for temp files
## Common patterns
```bash
# Check if command exists
command -v docker &>/dev/null || error "docker not found"
# Default value
name="${1:-default}"
# Read file line by line
while IFS= read -r line; do
echo "$line"
done < "$file"
# Process arguments
for arg in "$@"; do
echo "$arg"
done
# Temp file with cleanup
TEMP_FILE="$(mktemp)"
trap 'rm -f "$TEMP_FILE"' EXIT
```
## Rules
- MUST include `set -euo pipefail`
- MUST quote all variable expansions
- MUST include usage function for scripts with arguments
- MUST use trap for cleanup of temp files
- Never use `eval` with user input
- Never assume current directory
- Always use absolute paths for cron scripts

100
.agents/skills/git/SKILL.md Normal file
View File

@@ -0,0 +1,100 @@
---
name: git
description: Git operations with conventional commits. Use for staging, committing, pushing, PRs, merges. Auto-splits commits by type/scope. Security scans for secrets.
version: 1.0.0
---
# Git Operations
Execute git workflows via `git-manager` subagent to isolate verbose output.
Activate `context-engineering` skill.
**IMPORTANT:**
- Sacrifice grammar for the sake of concision.
- Ensure token efficiency while maintaining high quality.
- Pass these rules to subagents.
## Arguments
- `cm`: Stage files & create commits
- `cp`: Stage files, create commits and push
- `pr`: Create Pull Request [to-branch] [from-branch]
- `to-branch`: Target branch (default: main)
- `from-branch`: Source branch (default: current branch)
- `merge`: Merge [to-branch] [from-branch]
- `to-branch`: Target branch (default: main)
- `from-branch`: Source branch (default: current branch)
## Quick Reference
| Task | Reference |
|------|-----------|
| Commit | `references/workflow-commit.md` |
| Push | `references/workflow-push.md` |
| Pull Request | `references/workflow-pr.md` |
| Merge | `references/workflow-merge.md` |
| Standards | `references/commit-standards.md` |
| Safety | `references/safety-protocols.md` |
| Branches | `references/branch-management.md` |
| GitHub CLI | `references/gh-cli-guide.md` |
## Core Workflow
### Step 1: Stage + Analyze
```bash
git add -A && git diff --cached --stat && git diff --cached --name-only
```
### Step 2: Security Check
Scan for secrets before commit:
```bash
git diff --cached | grep -iE "(api[_-\]?key|token|password|secret|credential)"
```
**If secrets found:** STOP, warn user, suggest `.gitignore`.
### Step 3: Split Decision
**NOTE:**
- Search for related issues on GitHub and add to body.
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).
**Split commits if:**
- Different types mixed (feat + fix, code + docs)
- Multiple scopes (auth + payments)
- Config/deps + code mixed
- FILES > 10 unrelated
**Single commit if:**
- Same type/scope, FILES ≤ 3, LINES ≤ 50
### Step 4: Commit
```bash
git commit -m "type(scope): description"
```
## Output Format
```
✓ staged: N files (+X/-Y lines)
✓ security: passed
✓ commit: HASH type(scope): description
✓ pushed: yes/no
```
## Error Handling
| Error | Action |
|-------|--------|
| Secrets detected | Block commit, show files |
| No changes | Exit cleanly |
| Push rejected | Suggest `git pull --rebase` |
| Merge conflicts | Suggest manual resolution |
## References
- `references/workflow-commit.md` - Commit workflow with split logic
- `references/workflow-push.md` - Push workflow with error handling
- `references/workflow-pr.md` - PR creation with remote diff analysis
- `references/workflow-merge.md` - Branch merge workflow
- `references/commit-standards.md` - Conventional commit format rules
- `references/safety-protocols.md` - Secret detection, branch protection
- `references/branch-management.md` - Naming, lifecycle, strategies
- `references/gh-cli-guide.md` - GitHub CLI commands reference

View File

@@ -0,0 +1,75 @@
---
name: linux-admin
cluster: linux
description: "Ubuntu Server 24.04 LTS: apt, user management, disk/filesystem, sysctl, log management"
tags: ["linux","ubuntu","admin","system"]
dependencies: []
composes: []
similar_to: []
called_by: []
authorization_required: false
scope: general
model_hint: claude-sonnet
embedding_hint: "linux ubuntu server administration apt package system admin"
---
# linux-admin
## Purpose
This skill provides tools for administering Ubuntu Server 24.04 LTS, focusing on package management with apt, user account creation and modification, disk and filesystem operations, kernel parameter tuning via sysctl, and log management.
## When to use
Use this skill for server setup, maintenance, or troubleshooting on Ubuntu 24.04, such as deploying applications, securing user access, optimizing system performance, or analyzing logs in production environments.
## Key Capabilities
- **Package Management (apt)**: Update repositories, install/uninstall packages, and manage dependencies using `apt` with flags like `-y` for non-interactive mode.
- **User Management**: Create, modify, or delete users with commands like `useradd`, `usermod`, and `userdel`, including options for home directories and shells.
- **Disk/Filesystem**: Partition disks with `fdisk`, format filesystems using `mkfs`, and mount/unmount with `mount` and `umount`, supporting formats like ext4.
- **Sysctl**: Adjust kernel parameters dynamically, e.g., for networking or security, by editing `/etc/sysctl.conf` and applying with `sysctl -p`.
- **Log Management**: Query and filter system logs using `journalctl`, with options like `--since` for time-based searches and persistent storage in `/var/log`.
## Usage Patterns
Invoke this skill via shell commands in scripts or AI prompts. Always prefix commands with `sudo` for root privileges. Example 1: To install a package and add a user, use a sequence like: `sudo apt update; sudo apt install nginx -y; sudo useradd webuser -m`. Example 2: For disk management and log check, run: `sudo fdisk /dev/sda; sudo mkfs.ext4 /dev/sda1; sudo mount /dev/sda1 /mnt; sudo journalctl -u nginx --since "1 hour ago"`.
## Common Commands/API
- **Apt Example**: Update and install a package:
```
sudo apt update
sudo apt install vim -y
```
- **User Management Example**: Add a user with home directory:
```
sudo useradd newuser -m -s /bin/bash
sudo passwd newuser
```
- **Disk/Filesystem Example**: Create and mount a filesystem:
```
sudo fdisk -l /dev/sdb # List partitions
sudo mkfs.ext4 /dev/sdb1
sudo mount /dev/sdb1 /mnt/data
```
- **Sysctl Example**: Set a kernel parameter:
```
echo "net.core.somaxconn=1024" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
```
- **Log Management Example**: Filter logs for a service:
```
sudo journalctl -u apache2 --since yesterday
sudo journalctl -p err # Show only errors
```
## Integration Notes
Run commands in a Bash environment on Ubuntu 24.04\. For remote access, use SSH; no API keys required for core functions, but if integrating with external tools like monitoring APIs, set env vars like `$LINUX_API_KEY` for authentication. Ensure the AI agent prefixes commands with `sudo` and handles output parsing, e.g., check for `apt` success via exit codes.
## Error Handling
Check command exit codes immediately; for example, after `sudo apt install package`, verify with `if [ $? -ne 0 ]; then echo "Installation failed"; fi`. Parse errors from stdout/stderr, e.g., `apt` errors like "E: Unable to locate package" indicate missing repos—run `sudo apt update` first. For sysctl, if a parameter fails, check `/var/log/syslog` for details. Use `try-catch` in scripts:
```
command_output=$(sudo apt update 2>&1)
if [[ $command_output == *"ERROR"* ]]; then echo "Handle error"; fi
```
## Graph Relationships
- Related to: linux cluster skills like "networking" for firewall integration.
- Depends on: None directly, but assumes base Ubuntu setup.
- Conflicts with: None specified.

View File

@@ -17,6 +17,11 @@ stow -v git -D
Target (`-t`) defaults to the parent of `pwd`, so if you clone this repo not in `$HOME` then you MUST explicitly provide `-t ~` or `-t $HOME` every time. Target (`-t`) defaults to the parent of `pwd`, so if you clone this repo not in `$HOME` then you MUST explicitly provide `-t ~` or `-t $HOME` every time.
Root-specific packages:
* `keyd` => `sudo stow keyd -t /`
* `docker` => `sudo stow docker -t /`
## Documentation and sources ## Documentation and sources
* <https://www.gnu.org/software/stow/manual/stow.html> * <https://www.gnu.org/software/stow/manual/stow.html>

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
[ids]
0c45:8006
[main]
# заготовка

View File

@@ -12,6 +12,7 @@ alias g='git'
alias c='composer' alias c='composer'
alias hosts="sudo nano /etc/hosts" alias hosts="sudo nano /etc/hosts"
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c" alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
alias py="python"
alias up='cd ..' alias up='cd ..'
alias back='cd -' alias back='cd -'

View File

@@ -17,7 +17,9 @@ fi
### AAA ########################################## ### AAA ##########################################
export EDITOR="nano" 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:/opt/nvim/bin/"
export PATH="$PATH:$HOME/.local/bin/" export PATH="$PATH:$HOME/.local/bin/"
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/" 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" [ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
# misc # 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))

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
case "$1" in
-h|--help)
cat <<EOF
Usage: $(basename "$0") [-h]
Switch audio output and apply appropriate easyffects preset.
Options:
-h, --help Show this help message
--defender Enable loud speakers
--head Enable headphones
EOF
;;
--defender)
pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
easyeffects -l Defender
;;
--head)
pactl set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
easyeffects -l Techno
;;
esac

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

@@ -18,6 +18,7 @@ EOF
fi fi
# More details: https://jina.ai/reader/ # More details: https://jina.ai/reader/
#TODO: проверить https://defuddle.md/
url="$1"; shift url="$1"; shift
curl "https://r.jina.ai/$url" \ curl "https://r.jina.ai/$url" \

View File

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

View File

@@ -1,4 +1,5 @@
include "%L" include "%L"
include "/usr/local/share/keyd/keyd.compose"
<Multi_key> <s> <h> <r> <u> <g> : "¯\\_(ツ)_/¯" <Multi_key> <s> <h> <r> <u> <g> : "¯\\_(ツ)_/¯"
<Multi_key> <Cyrillic_ha> <Cyrillic_ze> : "¯\\_(ツ)_/¯" # хз <Multi_key> <Cyrillic_ha> <Cyrillic_ze> : "¯\\_(ツ)_/¯" # хз