all 42 comments

[–]fizz23 8 points9 points  (3 children)

sleep is overrated.

[–]fizzfur 3 points4 points  (0 children)


I just wanted to make it look like you logged into another account to agree with yourself

[–]hobbified 2 points3 points  (0 children)

We would like to remind our viewers that sleep is, in fact, overrated.

-- ESPN announcer during the 2003 Stanley Cup playoffs, most likely the first game of the Stars-Ducks series, which went into a fifth overtime and ended at 12:30 am, after starting at 6:40 pm.

[–]javadi82 0 points1 point  (0 children)

You might want to read this

[–]diuge 7 points8 points  (0 children)

Every time I try something like this, I just end up going into /etc/hosts.

So then I added about 1000 lines that went something like...


With random redirect lines scattered throughout.

It worked well, until I realized I could just delete /etc/hosts and it wouldn't cause any problems. Then I would just do mv /etc/hosts /etc/weekday-hosts, or whatever other bullshit excuse I made up.

tl;dr My dreams are dead.

[–]kafro 12 points13 points  (6 children)

You lack discipline!

[–][deleted] 7 points8 points  (3 children)

I agree with you, but they also have the discipline to write a bunch of code to help them with their problem.

The problem with this solution is that the OP can still circumvent it (I just need to finish my comment submission!). What they need to do is to implement this block and then throw away the key.

[–]toolate 1 point2 points  (2 children)

You can always delete your reddit account.

[–]hotoatmeal 1 point2 points  (1 child)

but then the problem is that you can still read reddit without an account.

[–]toolate 0 points1 point  (0 children)

I've found it's a lot less addicting when you don't have one though (especially since without an account the annoying reddits like WTF, pics, IamA, etc. saturate the homepage).

[–]kopchickm 2 points3 points  (0 children)

I'm a cop, you idiot!

[–]Shitler[S] 0 points1 point  (0 children)

Discipline is but a medium to develop routine!

[–]harlows_monkeys 3 points4 points  (2 children)

When programmatically adding or removing lines from a file like /etc/hosts, that humans also muck with, I think a safer approach is to put a tag on each line that a human is unlikely to put on a human made line. E.g., reddit.com #88C59D03-F4A1-4CD8-9177-22CFEFFE080C

Then, when removing the line, just remove all lines that have that have 88C59D03-F4A1-4CD8-9177-22CFEFFE080C in them.

This also simplifies the remove code, as it no longer needs to look for the functional part of the line to find the right line to delete. That makes it more robust, too, in case you change the functional part of the line--you don't have to remember to make the corresponding change to the delete code.

[–]Shitler[S] 2 points3 points  (0 children)

Great points here. For similar reasons, handles should never be primary keys in database tables; IDs should.

[–]lol-dongs 0 points1 point  (0 children)

What if a human sees the tag, goes "wtf is this useless comment", and deletes it?

I think code that modifies config files needs to be fully aware of how the config file works, and modify it exactly as a human doing the same task would.

[–][deleted] 4 points5 points  (2 children)

I use the Leechblock add-on for Firefox, but this is quite useful too.

[–]Shitler[S] 4 points5 points  (0 children)

That is superb! I think I shall start using that instead. Oh well; my cron file might still be useful for other browsers and for network administration.

[–]zem 0 points1 point  (0 children)

midori http://www.reddit.com

[–]knight666 14 points15 points  (6 children)

I have a great solution.

It's called "go to bed at 10:30, get up at 6:30".

[–]the_argus 29 points30 points  (3 children)

That sounds awful.

[–]earthboundkid 16 points17 points  (0 children)

The cure is worse than the disease.

[–][deleted] 4 points5 points  (1 child)

Yeah, I usually settle for go to bed at midnight, get up ad six.

[–][deleted] 0 points1 point  (0 children)

^ this.

[–]fizz23 3 points4 points  (1 child)

A better solution would be "drink/snort tons of caffeine and reddit all night long".

[–]AdShea 3 points4 points  (2 children)

Reddit doesn't destroy my sleep schedule. I have Gentoo for that.

[–]taloft 2 points3 points  (1 child)

Hey, how's the compile going?

[–]imd 2 points3 points  (0 children)

While I don't care (much) about compiling programs "100% optimized for my system", I am awfully jealous of Gentoo's doc flag. For many packages, Ubuntu doesn't include documentation, and when it does, it's often in a separate package that's not pulled in automatically.

[–]5h4d0w 2 points3 points  (1 child)

Why the 0-45/15? Use */15

[–]Shitler[S] 1 point2 points  (0 children)

Good call! Didn't know that one.

[–]cdsboy 7 points8 points  (0 children)

Self control would make this obsolete, but whatever.

[–]vineetk 2 points3 points  (3 children)

&>- means "don't print any output", but it's probably redundant because we're dealing with a background process.

It's not useless in this case: by default any output from a cron job will be mailed to sent to the user by email.

A better way of going about it in this particular case is probably:

grep -q ' reddit.com' /etc/hosts

I also think you'd be better off preserving the contents of your real /etc/hosts separately and having your script juggle a symlink rather than actually editing your file. I.e., something like

mv /etc/hosts{,.real}
ln -s /etc/hosts.real /etc/hosts

Then create a script that looks something like this: #!/bin/sh cp /etc/hosts.real /etc/hosts.redditblocker cat <<EOF >>/etc/hosts.redditblocker # This file was generated by $0; any manual changes will be lost! # Edits should go in /etc/hosts.real instead. # block access to reddit.com reddit.com EOF ln -nsf /etc/hosts.redditblocker /etc/hosts

and have your cron job just run that script at night, and ln -nsf /etc/hosts.real /etc/hosts in the morning (and maybe also @reboot, or even just every 15 minutes all day except when you want reddit to be blocked -- overwriting a single symlink isn't exactly expensive after all).

[–]Shitler[S] 0 points1 point  (2 children)

I love proggit. So much programming insight. I didn't know about grep -q, thanks! While the symlink idea is definitely more efficient, it poses some difficulties if I frequently modify my hosts file; I will now have to make changes to both of them. However, by creating scripts for modifying my hosts file instead of modifying it directly, or with a bit of diffing and patching, this process can be fairly automatic.

[–]vineetk 0 points1 point  (1 child)

Actually my suggestion was to have the script copy /etc/hosts.real to /etc/hosts.redditblocker and then append (notice the >>) the extra stuff. So as long as you make all your edits to /etc/hosts.real (which means that during the day, you can just edit /etc/hosts), you'll be fine; you don't have to maintain 2 separate copies.

[–]Shitler[S] 0 points1 point  (0 children)

Didn't catch that; my bad. I like that idea.

[–]Tweekly 1 point2 points  (0 children)

Plenty of time to sleep when you are dead.

[–]youcanteatbullets 0 points1 point  (0 children)

That's cool. Ever heard of leechblock?

[–]scorpion032 0 points1 point  (1 child)

Now I hate the fact that iPhone is a closed device.

I so can't use it on my damn iPhone.

[–]Shitler[S] 0 points1 point  (0 children)

We are going to have similar issues with the iPad. Unfortunately, there is no benefit for Apple (or most users, really) in opening things up on these devices.

[–]NepaliDude 0 points1 point  (0 children)

Okkkkkkkk I have a better idea. Modify your cron job that displays a 60 second timer that will threaten to and actually will rm -rf / unless it does not find any instances of your browser's processes running.

[–]zyle 0 points1 point  (1 child)

No, reddit destroys my sleep schedule. Got a script for that?

[–]hotoatmeal -1 points0 points  (0 children)

sleep is destroying my reddit schedule

[–]stacks85 -1 points0 points  (0 children)

sometimes when all you have is a hammer...