Compare commits

...
38 Commits
Author SHA1 Message Date
anthony 673db9e2cc p10k update 2026-04-29 22:41:28 +08:00
anthony 4040adc7b2 vscode macos shell 2026-04-22 12:17:51 +08:00
anthony 95deaa4fda Merge branch 'master' of git.axenov.dev:anthony/dotfiles 2026-04-04 19:58:46 +08:00
anthony d9c91162f5 .profile java_home 2026-04-04 19:58:38 +08:00
anthony d64708126b docker-ips misc 2026-04-04 19:51:34 +08:00
anthony 110df8e08b Merge branch 'master' of git.axenov.dev:anthony/dotfiles 2026-04-04 19:47:36 +08:00
anthony 4b4e3ac97c vscode misc 2026-04-04 19:41:54 +08:00
anthony a3914f5474 fix xcompose 2026-04-04 19:39:33 +08:00
anthony 4a1a5abb96 shell for mac 2026-03-26 10:57:56 +08:00
anthony f4f2db7de1 gitconfig update 2026-03-26 00:22:48 +08:00
anthony 1705e95a43 p10k update 2026-03-26 00:22:35 +08:00
anthony f06be8c133 agents skills 2026-03-18 19:45:59 +08:00
anthony f642e96112 misc 2026-03-18 19:45:11 +08:00
anthony 6b8f7c297d clean utils fix 2026-03-09 14:45:14 +08:00
anthony 0370ee7308 new drotate util 2026-03-09 09:48:55 +08:00
anthony fda5997f50 new clean util 2026-03-09 09:44:20 +08:00
anthony c748863d30 new space util 2026-03-08 23:03:04 +08:00
anthony f7088631b2 qwerty tool 2026-03-06 17:44:35 +08:00
anthony e8247ba2ab JAVA_PATH fix in .profile 2026-03-06 13:43:07 +08:00
anthony 18e03a83b5 easyeffects misc 2026-03-06 13:42:02 +08:00
anthony c99b5a2117 audio --switch 2026-03-04 08:37:22 +08:00
anthony 939289f172 vscode misc 2026-03-04 01:35:42 +08:00
anthony 35cdffa984 refactored sound to audio 2026-03-04 01:28:50 +08:00
anthony f7b59f9d81 sound utility 2026-02-26 22:28:12 +08:00
anthony b9635a5697 notes utils 2026-02-21 18:10:21 +08:00
anthony 153776c54e utils upgrade 2026-02-21 18:10:09 +08:00
anthony f4c500d6cd dc util removed 2026-02-21 18:06:33 +08:00
anthony 2a177b5413 easyeffects update 2026-02-21 09:25:46 +08:00
anthony e2a3cf8aac fix typo in git alias 'start' 2026-02-18 19:53:54 +08:00
anthony d8859cf833 Merge branch 'master' of git.axenov.dev:anthony/dotfiles 2026-02-18 19:52:15 +08:00
anthony 2ce978585b vcompress util 2026-02-18 19:48:25 +08:00
anthony 906a2cdb93 vscode update 2026-02-18 19:44:52 +08:00
anthony f7fc877126 xcompose update 2026-02-18 19:42:58 +08:00
anthony 5b410bf9e7 obs-studio update 2026-02-18 19:41:41 +08:00
anthony c531f9f88b easyeffects update 2026-02-18 19:40:57 +08:00
anthony 214300e21e default .gitignore 2026-02-17 16:19:42 +08:00
anthony 95de82c2a0 ~/*.local instead of ~/*.extra 2026-02-17 16:17:20 +08:00
anthony 0d7feada81 some aliases moved to utils 2026-02-17 16:16:08 +08:00
61 changed files with 1850 additions and 375 deletions
+141
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
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
+75
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.
+2
View File
@@ -1,3 +1,4 @@
.DS_Store
*.backup
*.bak
*.log
@@ -5,3 +6,4 @@
*.tmp
*.tmp*
*.vscdb
.DS_Store
+5
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.
Root-specific packages:
* `keyd` => `sudo stow keyd -t /`
* `docker` => `sudo stow docker -t /`
## Documentation and sources
* <https://www.gnu.org/software/stow/manual/stow.html>
@@ -1,15 +1,12 @@
{
"output": {
"bass_enhancer#0": {
"amount": 3.000000000000008,
"blend": 0.0,
"bass_loudness#0": {
"bypass": false,
"floor": 10.0,
"floor-active": false,
"harmonics": 2.000000000000001,
"input-gain": 0.0,
"output-gain": 0.0,
"scope": 30.0
"link": -9.1,
"loudness": -3.0000000000000013,
"output": -6.499999999999998,
"output-gain": 0.0
},
"blocklist": [],
"equalizer#0": {
@@ -19,7 +16,7 @@
"left": {
"band0": {
"frequency": 28.738174228603842,
"gain": -2.0,
"gain": -6.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -30,18 +27,18 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": 3.0,
"gain": -3.75,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
"slope": "x1",
"slope": "x4",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band10": {
"frequency": 15336.699231206312,
"gain": -3.0,
"gain": -8.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -52,7 +49,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": 3.0,
"gain": -4.12,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -62,11 +59,11 @@
"width": 4.0
},
"band3": {
"frequency": 189.07799640996342,
"gain": 0.0,
"frequency": 260.0,
"gain": -6.8,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
"q": 1.98,
"slope": "x1",
"solo": false,
"type": "Bell",
@@ -74,7 +71,7 @@
},
"band4": {
"frequency": 354.2976439525226,
"gain": -5.0,
"gain": -13.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -85,7 +82,7 @@
},
"band5": {
"frequency": 663.8890981166219,
"gain": -11.0,
"gain": -19.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -96,7 +93,7 @@
},
"band6": {
"frequency": 1244.006958897993,
"gain": -6.0,
"gain": -11.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -107,7 +104,7 @@
},
"band7": {
"frequency": 2331.041913742621,
"gain": -1.0,
"gain": -5.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -118,7 +115,7 @@
},
"band8": {
"frequency": 4367.946951388736,
"gain": 2.0,
"gain": -3.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -129,7 +126,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": 2.0,
"gain": -4.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -141,13 +138,13 @@
},
"mode": "IIR",
"num-bands": 11,
"output-gain": 0.0,
"output-gain": 2.0,
"pitch-left": 0.0,
"pitch-right": 0.0,
"right": {
"band0": {
"frequency": 28.738174228603842,
"gain": -2.0,
"gain": -6.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -158,18 +155,18 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": 3.0,
"gain": -3.75,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
"slope": "x1",
"slope": "x4",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band10": {
"frequency": 15336.699231206312,
"gain": -3.0,
"gain": -8.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -180,7 +177,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": 3.0,
"gain": -4.12,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -190,11 +187,11 @@
"width": 4.0
},
"band3": {
"frequency": 189.07799640996342,
"gain": 0.0,
"frequency": 260.0,
"gain": -6.8,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
"q": 1.98,
"slope": "x1",
"solo": false,
"type": "Bell",
@@ -202,7 +199,7 @@
},
"band4": {
"frequency": 354.2976439525226,
"gain": -5.0,
"gain": -13.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -213,7 +210,7 @@
},
"band5": {
"frequency": 663.8890981166219,
"gain": -11.0,
"gain": -19.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -224,7 +221,7 @@
},
"band6": {
"frequency": 1244.006958897993,
"gain": -6.0,
"gain": -11.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -235,7 +232,7 @@
},
"band7": {
"frequency": 2331.041913742621,
"gain": -1.0,
"gain": -5.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -246,7 +243,7 @@
},
"band8": {
"frequency": 4367.946951388736,
"gain": 2.0,
"gain": -3.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -257,7 +254,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": 2.0,
"gain": -4.0,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -271,7 +268,7 @@
},
"plugins_order": [
"equalizer#0",
"bass_enhancer#0"
"bass_loudness#0"
]
}
}
@@ -1,7 +1,7 @@
{
"output": {
"bass_enhancer#0": {
"amount": 3.000000000000006,
"amount": 4.000000000000007,
"blend": 0.0,
"bypass": false,
"floor": 20.0,
@@ -19,7 +19,7 @@
"left": {
"band0": {
"frequency": 28.738174228603842,
"gain": -1.22,
"gain": -2.22,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -30,7 +30,7 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": 0.92,
"gain": -0.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -41,7 +41,7 @@
},
"band10": {
"frequency": 15336.699231206312,
"gain": -11.65,
"gain": -7.65,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -52,7 +52,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": -1.58,
"gain": -3.58,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -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,
@@ -129,7 +129,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": -1.81,
"gain": 0.19,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -147,7 +147,7 @@
"right": {
"band0": {
"frequency": 28.738174228603842,
"gain": -1.22,
"gain": -2.22,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -158,7 +158,7 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": 0.92,
"gain": -0.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -169,7 +169,7 @@
},
"band10": {
"frequency": 15336.699231206312,
"gain": -11.65,
"gain": -7.65,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -180,7 +180,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": -1.58,
"gain": -3.58,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -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,
@@ -257,7 +257,7 @@
},
"band9": {
"frequency": 8184.735099642112,
"gain": -1.81,
"gain": 0.19,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -11,6 +11,14 @@
"output-gain": 0.0,
"scope": 30.0
},
"bass_loudness#0": {
"bypass": false,
"input-gain": 0.0,
"link": -9.1,
"loudness": -3.499999999999999,
"output": -6.0,
"output-gain": 0.0
},
"blocklist": [],
"equalizer#0": {
"balance": 0.0,
@@ -19,7 +27,7 @@
"left": {
"band0": {
"frequency": 28.738174228603842,
"gain": -5.22,
"gain": -3.22,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -30,7 +38,7 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": -2.08,
"gain": -0.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -52,7 +60,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": -5.58,
"gain": -4.58,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -147,7 +155,7 @@
"right": {
"band0": {
"frequency": 28.738174228603842,
"gain": -5.22,
"gain": -3.22,
"mode": "RLC (BT)",
"mute": false,
"q": 1.644403823771979,
@@ -158,7 +166,7 @@
},
"band1": {
"frequency": 53.850091570755154,
"gain": -2.08,
"gain": -0.08,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719791,
@@ -180,7 +188,7 @@
},
"band2": {
"frequency": 100.90523980790812,
"gain": -5.58,
"gain": -4.58,
"mode": "RLC (BT)",
"mute": false,
"q": 1.6444038237719794,
@@ -271,7 +279,8 @@
},
"plugins_order": [
"equalizer#0",
"bass_enhancer#0"
"bass_enhancer#0",
"bass_loudness#0"
]
}
}
+1 -1
View File
@@ -249,7 +249,7 @@
tags = "tag -n1 --list" ; shot tag names and commit message
stashes = "stash list" ; show stashed changes
init = "init -q" ; blm is racism, 'master' branch must be 'master' branch
start = "!git init --quiet --initial-branch maste; git commit --no-verify --allow-empty --message 'Initial commit'" ; quick start empty repo
start = "!git init --quiet --initial-branch master; git commit --no-verify --allow-empty --message 'Initial commit'" ; quick start empty repo
cloner = "clone --recursive" ; clone with submodules
fuck = "!git checkout $(git config init.defaultBranch); git fetch origin --prune; git reset --hard origin/$(git config init.defaultBranch); git clean -dff"
+7 -2
View File
@@ -1,3 +1,7 @@
[user]
name = Anthony Axenov
email = anthonyaxenov@gmail.com
signingKey = F7CCD4EC
[core]
editor = nano
autocrlf = input
@@ -22,6 +26,7 @@
[include]
path = ~/.git_aliases
[include]
path = ~/.git_aliases.extra
path = ~/.git_aliases.local
[include]
path = ~/.gitconfig.extra ; use this file to store other personal settings and aliases
path = ~/.gitconfig.local ; use this file to store other personal settings and aliases
+6
View File
@@ -7,4 +7,10 @@ nbproject/
*.log
*.bak
*.rdb
.env
*.env
.env.*
!.env.example
!.env.default
!/**/*.gitkeep
+5
View File
@@ -0,0 +1,5 @@
[ids]
0c45:8006
[main]
# заготовка
+3 -6
View File
@@ -67,12 +67,6 @@ cy=580
geometry=AdnQywADAAAAAAAAAAAAFAAAAlcAAAGjAAAAAAAAABQAAAJXAAABowAAAAAAAAAAB4AAAAAAAAAAFAAAAlcAAAGj
[OBSWebSocket]
FirstLoad=false
ServerEnabled=false
ServerPort=4455
AlertsEnabled=false
AuthRequired=true
ServerPassword=4blHHSDyZzxK6HRO
[Video]
Renderer=OpenGL
@@ -87,3 +81,6 @@ MixerRed=2500223
MixerGreenActive=5046092
MixerYellowActive=5046271
MixerRedActive=5000447
[Appearance]
Theme=com.obsproject.Yami.Classic
+4 -106
View File
@@ -2,7 +2,6 @@
alias bashrc='source ~/.bashrc'
alias zshrc='source ~/.zshrc'
# alias aliases='cat ~/.bash_aliases' # use 'alias' instead (without args)
alias realias='source ~/.bash_aliases'
alias stow="stow -v"
alias unstow="stow -D"
@@ -10,8 +9,10 @@ alias restow="stow -R"
alias reload='exec ${SHELL} -l'
alias sudo='sudo ' # enable aliases to be sudo'ed
alias g='git'
alias c='composer'
alias hosts="sudo nano /etc/hosts"
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
alias py="python"
alias up='cd ..'
alias back='cd -'
@@ -33,13 +34,12 @@ alias ll='ls -palFh --color=auto'
alias mkdir='mkdir -pv'
alias where='whereis' # zsh builtin
alias ps='ps auxf'
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
# alias ps='ps auxf'
# alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
alias wine='LANG=ru_RU.utf8 wine'
alias wine64='LANG=ru_RU.utf8 wine64'
alias untargz='tar -czf'
alias ports='netstat -tulpan'
# alias pubkey="more ~/.ssh/id_ed25519.pub | xclip -selection clipboard | echo '=> Public key copied to pasteboard.'"
@@ -50,105 +50,3 @@ alias gpg.list='gpg --list-keys --keyid-format SHORT'
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
# alias obscam="sudo modprobe v4l2loopback video_nr=2 card_label='OBS Virtual Camera'"
# Download music from Youtube or Youtube Music
# and save as top quality flac file without video
# Playlist and video/track URLs are supported
# Usage: $ ytm https://www.youtube.com/watch\?v=dQw4w9WgXcQ
# More info: https://github.com/ytdl-org/youtube-dl
ytm() {
youtube-dl \
--extract-audio \
--audio-format flac \
--audio-quality 0 \
--format bestaudio \
--write-info-json \
--output "${HOME}/Музыка/ytm/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
"$@"
}
docker.ip() {
if [ "$1" ]; then
if [ "$1" = "-a" ]; then
docker ps -aq \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
elif [ "$1" = "-c" ]; then
docker compose ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
else
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
docker port "$1"
fi
else
docker ps -q \
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
| sed -e 's#^/##' \
| column -t
fi
}
#################################################################################
# $1 -- file/dir path
# $2 -- permissions (0644, 0755, etc)
# own() { #TODO refactor
# [ "$1" ] && PATH="${1/#\~/$HOME}" || {
# echo "Error (1): path not provided"
# }
# echo $PATH
# [ "$2" ] && PERM="$2" || {
# if [ -d $PATH ]; then
# PERM="0755"
# elif [ -f $PATH ]; then
# PERM="0644"
# else
# echo "Error (2): path not exists"
# fi;
# }
# echo $PERM
# sudo chmod $PERM -R --preserve-root $PATH
# sudo chown $USER. -R --preserve-root $PATH
# }
# function extract {
# if [ -z "$1" ]; then
# # display usage if no parameters given
# echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
# echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
# return 1
# else
# for n in $@
# do
# if [ -f "$n" ] ; then
# case "${n%,}" in
# *.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
# tar xvf "$n" ;;
# *.lzma) unlzma ./"$n" ;;
# *.bz2) bunzip2 ./"$n" ;;
# *.rar) unrar x -ad ./"$n" ;;
# *.gz) gunzip ./"$n" ;;
# *.zip) unzip ./"$n" ;;
# *.z) uncompress ./"$n" ;;
# *.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
# 7z x ./"$n" ;;
# *.xz) unxz ./"$n" ;;
# *.exe) cabextract ./"$n" ;;
# *)
# echo "extract: '$n' - unknown archive method"
# return 1
# ;;
# esac
# else
# echo "'$n' - file does not exist"
# return 1
# fi
# done
# fi
# }
+1 -1
View File
@@ -97,5 +97,5 @@ if ! shopt -oq posix; then
fi
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
[[ -f ~/.bashrc.extra ]] && source ~/.bashrc.extra
[[ -f ~/.bashrc.local ]] && source ~/.bashrc.local
[[ -f ~/.profile ]] && source ~/.profile
+30 -28
View File
@@ -1,8 +1,8 @@
# Generated by Powerlevel10k configuration wizard on 2025-04-10 at 13:49 +08.
# Generated by Powerlevel10k configuration wizard on 2026-04-29 at 22:33 +08.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 24045.
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode,
# 24h time, angled separators, sharp heads, flat tails, 2 lines, dotted, no frame,
# lightest-ornaments, sparse, many icons, concise, instant_prompt=verbose.
# 24h time, round separators, round heads, round tails, 2 lines, solid, no frame,
# darkest-ornaments, sparse, many icons, concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
@@ -10,7 +10,7 @@
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
#
# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
# Temporarily change options.
'builtin' 'local' '-a' 'p10k_config_opts'
@@ -32,7 +32,7 @@
# The list of segments shown on the left. Fill it with the most important segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
# os_icon # os identifier
os_icon # os identifier
dir # current directory
vcs # git status
# =========================[ Line #2 ]=========================
@@ -53,11 +53,11 @@
# asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
# pyenv # python environment (https://github.com/pyenv/pyenv)
pyenv # python environment (https://github.com/pyenv/pyenv)
goenv # go environment (https://github.com/syndbg/goenv)
# nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
# nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
# nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
# node_version # node.js version
# go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org)
@@ -88,24 +88,26 @@
context # user@hostname
# nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
# ranger # ranger shell (https://github.com/ranger/ranger)
# yazi # yazi shell (https://github.com/sxyazi/yazi)
# nnn # nnn shell (https://github.com/jarun/nnn)
# lf # lf shell (https://github.com/gokcehan/lf)
# xplr # xplr shell (https://github.com/sayanarijit/xplr)
vim_shell # vim shell indicator (:sh)
# vim_shell # vim shell indicator (:sh)
midnight_commander # midnight commander shell (https://midnight-commander.org/)
# nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
# chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
# vi_mode # vi mode (you don't need this if you've enabled prompt_char)
# vpn_ip # virtual private network indicator
# load # CPU load
# disk_usage # disk usage
# ram # free RAM
# swap # used swap
todo # todo items (https://github.com/todotxt/todo.txt-cli)
# todo # todo items (https://github.com/todotxt/todo.txt-cli)
# timewarrior # timewarrior tracking status (https://timewarrior.net/)
# taskwarrior # taskwarrior task count (https://taskwarrior.org/)
time # current time
# =========================[ Line #2 ]=========================
# newline
# status # exit code of the last command
newline
# ip # ip address and bandwidth usage for a specified network interface
# public_ip # public IP address
# proxy # system-wide http/https/ftp proxy
@@ -150,13 +152,13 @@
# '─'. The last two make it easier to see the alignment between left and right prompt and to
# separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
# for more compact prompt if using this option.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='·'
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=''
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_GAP_BACKGROUND=
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE
# ornaments defined above.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=244
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=238
# Start filler from the edge of the screen if there are no left segments on the first line.
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}'
# End filler on the edge of the screen if there are no right segments on the first line.
@@ -164,21 +166,21 @@
fi
# Separator between same-color segments on the left.
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B1'
typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B5'
# Separator between same-color segments on the right.
typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B3'
typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B7'
# Separator between different-color segments on the left.
typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0'
typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B4'
# Separator between different-color segments on the right.
typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2'
typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B6'
# The right end of left prompt.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0'
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B4'
# The left end of right prompt.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2'
typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B6'
# The left end of left prompt.
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=''
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B6'
# The right end of right prompt.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B4'
# Left prompt terminator for lines without any segments.
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=
@@ -504,21 +506,21 @@
# Status on success. No content, just an icon. No need to show it if prompt_char is enabled as
# it will signify success by turning green.
typeset -g POWERLEVEL9K_STATUS_OK=true
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='0'
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2
typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=22
# Status when some part of a pipe command fails but the overall exit status is zero. It may look
# like this: 1|0.
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='0'
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=0
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=22
# Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as
# it will signify error by turning red.
typeset -g POWERLEVEL9K_STATUS_ERROR=true
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=3
typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1
@@ -526,7 +528,7 @@
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
# Use terse signal names: "INT" instead of "SIGINT(2)".
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=''
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=3
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=1
+71 -28
View File
@@ -16,38 +16,81 @@ fi
### AAA ##########################################
export JAVA_HOME="/usr/bin/"
export PATH="$PATH:/opt/nvim/bin/"
export PATH="$PATH:$HOME/.local/bin/"
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
isMac() { uname -s | grep -q "Darwin"; }
isLinux() { uname -s | grep -q "Linux"; }
addPath() { [ -d "$1" ] && export PATH="$1:$PATH"; }
safeSource() { [ -s "$1" ] && source "$1" 2>/dev/null || true; }
if hash composer >/dev/null; then
composer_home=$(composer config -g home 2>/dev/null)
export PATH="$PATH:$composer_home/vendor/bin"
fi
# phpbrew
# export PHPBREW_SET_PROMPT=1
# export PHPBREW_RC_ENABLE=1
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
# golang
export PATH="$PATH:/usr/local/go/bin"
export EDITOR="nano"
export NVM_DIR="$HOME/.nvm"
export GOPATH="$HOME/.go"
# rust cargo
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
### MacBook section
if isMac; then
# brew software
if [ -d "/opt/homebrew/bin/" ]; then
# brew itself
eval "$(/opt/homebrew/bin/brew shellenv zsh)"
addPath "/opt/homebrew/bin/"
# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# java
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home"
# The next line updates PATH for Yandex Cloud CLI.
[ -f "$HOME/yandex-cloud/path.bash.inc" ] && source "$HOME/yandex-cloud/path.bash.inc"
# nvm (not nvim!)
safeSource "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
safeSource "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
fi
# The next line enables shell command completion for yc.
[ -f "$HOME/yandex-cloud/completion.zsh.inc" ] && source "$HOME/yandex-cloud/completion.zsh.inc"
# jbtoolbox
addPath "$HOME/Library/Application Support/JetBrains/Toolbox/scripts"
# misc
[[ -f $HOME/.profile.extra ]] && source $HOME/.profile.extra
# orbstack
safeSource "$HOME/.orbstack/shell/init.zsh"
fi
### MacBook section end
### Ubuntu section
if isLinux; then
# golang
export PATH="$PATH:/usr/local/go/bin"
# java
# export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
# nvim (not nvm!)
[ -d "/opt/nvim/bin/" ] && export PATH="$PATH:/opt/nvim/bin/"
# rust cargo
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
# nvm (not nvim!)
safeSource "$NVM_DIR/nvm.sh" # This loads nvm
safeSource "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if hash composer >/dev/null; then
composer_home=$(composer config -g home 2>/dev/null)
export PATH="$PATH:$composer_home/vendor/bin"
fi
# phpbrew
# export PHPBREW_SET_PROMPT=1
# export PHPBREW_RC_ENABLE=1
# [ -f $HOME/.phpbrew/bashrc ] && source $HOME/.phpbrew/bashrc
# The next line updates PATH for Yandex Cloud CLI.
safeSource "$HOME/yandex-cloud/path.bash.inc"
# The next line enables shell command completion for yc.
safeSource "$HOME/yandex-cloud/completion.zsh.inc"
# jbtoolbox
if [ -d "$HOME/.local/share/JetBrains/Toolbox/scripts/" ]; then
export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts/"
fi
fi
### Ubuntu section end
addPath "$JAVA_HOME/bin/"
safeSource "$HOME/.profile.local"
+35 -5
View File
@@ -6,13 +6,13 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# load a random theme each time Oh My Zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
@@ -77,13 +77,43 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting laravel)
plugins=(git docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch $(uname -m)"
# Set personal aliases, overriding those provided by Oh My Zsh libs,
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
# users are encouraged to define aliases within a top-level file in
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
# - $ZSH_CUSTOM/aliases.zsh
# - $ZSH_CUSTOM/macos.zsh
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
### AAA
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
[[ -f ~/.bashrc.extra ]] && source ~/.bashrc.extra
[[ -f ~/.profile ]] && source ~/.profile
+40
View File
@@ -0,0 +1,40 @@
## Краткое описание файлов
- `.bashrc` — bash для интерактивного non-login: история, prompt, aliases, completion.
- `.zshrc` — zsh для интерактивного shell: плагины, тема, инициализация окружения.
- `.profile` — общие login-настройки: PATH, переменные, platform-specific config.
- `.bash_aliases` — набор пользовательских aliases для удобной навигации и команд.
- `.p10k.zsh` — конфигурация темы Powerlevel10k.
## Иерархия загрузки
```
ИНТЕРАКТИВНЫЙ ШЕЛЛ
├── bash
│ ├── .bashrc
│ │ ├── .bash_aliases
│ │ └── .profile
│ └── .profile
└── zsh
├── .zshrc
│ ├── .bash_aliases
│ ├── .profile
│ └── .p10k.zsh
└── .profile
```
## Загрузка по типам shell
```
LOGIN SHELL
├── bash: ~/.bash_profile → ~/.bash_login → ~/.profile
└── zsh: ~/.zprofile → ~/.zshrc
INTERACTIVE NON-LOGIN
├── bash: ~/.bashrc
└── zsh: ~/.zshrc
NON-INTERACTIVE
└── конфиги не загружаются автоматически
```
+75
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
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
+15 -1
View File
@@ -1,3 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail
watch -tn 1 date '+%l:%M:%S%p'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Display current time and unix timestamp (updates every second).
Options:
-h, --help Show this help message
EOF
exit 0
fi
watch -tn 1 date '+%H:%M:%S%n%s'
+25 -9
View File
@@ -1,17 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] [file]
Copy content to system clipboard.
Options:
-h, --help Show this help message
Arguments:
file File to copy (reads from stdin if not specified)
EOF
exit 0
fi
if hash pbcopy 2>/dev/null; then
exec pbcopy
exec pbcopy
elif hash xclip 2>/dev/null; then
exec xclip -selection clipboard
exec xclip -selection clipboard
elif hash putclip 2>/dev/null; then
exec putclip
exec putclip
else
rm -f /tmp/clipboard 2> /dev/null
if [ $# -eq 0 ]; then
cat > /tmp/clipboard
else
cat "$1" > /tmp/clipboard
fi
rm -f /tmp/clipboard 2> /dev/null
if [ $# -eq 0 ]; then
cat > /tmp/clipboard
else
cat "$1" > /tmp/clipboard
fi
fi
+16
View File
@@ -1,6 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <url>
Display detailed curl statistics for a URL.
Options:
-h, --help Show this help message
Arguments:
url URL to fetch statistics for
EOF
exit 0
fi
curl -sLw @- -o /dev/null "$@" <<'EOF'
URL:\t\t\t%{url}\n
Address:\t\t%{remote_ip}:%{remote_port}\n
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
CONTAINER="my-container" # the name of the container in which to 'exec' something
CONFIG="$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))/docker-compose.yml" # path to compose yml file
CMD="docker-compose -f $CONFIG" # docker-compose command
APP_URL='http://localhost:8000/'
open_browser() {
if which xdg-open > /dev/null; then
xdg-open "$1" </dev/null >/dev/null 2>&1 & disown
elif which gnome-open > /dev/null; then
gnome-open "$1" </dev/null >/dev/null 2>&1 & disown
fi
}
case "$1" in
'' | 'help' ) echo -e "Provide one of operations: \t start, stop, up, down, restart, rebuild, open";
echo "Otherwise all args will be passed to 'docker exec -ti $CONTAINER ...'" ;;
'open' ) open_browser $APP_URL ;;
'up' ) $CMD up -d --build ;; # build and start containers
'down' ) $CMD down --remove-orphans ;; # stop and remove containers
'start' ) $CMD start ;; # start containers
'stop' ) $CMD stop ;; # stop containers
'restart' ) $CMD stop && $CMD start ;; # restart containers
'rebuild' ) $CMD down --remove-orphans && $CMD up -d --build ;; # rebuild containers
* ) docker exec -ti $CONTAINER $@ # exec anything in container
esac
+24
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] [name]
Display IP addresses of Docker containers.
Options:
-h, --help Show this help message
Arguments:
name Container name to show specific IP
EOF
exit 0
fi
if [[ -n "$1" ]]; then
docker ps -a --format "{{.ID}} {{.Names}} {{.Ports}}" --filter name="$1"
else
docker ps -a --format "{{.ID}} {{.Names}} {{.Ports}}"
fi
+28
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"
+38 -21
View File
@@ -1,25 +1,42 @@
#!/usr/bin/env bash
set -eo pipefail
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar -jxvf "$1" ;;
*.tar.gz) tar -zxvf "$1" ;;
*.tar.xz) tar -Jxvf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.dmg) hdiutil mount "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar -xvf "$1" ;;
*.tbz2) tar -jxvf "$1" ;;
*.tgz) tar -zxvf "$1" ;;
*.zip) unzip "$1" ;;
*.ZIP) unzip "$1" ;;
*.pax) cat "$1" | pax -r ;;
*.pax.Z) uncompress "$1" --stdout | pax -r ;;
*.rar) unrar x "$1" ;;
*.Z) uncompress "$1" ;;
*) echo "'$1' cannot be extracted/mounted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: $(basename "$0") <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
echo " $(basename "$0") <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
echo
echo "Options:"
echo " -h, --help Show this help message"
exit 0
fi
for n in "$@"; do
if [ ! -f "$n" ] ; then
echo "File does not exist, skipping: '$n'"
continue
fi
case "${n%,}" in
# *.tar) tar -xvf "$1" ;;
# *.tbz2) tar -jxvf "$1" ;;
# *.tar.bz2) tar -jxvf "$1" ;;
# *.tgz) tar -zxvf "$1" ;;
# *.tar.gz) tar -zxvf "$1" ;;
# *.tar.xz) tar -Jxvf "$1" ;;
*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
tar xvf "$n" ;;
*.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
7z x ./"$n" ;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.pax) cat "$1" | pax -r ;;
*.pax.Z) uncompress "$1" --stdout | pax -r ;;
*) echo "extract: '$n' - unknown archive method" ;;
esac
done
+14
View File
@@ -1,3 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Flush DNS cache using resolvectl.
Options:
-h, --help Show this help message
EOF
exit 0
fi
sudo resolvectl flush-caches
+23 -3
View File
@@ -1,5 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
set -eo pipefail
show_usage() {
cat <<EOF
Usage: $(basename "$0") [-h] [search]
List or search HTTP status codes.
Options:
-h, --help Show this help message
Arguments:
search Search term to filter status codes
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_usage
exit 0
fi
statuses="100 Continue
101 Switching Protocols
@@ -62,7 +82,7 @@ statuses="100 Continue
511 Network Authentication Required"
if [ $# -eq 0 ]; then
echo "$statuses"
echo "$statuses"
else
echo "$statuses" | grep -i --color=never "$@"
echo "$statuses" | grep -i --color=never "$@"
fi
+18
View File
@@ -1,4 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <command>
Check if a command is available.
Options:
-h, --help Show this help message
Arguments:
command Command to check
Returns 0 if command exists, 1 otherwise.
EOF
exit 0
fi
[ -n "$1" ] && command -v "$1" || exit 1
+21 -1
View File
@@ -1,4 +1,24 @@
#!/usr/bin/env bash
set -eo pipefail
echo -n "$@" | wc -c | awk '{print $1}'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <string>
Display length of a string.
Options:
-h, --help Show this help message
Arguments:
string String to measure
EOF
exit 0
fi
if [[ ! -t 0 ]]; then # Read from stdin (pipe)
wc -c | awk '{print $1}'
else # Read from arguments
echo -n "$@" | wc -c | awk '{print $1}'
fi
+23 -1
View File
@@ -1,5 +1,27 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <lineno> <file>
Display a specific line from a file.
Options:
-h, --help Show this help message
Arguments:
lineno Line number to display (1-based)
file File to read from
EOF
exit 0
fi
lineno="$1"; shift
sed -n "${lineno}p" -- "$@"
if [[ ! -t 0 ]]; then # Read from stdin (pipe)
sed -n "${lineno}p"
else # Read from file
sed -n "${lineno}p" -- "$@"
fi
+18 -1
View File
@@ -1,4 +1,21 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <directory>
Create directory and change to it.
Options:
-h, --help Show this help message
Arguments:
directory Directory to create and enter
EOF
exit 0
fi
mkdir -p "$1"
cd "$1" || exit
cd "$1" || false
+27 -13
View File
@@ -1,21 +1,35 @@
#!/usr/bin/env bash
set -eo pipefail
if [ ! $# -eq 1 ]; then
echo 'mksh takes one argument' 1>&2
exit 1
elif [ -e "$1" ]; then
echo "$1 already exists" 1>&2
exit 1
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <script>
Create a new bash script with boilerplate.
Options:
-h, --help Show this help message
Arguments:
script Script filename to create
EOF
exit 0
fi
echo '#!/usr/bin/env bash
set -e
set -u
set -o pipefail
if [ ! $# -eq 1 ]; then
echo 'mksh takes one argument' 1>&2
exit 1
elif [ -e "$1" ]; then
echo "$1 already exists" 1>&2
exit 1
fi
' > "$1"
{
echo '#!/usr/bin/env bash'
echo 'set -eo pipefail'
echo
} > "$1"
chmod u+x "$1"
nano "$1"
exec "$EDITOR" "$1"
+20 -2
View File
@@ -1,4 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
curl http://ipecho.net/plain
echo
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Display external IP address.
Options:
-h, --help Show this help message
EOF
exit 0
fi
if [[ "$1" == "-2" ]]; then
curl -fsSL https://api.myip.com | jq -r .ip
else
curl -fsSL http://ipecho.net/plain
echo
fi
+171
View File
@@ -0,0 +1,171 @@
#!/bin/bash
#shellcheck disable=SC2155,SC2207
set -eo pipefail
NOTES_DIR="$HOME/notes"
EDITOR="${EDITOR:-nano}"
mkdir -p "$NOTES_DIR"
show_usage() {
cat <<EOF
Usage: $(basename "$0") <command> [options]
Commands:
add Create a new note
edit Open a note in editor
rm Remove a note
list List all notes
Options for 'add':
-n, --name <name> Custom note name (default: <unixtime>-untitled-note.md)
-t, --title <title> Custom note title (default: "Untitled note")
--no-time Don't add creation timestamp
--no-edit Don't open editor
Options for 'edit':
<name> Note filename to edit
Options for 'rm':
<name> Note filename to remove
Options for 'list':
(none)
EOF
}
cmd_add() {
local name="untitled-note"
local title="Untitled note"
local add_time=true
local new_edit=true
while [[ $# -gt 0 ]]; do
case "$1" in
-n|--name) name="$2"; shift 2 ;;
-t|--title) title="$2"; shift 2 ;;
--no-time) add_time=false; shift ;;
--no-edit) new_edit=false; shift ;;
*)
echo "Unknown option: $1"
show_usage
exit 1
;;
esac
done
local filename="$(date +%s)-${name}.md"
local filepath="$NOTES_DIR/$filename"
{
echo "# $title"
echo
if [[ "$add_time" == true ]]; then
echo
echo "Created at $(date '+%Y-%m-%d %H:%M:%S')"
echo
fi
echo "---"
echo
} > "$filepath"
echo "Created note: $filepath"
if [[ "$new_edit" == true ]]; then
$EDITOR "$filepath"
fi
}
cmd_edit() {
if [[ $# -lt 1 ]]; then
echo "Error: Note name required"
show_usage
exit 1
fi
local filename="$1"
local filepath="$NOTES_DIR/$filename"
if [[ ! -f "$filepath" ]]; then
echo "Error: Note not found: $filename"
exit 1
fi
$EDITOR "$filepath"
}
cmd_rm() {
if [[ $# -lt 1 ]]; then
echo "Error: Note name required"
show_usage
exit 1
fi
local filename="$1"
local filepath="$NOTES_DIR/$filename"
if [[ ! -f "$filepath" ]]; then
echo "Error: Note not found: $filename"
exit 1
fi
rm -v "$filepath"
}
cmd_list() {
local count=0
printf "%-40s %s\n" "Filename" "Title"
printf "%-40s %s\n" "--------" "-----"
# Use nullglob to handle empty directory case
local shopt_save
shopt_save=$(shopt -p nullglob)
shopt -s nullglob
local files=("$NOTES_DIR"/*.md)
# Restore original nullglob setting
eval "$shopt_save"
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
local filename=$(basename "$file")
local title=$(sed -n 's/^# \([^#].*\)/\1/p' "$file" | head -n1)
if [[ -z "$title" ]]; then
title="Untitled note"
fi
printf "%-40s # %s\n" "$filename" "$title"
((count++))
fi
done
if [[ $count -eq 0 ]]; then
echo "No notes found"
else
echo ""
echo "Total: $count note(s)"
fi
}
if [[ $# -lt 1 ]]; then
cmd_list "$@"
exit 0
fi
command="$1"
shift
case "$command" in
add) cmd_add "$@" ;;
edit) cmd_edit "$@" ;;
rm) cmd_rm "$@" ;;
list) cmd_list "$@" ;;
-h|--help|help) show_usage ;;
*)
echo "Unknown command: $command"
show_usage
exit 1
;;
esac
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
#shellcheck disable=SC2155,SC2207,SC2309,SC2034,SC2154,SC1087
set -eo pipefail
_notes_completion() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local command="${COMP_WORDS[1]}"
if [[ COMP_CWORD -eq 1 ]]; then
COMPREPLY=($(compgen -W "add edit rm list" -- "$cur"))
return
fi
if [[ "$command" == "edit" || "$command" == "rm" ]]; then
local notes_dir="$HOME/notes"
local notes=()
if [[ -d "$notes_dir" ]]; then
for file in "$notes_dir"/*.md; do
if [[ -f "$file" ]]; then
notes+=("$(basename "$file")")
fi
done
fi
local IFS=$'\n'
COMPREPLY=($(compgen -W "$(printf '%s\n' "${notes[@]}")" -- "$cur"))
compopt -o filenames
return
fi
}
_notes() {
local -a commands=(
'add:Create a new note'
'edit:Open a note in editor'
'rm:Remove a note'
'list:List all notes'
)
if (( CURRENT == 2 )); then
_describe 'command' commands
elif (( CURRENT >= 3 )); then
case $words[2] in
edit|rm)
local notes_dir="$HOME/notes"
if [[ -d "$notes_dir" ]]; then
_files -W "$notes_dir" -g '*.md'
fi
;;
*)
_message 'no more arguments'
;;
esac
fi
}
if [[ -n "$BASH_VERSION" ]]; then
complete -F _notes_completion notes ./notes
fi
if [[ -n "$ZSH_VERSION" ]]; then
compdef _notes notes ./notes
fi
+15 -1
View File
@@ -1,3 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail
date '+%d.%m.%Y %H:%M:%S'
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Display current time and unix timestamp.
Options:
-h, --help Show this help message
EOF
exit 0
fi
date '+%H:%M:%S%n%s'
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <files...>
Change ownership of files to current user.
Options:
-h, --help Show this help message
Arguments:
files Files or directories to change ownership
EOF
exit 0
fi
sudo chown "$(whoami)". -R --changes --preserve-root "$@"
+17 -4
View File
@@ -1,12 +1,25 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Paste content from system clipboard.
Options:
-h, --help Show this help message
EOF
exit 0
fi
if hash pbpaste 2>/dev/null; then
exec pbpaste
exec pbpaste
elif hash xclip 2>/dev/null; then
exec xclip -selection clipboard -o
exec xclip -selection clipboard -o
elif [[ -e /tmp/clipboard ]]; then
exec cat /tmp/clipboard
exec cat /tmp/clipboard
else
echo ''
echo ''
fi
+18
View File
@@ -1,4 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Set default permissions for files and directories in current directory.
Options:
-h, --help Show this help message
Sets:
- Files: 0664 (rw-rw-r--)
- Directories: 0775 (rwxrwxr-x)
EOF
exit 0
fi
# TODO permissions via arguments
+20
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 -7
View File
@@ -1,12 +1,29 @@
#!/usr/bin/env bash
set -eo pipefail
process_list="$(ps -eo 'pid command')"
if [[ $# != 0 ]]; then
process_list="$(echo "$process_list" | grep -Fiw "$@")"
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] [filter]
Display running processes.
Options:
-h, --help Show this help message
Arguments:
filter Optional filter string to match processes
EOF
exit 0
fi
echo "$process_list" |
grep -Fv "${BASH_SOURCE[0]}" |
grep -Fv grep |
GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
if [[ $# == 0 ]]; then
process_list="$(ps -eo 'pid command')"
else
process_list="$(echo "$process_list" | grep -Fiw "$@")"
fi
echo "$process_list" \
| grep -Fv "${BASH_SOURCE[0]}" \
| grep -Fv grep \
| GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
+13
View File
@@ -1,6 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Open a temporary scratchpad file in \$EDITOR.
Options:
-h, --help Show this help message
EOF
exit 0
fi
file="$(mktemp)"
echo "Editing $file"
exec "$EDITOR" "$file"
+26 -13
View File
@@ -1,23 +1,36 @@
#!/usr/bin/env bash
set -eo pipefail
port='8888'
if [ $# -eq 1 ]; then
port="$1"
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] [port]
Start a simple HTTP server in current directory.
Options:
-h, --help Show this help message
Arguments:
port Port number (default: 8888)
EOF
exit 0
fi
port="${1:-8888}"
if hash php 2>/dev/null; then
exec php -S "localhost:$port"
exec php -S "localhost:$port"
elif hash python3 2>/dev/null; then
exec python3 -m http.server "$port"
exec python3 -m http.server "$port"
elif hash python 2>/dev/null; then
major_version="$(python -c 'import platform as p;print(p.python_version_tuple()[0])')"
if [[ "$major_version" == '3' ]]; then
exec python -m http.server "$port"
else
exec python -m SimpleHTTPServer "$port"
fi
major_version="$(python -c 'import platform as p;print(p.python_version_tuple()[0])')"
if [[ "$major_version" == '3' ]]; then
exec python -m http.server "$port"
else
exec python -m SimpleHTTPServer "$port"
fi
else
echo 'unable to start HTTP server' 1>&2
exit 1
echo 'unable to start HTTP server' 1>&2
exit 1
fi
+24
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
+16
View File
@@ -1,6 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <seconds>
Set a timer with desktop notification.
Options:
-h, --help Show this help message
Arguments:
seconds Timer duration in seconds
EOF
exit 0
fi
sleep "$1"
notify-send 'Timer complete!' \
-u normal \
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Display current date.
Options:
-h, --help Show this help message
EOF
exit 0
fi
date '+%d.%m.%Y'
+17
View File
@@ -1,3 +1,20 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <files...>
Move files to trash using gio.
Options:
-h, --help Show this help message
Arguments:
files Files or directories to move to trash
EOF
exit 0
fi
gio trash "$@"
+20 -4
View File
@@ -1,8 +1,24 @@
#!/usr/bin/env bash
set -u
#!/husr/bin/env bash
set -uo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <command>
Retry a command until it fails.
Options:
-h, --help Show this help message
Arguments:
command Command to repeatedly execute
EOF
exit 0
fi
"$@"
while [[ "$?" -eq 0 ]]; do
sleep 0.5
"$@"
sleep 0.5
"$@"
done
+19 -3
View File
@@ -1,8 +1,24 @@
#!/usr/bin/env bash
set -u
set -uo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <command>
Retry a command until it succeeds.
Options:
-h, --help Show this help message
Arguments:
command Command to repeatedly execute
EOF
exit 0
fi
"$@"
while [[ "$?" -ne 0 ]]; do
sleep 0.5
"$@"
sleep 0.5
"$@"
done
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Display current unix timestamp.
Options:
-h, --help Show this help message
EOF
exit 0
fi
date '%s'
+16 -3
View File
@@ -1,10 +1,23 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Upgrade system packages (apt, snap, flatpak).
Options:
-h, --help Show this help message
EOF
exit 0
fi
is apt >/dev/null && {
echo
echo "==========================="
echo "Upgarding apt packages..."
echo "Upgrading apt packages..."
echo "==========================="
echo
sudo apt update
@@ -14,7 +27,7 @@ is apt >/dev/null && {
is snap >/dev/null && {
echo
echo "==========================="
echo "Upgarding snap packages..."
echo "Upgrading snap packages..."
echo "==========================="
echo
sudo snap refresh
@@ -23,7 +36,7 @@ is snap >/dev/null && {
is flatpak >/dev/null && {
echo
echo "==========================="
echo "Upgarding flatpak packages..."
echo "Upgrading flatpak packages..."
echo "==========================="
echo
sudo flatpak update -y
+36 -9
View File
@@ -1,12 +1,39 @@
#!/usr/bin/env bash
set -eo pipefail
curl "https://r.jina.ai/$1" \
-sS \
-H "DNT: 1" \
-H "X-Base: final" \
-H "X-Engine: direct" \
-H "X-Md-Em-Delimiter: *" \
-H "X-Md-Heading-Style: setext" \
-H "X-Md-Link-Reference-Style: collapsed" \
-H "X-Md-Link-Style: referenced"
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <url>
Convert webpage URL to markdown using jina.ai.
Options:
-h, --help Show this help message
Arguments:
url URL of webpage to convert
EOF
exit 0
fi
# More details: https://jina.ai/reader/
#TODO: проверить https://defuddle.md/
url="$1"; shift
curl "https://r.jina.ai/$url" \
-sS \
-H "DNT: 1" \
-H "X-Md-Hr: ---" \
-H "X-Base: final" \
-H "X-Timeout: 10" \
-H "X-Locale: ru-RU" \
-H "X-No-Cache: true" \
-H "X-Engine: browser" \
-H "X-User-Agent: url2md" \
-H "X-Md-Em-Delimiter: *" \
-H "X-Md-Link-Style: inlined" \
-H "X-Return-Format: markdown" \
-H "X-Keep-Img-Data-Url: true" \
-H "X-Md-Link-Reference-Style: collapsed" \
"$@"
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <input.mp4>
Compress MP4 video using ffmpeg.
Options:
-h, --help Show this help message
Arguments:
input.mp4 Input video file (must be .mp4)
Output:
<input>_compressed.mp4
EOF
exit 0
fi
filename="${1%.mp4}"
ffmpeg \
-i "$filename".mp4 \
-c:v libx264 \
-crf 28 \
-preset veryslow \
-c:a aac \
-b:a 128k \
"$filename"_compressed.mp4
+21 -5
View File
@@ -1,11 +1,27 @@
#!/usr/bin/env bash
set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <pid>
Wait for a process to complete.
Options:
-h, --help Show this help message
Arguments:
pid Process ID to wait for
EOF
exit 0
fi
if hash systemd-inhibit 2>/dev/null; then
systemd-inhibit \
--who=waitfor \
--why="Awaiting PID $1" \
systemd-inhibit \
--who=waitfor \
--why="Awaiting PID $1" \
tail --pid="$1" -f /dev/null
else
tail --pid="$1" -f /dev/null
else
tail --pid="$1" -f /dev/null
fi
+18
View File
@@ -1,4 +1,22 @@
#!/usr/bin/env bash
#set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <command>
Show detailed information about a command.
Options:
-h, --help Show this help message
Arguments:
command Command to investigate
EOF
exit 0
fi
set -x
type "$1" 2>/dev/null
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -eo pipefail
# Download music from Youtube or Youtube Music
# and save as top quality flac file without video
# Playlist and video/track URLs are supported
# Usage: $ ytmusic https://www.youtube.com/watch?v=dQw4w9WgXcQ
# More info: https://github.com/ytdl-org/youtube-dl
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <url>
Download music from YouTube or YouTube Music as FLAC.
Options:
-h, --help Show this help message
Arguments:
url YouTube or YouTube Music URL (playlist or video)
Output:
$HOME/ytmusic/<playlist>/<channel> - <title>.flac
EOF
exit 0
fi
DEST_PATH="${HOME}/ytmusic"
mkdir -p "${DEST_PATH}"
youtube-dl \
--extract-audio \
--audio-format flac \
--audio-quality 0 \
--format bestaudio \
--write-info-json \
--output "${DEST_PATH}/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
"$@"
+44 -7
View File
@@ -5,7 +5,6 @@
"workbench.colorTheme": "Atom One Dark",
"workbench.preferredDarkColorTheme": "Atom One Dark",
"workbench.iconTheme": "material-icon-theme",
// "workbench.tree.indent": 10,
"workbench.tree.renderIndentGuides": "always",
"workbench.view.alwaysShowHeaderActions": true,
@@ -32,10 +31,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,
@@ -44,7 +43,34 @@
"statusbar_command.applicationCommands": [
{
"text": "$(arrow-left)",
"text": "$(debug-restart)",
"tooltip": "Перезагрузить расширения",
"id": "reload-ext",
"name": "Перезагрузить расширения",
"priority": 1,
"alignment": "left",
"command": "workbench.action.restartExtensionHost"
},
{
"text": "$(console) Терминал",
"tooltip": "Терминал",
"id": "terminal",
"name": "Терминал",
"priority": 1,
"alignment": "left",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"text": "$(credit-card) DevTools",
"tooltip": "VSCode Dev Tools",
"id": "dev-tools",
"name": "VSCode Dev Tools",
"priority": 1,
"alignment": "left",
"command": "workbench.action.toggleDevTools"
},
{
"text": "$(arrow-left) Назад",
"tooltip": "Назад",
"id": "nav-back",
"name": "Назад",
@@ -53,13 +79,22 @@
"command": "workbench.action.navigateBack"
},
{
"text": "$(arrow-right)",
"text": "$(arrow-right) Вперёд",
"tooltip": "Вперёд",
"id": "nav-forw",
"name": "Вперёд",
"priority": 1,
"alignment": "left",
"command": "workbench.action.navigateForward"
},
{
"text": "$(squirrel) Decode JWT",
"tooltip": "Decode JWT",
"id": "decode_jwt",
"name": "decode_jwt",
"priority": 1,
"alignment": "left",
"command": "extension.jwt-decoder"
}
],
@@ -102,7 +137,7 @@
// terminal
//----------------------------------------------------------------
"terminal.integrated.fontFamily": "JetBrainsMono Nerd Font, MesloLGS NF, Ubuntu Mono",
"terminal.integrated.fontFamily": "\"JetBrainsMono Nerd Font\", \"MesloLGS NF\", Ubuntu Mono",
"terminal.integrated.fontSize": 13,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.defaultProfile.linux": "zsh",
@@ -285,5 +320,7 @@
"git diff",
"git show"
],
"kilo-code.deniedCommands": []
"kilo-code.deniedCommands": [],
"chat.disableAIFeatures": true,
"terminal.external.osxExec": "zsh"
}
+14
View File
@@ -35,6 +35,20 @@ include "%L"
<Multi_key> <P> <minus> : "₽" # рубли
<Multi_key> <p> <minus> : "₽" # рубли
<Multi_key> <plus> <minus> : "±"
<Multi_key> <^> <|> : "↑"
<Multi_key> <^> <equal> : "⇑"
<Multi_key> <|> <v> : "↓"
<Multi_key> <v> <equal> : "⇓"
<Multi_key> <less> <minus> : "←"
<Multi_key> <less> <equal> : "⇐"
<Multi_key> <minus> <greater> : "→"
<Multi_key> <equal> <greater> : "⇒"
# ################################################################################
# # Compose Table for Cyrillic Alphabets / Compose-таблица для кириллических алфавитов
# ################################################################################