News for hackers. Stuff that matters.
Re:Caffeine-like utility to keep you MacBook awake with its ... by nomel on Friday October 23, 2026 @10:00PM (#50217722)
Technically one line ;)

    sudo bash -c 'trap "pmset -a disablesleep 0" EXIT; s=; while :; do if lsof -nP -iTCP:22 -sTCP:ESTABLISHED >/dev/null 2>&1 || pgrep -xq ssh;
  then n=1; else n=0; fi; [ "$n" != "$s" ] && pmset -a disablesleep $n && s=$n; sleep 10; done'

There are no comments on this comment yet.