`killport() { kill -9 $(lsof -t -i :$1 -sTCP:LISTEN) }`
i use it like killport 8000
This.
Why in the hell would anyone want to kill random processes that open a port in the tange 2000-6000? And why is this need so pressing as to require a full blown monitor integrated in a task bar?
Without context, this sounds like a complete random silly project that makes no sense and serves no purpose at all.
Also, this is a perplexing choice (which also serves to illustrate the above point regarding verboseness):
White background with red center: 1-9 processes (some development servers)
White background with orange center: 10+ processes (many development servers)
The part I'm interested in is the tray_icon crate but I'll look at the package directly https://docs.rs/tray-icon/latest/tray_icon/.
# SwiftBar Port Monitor # Monitors processes on TCP ports 2000-6000
# Menu bar title echo " Ports" echo "---"
# Get processes listening on TCP ports 2000-6000 processes=$(lsof -iTCP:2000-6000 -sTCP:LISTEN -n -P 2>/dev/null | awk 'NR>1 {print $2 "|" $1 "|" $9}' | sort -t'|' -k3 -n)
if [ -z "$processes" ]; then echo "No processes found on ports 2000-6000" exit 0 fi
# Process each line while IFS='|' read -r pid name port_info; do if [ -n "$pid" ] && [ -n "$name" ] && [ -n "$port_info" ]; then # Extract port number from format like :3000 port=$(echo "$port_info" | sed 's/.://')
# Menu item with port and process name
echo "[$port] $name | color=blue"
# Submenu items
echo "--Kill (TERM) | shell=kill param1=$pid terminal=false refresh=true"
echo "--Kill Force (KILL) | shell=kill param1=-9 param2=$pid terminal=false refresh=true"
echo "--Process Info | shell=ps param1=-p param2=$pid param3=-o param4=pid,ppid,user,command terminal=true"
echo "-----"
fi
done <<< "$processes"# Refresh option echo "---" echo "Refresh | refresh=true
For example, `tray-icon` looks pretty useful for a lightweight app which basically is a tray icon: rewriting that library from scratch would be a massive waste of time.
On the other end of the spectrum, `log` and `serde` provide basic functionality which most languages will have in their standard library. Rust intentionally keeps a small standard library to avoid ossifying potentially bad ideas. The crates have tens of millions of users, rewriting that yourself would be stupidity.
It's very easy to criticize the length of their dependency list, but could you point to a specific one which you deem unnecessary? Which one do you consider to be a "leftPad", and what trivial code fragment would you replace it with?
How is this acceptable?
In the case of a pull request, I am not about to trust some LLM that has no business context and can only pretend to guess at the “why” of a change.
To understand the “what” of a change, you have to actually read the code. This doesn’t belong in the pull request description most of the time.
A uI tray icon is usually a few os calls away. I does not require 200 deps.
As someone who has had to deal with drive-by PRs on open-source projects, which were a problem before but have now gotten much worse in volume as they are mostly AI-generated, yes.