diff options
Diffstat (limited to 'ar/.local/bin')
| -rwxr-xr-x | ar/.local/bin/dmenusmbadd | 12 | ||||
| -rwxr-xr-x | ar/.local/bin/rgafiles | 10 | ||||
| -rwxr-xr-x | ar/.local/bin/ylog | 51 |
3 files changed, 54 insertions, 19 deletions
diff --git a/ar/.local/bin/dmenusmbadd b/ar/.local/bin/dmenusmbadd index d1b76cd..b4b720b 100755 --- a/ar/.local/bin/dmenusmbadd +++ b/ar/.local/bin/dmenusmbadd @@ -32,9 +32,15 @@ else target_name="$folder_name" fi - folder_path=$(for path in $base_path; do - find "$path" -type d -iname "$target_name" -print 2>/dev/null - done | sort -r | dmenu -l 10 -p "Select the folder to share:") + if command -v fd >/dev/null 2>&1; then + # Use fd if available (fastest) + folder_path=$(for path in $base_path; do + fd -t d -d 3 -i "^$target_name$" "$path" 2>/dev/null + done | sed 's:/$::' | sort -r | dmenu -l 10 -p "Select the folder to share:") + else + # Fallback to parallel find with depth limit + folder_path=$(printf "%s\n" $base_path | xargs -P 3 -I {} find {} -maxdepth 3 -type d -iname "$target_name" -print 2>/dev/null | sed 's:/$::' | sort -r | dmenu -l 10 -p "Select the folder to share:") + fi [ -z "$folder_path" ] && notify-send "📁Folder not found." && exit 1 fi diff --git a/ar/.local/bin/rgafiles b/ar/.local/bin/rgafiles index 1a396df..fe61604 100755 --- a/ar/.local/bin/rgafiles +++ b/ar/.local/bin/rgafiles @@ -37,16 +37,17 @@ search_term() { # Construct the preview command preview_cmd=$(printf "rga %s --pretty --context 10 '%s' {}" "$case_flag" "$*") rga_output=$(rga --follow --no-ignore --hidden --text --max-count=1 ${case_flag:+$case_flag} --files-with-matches --no-messages \ + --glob '!**/.cache/*' \ --glob '!**/.git/*' \ - --glob '!**/node_modules/*' \ + --glob '!**/.github/*' \ --glob '!**/.next/*' \ - --glob '!**/dist/*' \ + --glob '!**/.venv/*' \ --glob '!**/build/*' \ - --glob '!**/.cache/*' \ --glob '!**/coverage/*' \ + --glob '!**/dist/*' \ + --glob '!**/node_modules/*' \ --glob '!**/target/*' \ --glob '!**/vendor/*' \ - --glob '!**/.venv/*' \ --glob '!**/venv/*' \ "$*") @@ -83,6 +84,7 @@ list_or_open_project_files() { rga_result=$(rga --follow --no-ignore --hidden --text --max-count=1 --files-with-matches --no-messages \ --glob '!**/.cache/*' \ --glob '!**/.git/*' \ + --glob '!**/.github/*' \ --glob '!**/.next/*' \ --glob '!**/.venv/*' \ --glob '!**/build/*' \ diff --git a/ar/.local/bin/ylog b/ar/.local/bin/ylog index c56df36..8ea8808 100755 --- a/ar/.local/bin/ylog +++ b/ar/.local/bin/ylog @@ -29,11 +29,12 @@ Options: -s SCOPE Select log scope (default: all) all : recordings + access + hidden + diary + peertube - recordings : recordings.* logs only access : access.* logs only - hidden : hidden.access.* logs only diary : diary.* logs only + hidden : hidden.access.* logs only + media : media.access.* logs only peertube : peertube.* logs only + recordings : recordings.* logs only -n Disable Firefox exclusion (by default, Firefox lines are excluded) @@ -53,14 +54,15 @@ Options: Examples: ylog # All logs, last 10 lines each - ylog -s recordings # Recordings logs only, last 10 lines each ylog -s diary # Diary logs only, last 10 lines each - ylog -s peertube # Peertube logs only, last 10 lines each + ylog -s media # Media logs only, last 10 lines each + ylog -s peertube # Peertube logs only, last 10 lines each + ylog -s recordings # Recordings logs only, last 10 lines each ylog -c kr -t 1.2.3.4 # Search specific IP in Korean logs - ylog -c kr -s diary # Korean diary logs only + ylog -c kr -s diary # Korean diary logs only ylog -t all -l 50 # All logs, last 50 lines each ylog -d 1 # Logs from 1 day ago only - ylog -d ~2 # Logs from 2 days ago to today + ylog -d ~2 # Logs from 2 days ago to today EOF exit 0 } @@ -142,14 +144,39 @@ pick_files() { ;; esac fi + # media logs: similar structure to recordings + if [ "$SCOPE" = "media" ] || [ "$SCOPE" = "all" ]; then + if [ "$COUNTRY" = "all" ]; then + for q in "$LOG_DIR/media.access.log" "$LOG_DIR/media.access.log".*; do + [ -e "$q" ] && printf "%s\n" "$q" + done + fi + case "$COUNTRY" in + kr) for q in "$LOG_DIR/media.kr.log" "$LOG_DIR/media.kr.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + us) for q in "$LOG_DIR/media.us.log" "$LOG_DIR/media.us.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + all) + for p in media.kr.log media.us.log; do + for q in "$LOG_DIR/$p" "$LOG_DIR/$p".*; do [ -e "$q" ] && printf "%s\n" "$q"; done + done + ;; + esac + fi # peertube logs if [ "$SCOPE" = "peertube" ] || [ "$SCOPE" = "all" ]; then - for q in "$LOG_DIR/peertube.access.log" "$LOG_DIR/peertube.access.log".*; do - [ -e "$q" ] && printf "%s\n" "$q" - done - for q in "$LOG_DIR/peertube.error.log" "$LOG_DIR/peertube.error.log".*; do - [ -e "$q" ] && printf "%s\n" "$q" - done + if [ "$COUNTRY" = "all" ]; then + for q in "$LOG_DIR/peertube.access.log" "$LOG_DIR/peertube.access.log".*; do + [ -e "$q" ] && printf "%s\n" "$q" + done + fi + case "$COUNTRY" in + kr) for q in "$LOG_DIR/peertube.kr.log" "$LOG_DIR/peertube.kr.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + us) for q in "$LOG_DIR/peertube.us.log" "$LOG_DIR/peertube.us.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + all) + for p in peertube.kr.log peertube.us.log; do + for q in "$LOG_DIR/$p" "$LOG_DIR/$p".*; do [ -e "$q" ] && printf "%s\n" "$q"; done + done + ;; + esac fi } |
