Ah the old hosts file blocklist trick. I tried that 20 years ago, but my dopamine craving brain wasn't fooled. Paul Graham tried owning two computers, one without internet <a href="https://paulgraham.com/distraction.html" rel="nofollow">https://paulgraham.com/distraction.html</a> . That too didn't work for him. My current strategy is to only use an RSS reader in my browser. HN posts with x upvotes, a few twitter accounts, a few facebook accounts, a few youtube channels, and a few substacks are all I see. No ads, no infinite feed. Every hour or so I can go to the feed trough and consume a few posts. Feels healthier. The distractions are there but the faucet is limited to a drip.
For those that would try to talk themselves out of it and ^C the process, it could be useful to make things a <i>little bit</i> harder by putting the process in the background :)<p>There are multiple ways to achieve this:<p><pre><code> nohup focus.sh &
</code></pre>
nohup stands for "no hang up". It will run a command/script in such a way that it ignores the SIGHUP signal. The SIGHUP signal is typically sent to a process when the terminal is closed or the session is terminated [0].<p>Another way could be to put the process in the background and then use `disown`, which removes the job from the shell's job table [1], effectively disassociating it from the shell session. This prevents the job from receiving SIGHUP signals just as before.<p><pre><code> ./focus.sh &
disown
</code></pre>
Finally<p><pre><code> setsid focus.sh
</code></pre>
This will launch the script in a new session [2], so that when you close your terminal it won't receive your current session's SIGHUP signal.<p>A very good StackOverflow explanation [3].<p>EDIT: actually, ^C the process already is a bit of a PITA since you would then need to manually put back the original /etc/hosts file :D<p>- [0]: <a href="https://www.man7.org/linux/man-pages/man1/nohup.1.html" rel="nofollow">https://www.man7.org/linux/man-pages/man1/nohup.1.html</a><p>- [1]: <a href="https://linuxcommand.org/lc3_man_pages/disownh.html" rel="nofollow">https://linuxcommand.org/lc3_man_pages/disownh.html</a><p>- [2]: <a href="https://www.man7.org/linux/man-pages/man2/setsid.2.html" rel="nofollow">https://www.man7.org/linux/man-pages/man2/setsid.2.html</a><p>- [3]: <a href="https://unix.stackexchange.com/a/148698" rel="nofollow">https://unix.stackexchange.com/a/148698</a>
One thing I'd add to this is to schedule it in the future. Sometimes, you can't bring yourself to block all websites right now, but you can happily make it a problem for your future self. I've written a similar script to do this and had success with it.<p>Something like:<p>checking 60m --start-in 30m
You don’t need export here:<p>export DURATION="${1:-1m}"<p>it should be just<p>DURATION="${1:-1m}"<p>“export” is a keyword that makes a variable available to subprocesses.
Mildly related, is there a stable version of `notify-send` for mac? I use this for the moment but it seems janky.<p>```<p>function growl() {
echo $"\e]9;\"$1\"\007"
}<p>```
sudo hyperfocus-like-I'm-a-sophomore-again
Sorry but 10 years of effort and no software trick helped me stop procrastinating, except pulling the cables off the router or going to a library.