Skip to content

Instantly share code, notes, and snippets.

@Fatpandac
Created January 20, 2024 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fatpandac/cecec277672ee3b042afeb845fe87487 to your computer and use it in GitHub Desktop.
Save Fatpandac/cecec277672ee3b042afeb845fe87487 to your computer and use it in GitHub Desktop.
List all the local nodes and Python servers.
lss() {
select=$(lsof -Pn | grep LISTEN | awk '{cmd = "ps -o command= -p"$2; printf "%s ||| %s ||| ",$1,$9; system(cmd)}' | grep -iE '^node|^python' | fzf)
if [ -z != $select ];then
port=$(echo $select | awk '{print $3}' | cut -d':' -f2)
localIP=$(ipconfig getifaddr en0)
open http://$localIP:$port
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment