Skip to content

Instantly share code, notes, and snippets.

View srt32's full-sized avatar
πŸ˜ƒ
wahoo

Simon Taranto srt32

πŸ˜ƒ
wahoo
  • GitHub
  • WORLD
  • 22:18 (UTC -04:00)
View GitHub Profile
@srt32
srt32 / kill.bash
Created March 5, 2019 20:36
kill processes running on a port
lsof -i :4327 | awk '{ print $2 }' | tail -n+2 | xargs kill -9
@srt32
srt32 / phew.md
Created March 14, 2019 19:38
Figure out which methods a Ruby object has

One of my favorite Ruby tricks:

> "foo".methods.sort - Object.methods
@srt32
srt32 / killportprocs.bash
Created April 29, 2019 16:58
`killportprocs 3000` - will print and then kill all the pids bound to port 3000
killportprocs() {
local targetport=${1:?pass in target port}
local pids=$(lsof -i :$targetport | awk '{print $2}' | tail +2)
echo "$pids"
echo $pids | xargs kill -9
}