Skip to content

Instantly share code, notes, and snippets.

View kschiffer's full-sized avatar

Kevin Schiffer kschiffer

View GitHub Profile
@kschiffer
kschiffer / killport.sh
Created April 25, 2023 14:16
killport is a bash function to easily kill applications that are blocking a port
function killport() {
PROCESS_COUNT="$(sudo lsof -i:$1 | wc -l)"
if [ "$PROCESS_COUNT" != " 0" ]
then
echo "${PROCESS_COUNT} process(es) blocking port:"
lsof -i:$1 | grep -E '\w+ \s+ (\d+)' -o
echo "\nKilling the first one…"
PID="$(sudo lsof -i:$1 | grep -E '[0-9]+' -o | head -1)"
echo $PID
if [ "$PID" != "" ]

Keybase proof

I hereby claim:

  • I am kschiffer on github.
  • I am kschiffer (https://keybase.io/kschiffer) on keybase.
  • I have a public key ASAwXW70ObWN4HLYxW5m4Jv33T0Knmq4EYm1RsBLKxwG0Ao

To claim this, I am signing this object:

for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
get(x,y);
set(x,y,color(255,0,0);
}
}