npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blockr

v1.0.7

Published

> Block distracting sites from the command line

Downloads

29

Readme

Blockr

Block distracting sites from the command line

Features

I built this as a replacement for SelfControl. It has the following features:

  • Cross platform (MacOS and Linux).
  • Configurable with a human-readable and editable JSON file instead of plists.
  • Easily unblock a single site (sometimes a site like Reddit, Twitter or Medium does have a useful article you want to read at work, but you don't want to unblock everything).
  • Command line interface instead of GUI.
  • Runs indefinitely until you turn it off, rather than having to re-run it every 24 hours.
  • Offers an easier way to authenticate as root, which is needed for editing the hosts file.

Install

yarn global add blockr

Usage

Start by creating the file ~/blockr.json. You can use the file in this repo as a starting point. It should contain a single hosts key containing the URLs of sites you would like to block. This file can use JSON5 syntax, including comments and trailing commas.

Activate

Run blockr to block all of the sites in your config file.

Deactivate

Run blockr unblock to remove the block. Run blockr unblock [sitename] to unblock a particular site.

Authenticating

Blockr works by editing the hosts file at /etc/hosts. This requires root access. You can acheive this by running sudo blockr, however this will require you to type your password every time you use it.

You can also provide your sudo password via a flag, like blockr --password hunter2. If you're worried about security, use a command line password manager like 1Password to echo the password. Using a literal is not recommended as your password will then be saved your shell history.

Syncing config file

You can easily sync your config file in two ways: via a symlink, or a flag. First create your blockr.json somewhere else like ~/code/dotfiles/blockr.json. Then you can point to it

Via a symlink: run ln -s $HOME/code/dotfiles/blockr.json $HOME/blockr.json

Via a flag: use blockr --config-file $HOME/code/dotfiles/blockr.json. You could also put this in an alias so you don't have to type it every time.

Planned features

  • Temporarily unblocking a site for 10 minutes or something.
  • Require a one minute delay and a re-confirmation before unblocking.
  • Configure schedules when the block should be applied.
  • Show stats on how many times you've unblocked each site.
  • Run a background process to put back the block if the user tries to delete it by editing /etc/hosts directly, like SelfControl does.
  • Strict mode that prevents you from running blockr unblock for a certain period of time.
  • Groups of sites to block eg "social" or "news"
  • Support multiple URLs for one site, eg. bbc.co.uk and bbc.com

License

MIT