I get a lot of work done offline and I would like to share some tips which may prove useful under the ascendant far-right authoritarian regimes sweeping Europe and America. It's best to prepare now while you still can.
I mostly use node.js and the web browser, so many of my recommendations center around the npm ecosystem.
This post covers offline software tools, but it's worth your time to research offgrid solar, water filtration, and basic first aid procedures and materials. DIY systems can be cheap and effective.
Save this document to your hard disk or to a USB drive for safe keeping.
If you've been using npm, your computer has already saved many packages to a
cache in ~/.npm
. For example, on my system:
$ ls -1 ~/.npm|wc -l
3113
I have 3113 packages available on my disk. To use the cache and skip the network
wherever possible, you can run npm install
with the --cache-min Infinity
flag. I use an alias npmi
:
alias npmi='npm install --cache-min Infinity'
so that I can use an npmi
command whenever I want to download packages offline
from my cache, where possible. Copy this line into your ~/.bashrc
file or
similar.
Many packages contain a readme file that has usage information and API
documentation. You can poke around in node_modules
to find these files, or you
can use the readme
command:
$ npm install -g readme
Now to open the documentation for a package in $PAGER:
$ readme browserify
This command opens the browserify readme file in less
, my $PAGER
.
The readme
command will traverse both local node_modules
directories from
the current directory and will also pull up documentation for packages you've
installed globally. You can even read the core docs offline:
$ readme stream
You can download all of MDN: developer.mozilla.org.tar.gz
If the download times out because of flaky internet, you can use this one-linear to retry and resume at the proper spot until it finishes the download:
$ until wget -c https://developer.mozilla.org/media/developer.mozilla.org.tar.gz;\
do sleep 1; echo RETRY `date`; done
If you are on the same wifi as somebody else, you can easily copy data from one
computer to the other by typing airpaste
. This way you don't need to upload
files to a server all the way across the internet just to copy some bits to a
machine a few meters away.
Install airpaste with:
$ npm install -g airpaste
Pipe data into airpaste as stdin to send a file:
$ airpaste < somefile.jpg
On the other end, redirect stdout to a file to receive:
$ airpaste > somefile.jpg
These commands can be initiated by each side in any order.
sbot (secure scuttlebot) is a fully distributed log store and messaging system which can make very effective use of whatever limited internet is available to route messages among peers. You can write messages to your local log offline and sync up with other peers when you appear online later. sbot also knows how to replicate over your local wifi if another sbot user is around.
sbot is a low-level protocol. There are applications you can run that use the p2p sbot network:
These applications run offline and can sync whenever a network connection is available. You will need an invite to a pub server. Hop on irc.freenode.net/#scuttlebutt once you've got the software set up.
If the regime shuts off the internet to quell protests and your city is under curfew, there might not be much to do. Download textbooks, science fiction, movies, instructional materials, whatever you can! You can use the tool youtube-dl to help with this. youtube-dl can download files from a surprising number of sources, including but not limited to:
Check out the full list.
Make sure to keep your version of youtube-dl up to date because it's an arms race with the supported sites.
git is already an offline, p2p version control system. You can use
git-format-patch
and git am
to send and receive patches using whatever
method of data transfer you have available.
To create a patch with all commits since (and including) 7c1fdff:
$ git format-patch --stdout 7c1fdff^ > cool.patch
To create a patch with all patches between 7c1fdff and 3db4cf, inclusive:
$ git format-patch --stdout 7c1fdff^..3db4cf > cool.patch
Now save this patch file to a USB drive or send it over airpaste or packet radio
to another computer. The other computer will run git am
:
$ git am -3 < cool.patch
If all goes well, the other computer should have the new commits merged into its
tree. If there is a merge conflict, you'll have to fiddle with git am
--continue
or git am --abort
to bail.
By the way, you can read about any git command offline by typing git help
CMDNAME
for example git help am
.
First get sbot running if it's not running already and run sbot server
and
git ssb web
in a screen or similar:
$ npm install -g sbot git-ssb
$ screen -S sbot
$ sbot server
^a-c
$ git ssb web
^a-d
Type CTRL+a then c and CTRL+a then d where ^a-c
and ^a-d
are written above.
Read more about screen..
Now create a new git repo and make some commits or navigate to an existing git repo. Add ssb as a remote:
$ git ssb create ssb REPONAME
You should see a remote called ssb
:
$ git remote -v
ssb ssb://%UvOIvb2SKKUSBm3xFQgEimV2xUhrKKaQ6GIqYmBWJss=.sha256 (fetch)
ssb ssb://%UvOIvb2SKKUSBm3xFQgEimV2xUhrKKaQ6GIqYmBWJss=.sha256 (push)
You can push and pull from that remote:
$ git push ssb master
Open up the web interface by navigating to http://localhost:7718
and you
should see your new repo. You can browse activity, fork, send pull requests, and
report issues from the web interface or you can do all of this from the git
ssb
command-line:
$ git-ssb --help
Usage: git ssb [--version] [command] [--help]
Commands:
create Create a git repo on SSB
fork Fork a git repo on SSB
forks List forks of a repo
issues List issues for a repo
prs List pull requests for a repo
authors List contributors to a repo
log List history of updates to a repo
name Name a repo
pull-request Create a pull-request
web Serve a web server for repos
help Get help about a command
You can ask for an invite code to a pub on irc.freenode.net/#scuttlebutt and you
can run your own pub server too. Pass the invite code to the
sbot invite.accept
command.