Compare commits

..
Author SHA1 Message Date
Robby RussellandClaude Fable 5.1 ce38abe854 docs(gh): fix the completion cache path in the README
The cache section still described the pre-#10616 layout: a _gh file inside
the plugin directory and a gh_version marker. The plugin has written to
$ZSH_CACHE_DIR/completions/_gh since then and keeps no version file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 13:10:23 -07:00
7 changed files with 37 additions and 64 deletions
@@ -57,7 +57,7 @@ function frontend() {
codepen 'https://codepen.io/search/pens?q='
compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q='
dartlang $(_frontend_fallback 'dart.dev')
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
emberjs $(_frontend_fallback 'emberjs.com/')
flowtype $(_frontend_fallback 'flow.org/en/docs/')
fontello 'http://fontello.com/#search='
+1 -4
View File
@@ -17,7 +17,4 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH/plugins/gh/_gh` completions script
- `$ZSH_CACHE_DIR/gh_version` version of GitHub CLI, used to invalidate
the cache.
- `$ZSH_CACHE_DIR/completions/_gh` completions script
+1
View File
@@ -15,6 +15,7 @@ function gradle-or-gradlew() {
# if gradlew found, run it instead of gradle
if [[ -f "$project_root/gradlew" ]]; then
echo "executing gradlew instead of gradle"
"$project_root/gradlew" "$@"
else
command gradle "$@"
+1 -3
View File
@@ -19,6 +19,4 @@ Provided aliases:
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin stores its internal files in `$OTP_HOME`, which can be set in your zshrc.
If `$OTP_HOME` is not set it defaults to either `$HOME/.otp` or `$XDG_DATA_HOME/otp`,
depending on whether `~/.otp` already exists, or whether `$XDG_DATA_HOME` is set.
The plugin uses `$HOME/.otp` to store its internal files.
+1 -7
View File
@@ -1,10 +1,4 @@
if [[ -z "$OTP_HOME" ]]; then
if [[ ! -d "$HOME/.otp" ]] && [[ -n "$XDG_DATA_HOME" ]]; then
export OTP_HOME="$XDG_DATA_HOME/otp"
else
export OTP_HOME=~/.otp
fi
fi
export OTP_HOME=~/.otp
mkdir -p $OTP_HOME
function ot () {
+3 -3
View File
@@ -33,10 +33,10 @@ plugins=(... systemadmin)
| killit | Kills any process that matches a regular expression passed to it |
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
| sortcons | Sort connections by state |
| con80 | View all connections on ports 80 and 443, or on the ports given as arguments (`con80 8080`) |
| con80 | View all 80 Port Connections |
| sortconip | On the connected IP sorted by the number of connections |
| req20 | List the top 20 requests on ports 80 and 443, or on the ports given as arguments (`req20 8080`) |
| http20 | List the top 20 connections to ports 80 and 443 based on tcpdump data, or to the ports given as arguments |
| req20 | List the top 20 requests on port 80 |
| http20 | List the top 20 connections to port 80 based on tcpdump data |
| timewait20 | List the top 20 time_wait connections |
| syn20 | List the top 20 SYN connections |
| port_pro | Output all processes according to the port number |
+29 -46
View File
@@ -65,77 +65,60 @@ fi
# Sort connection state
function sortcons() {
if (( $+commands[ss] )); then
LANG= ss -nat | awk 'NR > 1 {print $1}'
else
LANG= netstat -nat | awk 'NR > 2 {print $6}'
fi | sort | uniq -c | sort -rn
{
LANG= ss -nat | awk 'NR > 1 {print $1}' \
|| LANG= netstat -nat | awk 'NR > 2 {print $6}'
} | sort | uniq -c | sort -rn
}
# View all connections on the given ports (default 80 and 443)
# View all 80 Port Connections
function con80() {
local -a ports=($@)
(( $# )) || ports=(80 443)
if (( $+commands[ss] )); then
LANG= ss -nat
else
LANG= netstat -nat
fi | grep -E ":(${(j:|:)ports})[^0-9]" | wc -l
{
LANG= ss -nat || LANG= netstat -nat
} | grep -E ":80[^0-9]" | wc -l
}
# On the connected IP sorted by the number of connections
function sortconip() {
if (( $+commands[ss] )); then
LANG= ss -ntu | awk 'NR > 1 {print $6}'
else
LANG= netstat -ntu | awk 'NR > 2 {print $5}'
fi | cut -d: -f1 | sort | uniq -c | sort -n
{
LANG= ss -ntu | awk 'NR > 1 {print $6}' \
|| LANG= netstat -ntu | awk 'NR > 2 {print $5}'
} | cut -d: -f1 | sort | uniq -c | sort -n
}
# top20 of Find the number of requests on the given ports (default 80 and 443)
# top20 of Find the number of requests on 80 port
function req20() {
local -a ports=($@)
(( $# )) || ports=(80 443)
if (( $+commands[ss] )); then
LANG= ss -tn
else
LANG= netstat -tn
fi | awk -v ports="${(j:|:)ports}" '$4 ~ ":("ports")$" {print $5}' \
| awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
{
LANG= ss -tn | awk '$4 ~ /:80$/ {print $5}' \
|| LANG= netstat -tn | awk '$4 ~ /:80$/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
}
# top20 of Using tcpdump to view access to the given ports (default 80 and 443)
# top20 of Using tcpdump port 80 access to view
function http20() {
local -a ports=($@)
(( $# )) || ports=(80 443)
sudo tcpdump -i eth0 -tnn -c 1000 "dst port ${(j: or :)ports}" | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
}
# top20 of Find time_wait connection
function timewait20() {
if (( $+commands[ss] )); then
LANG= ss -nat
else
LANG= netstat -nat
fi | awk '/TIME[-_]WAIT/ {print $5}' | sort | uniq -c | sort -rn | head -n 20
{
LANG= ss -nat | awk 'NR > 1 && /TIME-WAIT/ {print $5}' \
|| LANG= netstat -nat | awk 'NR > 2 && /TIME_WAIT/ {print $5}'
} | sort | uniq -c | sort -rn | head -n 20
}
# top20 of Find SYN connection
function syn20() {
if (( $+commands[ss] )); then
LANG= ss -an
else
LANG= netstat -an
fi | awk '/SYN/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
{
LANG= ss -an | awk '/SYN/ {print $5}' \
|| LANG= netstat -an | awk '/SYN/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
}
# Printing process according to the port number
function port_pro() {
if (( $+commands[ss] )); then
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/'
else
LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
fi
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/' \
|| LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
}
# top10 of gain access to the ip address