diff options
| -rw-r--r-- | ar/.config/transmission-daemon/settings.json | 15 | ||||
| -rwxr-xr-x | ar/.local/bin/ghswh | 82 | ||||
| -rw-r--r-- | global/.ssh/config | 2 |
3 files changed, 96 insertions, 3 deletions
diff --git a/ar/.config/transmission-daemon/settings.json b/ar/.config/transmission-daemon/settings.json index 1712475..d4f6f3f 100644 --- a/ar/.config/transmission-daemon/settings.json +++ b/ar/.config/transmission-daemon/settings.json @@ -36,14 +36,21 @@ "peer-port-random-on-start": false, "peer-socket-tos": "le", "pex-enabled": true, + "pidfile": "", "port-forwarding-enabled": true, "preallocation": 1, + "preferred_transports": [ + "utp", + "tcp" + ], "prefetch-enabled": true, + "proxy_url": null, "queue-stalled-enabled": true, "queue-stalled-minutes": 30, - "ratio-limit": 2, + "ratio-limit": 2.0, "ratio-limit-enabled": false, "rename-partial-files": false, + "reqq": 2000, "rpc-authentication-required": false, "rpc-bind-address": "0.0.0.0", "rpc-enabled": true, @@ -65,13 +72,17 @@ "script-torrent-done-seeding-filename": "", "seed-queue-enabled": true, "seed-queue-size": 0, + "sequential_download": false, + "sleep-per-seconds-during-verify": 100, "speed-limit-down": 100, "speed-limit-down-enabled": false, "speed-limit-up": 0, "speed-limit-up-enabled": true, "start-added-torrents": true, + "start_paused": false, "tcp-enabled": true, "torrent-added-verify-mode": "fast", + "torrent_complete_verify_enabled": false, "trash-can-enabled": true, "trash-original-torrent-files": true, "umask": "022", @@ -80,4 +91,4 @@ "watch-dir": "/home/si/Torrents", "watch-dir-enabled": true, "watch-dir-force-generic": false -} +}
\ No newline at end of file diff --git a/ar/.local/bin/ghswh b/ar/.local/bin/ghswh new file mode 100755 index 0000000..3faec48 --- /dev/null +++ b/ar/.local/bin/ghswh @@ -0,0 +1,82 @@ +#!/bin/sh +# POSIX compliant script to switch GitHub CLI accounts using fzf + +set -e + +# Check if gh is installed +if ! command -v gh >/dev/null 2>&1; then + printf "Error: gh (GitHub CLI) is not installed\n" >&2 + exit 1 +fi + +# Check if fzf is installed +if ! command -v fzf >/dev/null 2>&1; then + printf "Error: fzf is not installed\n" >&2 + exit 1 +fi + +# Get authentication status and parse accounts with active status +# Parse the full status output to get hostname, username, login status, and active status +status_output=$(gh auth status 2>&1) + +# Use awk to parse multi-line account information and get both active and inactive accounts +parsed_data=$(printf "%s\n" "$status_output" | awk ' + /Logged in to|Failed to log in to/ { + # Extract hostname and username + match($0, /(Logged in to|Failed to log in to) ([^ ]+) account ([^ ]+)/, arr) + hostname = arr[2] + username = arr[3] + logged_status = (arr[1] == "Logged in to" ? "✓" : "✗") + account_key = username "@" hostname + accounts[account_key] = logged_status + account_order[++order_count] = account_key + } + /Active account: true/ { + # Mark the previous account as active + if (account_key != "") { + active_account = account_key + } + } + END { + # Print active account on first line + print "ACTIVE:" active_account + # Print other accounts + for (i = 1; i <= order_count; i++) { + key = account_order[i] + # Skip the active account + if (key == active_account) continue + status = accounts[key] + print key " [" status "]" + } + } +') + +# Extract active account and other accounts +current_account=$(printf "%s\n" "$parsed_data" | grep "^ACTIVE:" | cut -d: -f2) +display_accounts=$(printf "%s\n" "$parsed_data" | grep -v "^ACTIVE:") + +if [ -z "$display_accounts" ]; then + printf "No other accounts found. You are already on the only account.\n" >&2 + exit 1 +fi + +# Use fzf to select account with current account in header +selected=$(printf "%s\n" "$display_accounts" | fzf --prompt="Switch to: " --header="*$current_account" --height=40% --border --reverse) + +if [ -z "$selected" ]; then + printf "No account selected\n" >&2 + exit 1 +fi + +# Extract hostname and username from selection +# Remove status indicator: "username@hostname [✓]" -> "username@hostname" +selected_clean=$(printf "%s" "$selected" | sed 's/ \[.*\]//') +hostname=$(printf "%s" "$selected_clean" | cut -d'@' -f2) +username=$(printf "%s" "$selected_clean" | cut -d'@' -f1) + +printf "Switching to %s on %s...\n" "$username" "$hostname" + +# Switch to selected account using gh auth switch +gh auth switch --hostname "$hostname" --user "$username" + +printf "Successfully switched to %s@%s\n" "$username" "$hostname" diff --git a/global/.ssh/config b/global/.ssh/config index a5d8850..efd7937 100644 --- a/global/.ssh/config +++ b/global/.ssh/config @@ -23,7 +23,7 @@ Host epc-portal IdentityFile ~/.ssh/keys/evcp-LightsailDefaultKey-ap-northeast-2.pem Host s-onlyone - HostName 15.165.19.26 + HostName 3.36.65.18 User ec2-user IdentityFile ~/.ssh/keys/evcp-LightsailDefaultKey-ap-northeast-2.pem |
