Brennen Bearnes e0a890d255 | 6 years ago | |
---|---|---|
diff | 9 years ago | |
endmatter | 6 years ago | |
general_purpose | 10 years ago | |
get_shell | 6 years ago | |
images | 7 years ago | |
introduction | 9 years ago | |
js | 10 years ago | |
literary_environment | 9 years ago | |
literary_problem | 9 years ago | |
miscellany | 9 years ago | |
programmerthink | 10 years ago | |
script | 10 years ago | |
shared_space | 9 years ago | |
slides | 10 years ago | |
timebinding_animals | 10 years ago | |
web | 10 years ago | |
.gitignore | 7 years ago | |
Makefile | 6 years ago | |
README.md | 6 years ago | |
aidan.html | 7 years ago | |
chapters | 10 years ago | |
footer.html | 10 years ago | |
header.html | 10 years ago | |
index.html | 6 years ago | |
links.md | 6 years ago | |
render.pl | 6 years ago | |
userland.css | 9 years ago | |
wordcount.sh | 10 years ago |
This is the source for some text which can be found here:
...which is probably the best place to read it.
From the introduction:
Late last year, a side trip into text utilities got me thinking about how much my writing habits depend on the Linux command line. This struck me as a good hook for talking about the tools I use every day with an audience of mixed technical background.
So now I'm writing a (short, haphazard) book. This isn't a book about system administration, or writing big software systems, or becoming a wizard. I am not a wizard, and I don't subscribe to the idea that wizardry is a requirement for using these tools. In fact I barely know what I'm doing most of the time, but I still get some stuff done.
My hope herein is to convey something useful to people who use computers every day, but for whom the command line environment seems mystifying, obscure, or generally uninviting. I intend to gloss over many complexities in favor of demonstrating a rough-and-ready toolset.
code.p1k3.com/gitea/brennen/userland-book is the canonical git repo, for the moment. There's also a GitHub mirror.
This is mostly just some Markdown files and a handful of scripts. Chapters are
listed in a file called chapters
; each chapter is a directory containing an
index.md
and any supplemental files. These are pushed through render.pl
and concatenated with header.html
& footer.html
. For convenience, this is
handled by a basic Makefile
:
$ make
cat chapters | xargs ./render.pl | cat header.html - footer.html > index.html
render.pl
wraps up a library called Text::Markdown::Discount
, which in turn
wraps up the Discount Markdown parser. Aside from this, it also generates a
table of contents and expands code of the form
<!-- exec -->
$ [some command]
<!-- end -->
to include the output of the command executed in the directory containing the rendered file, which is how most of the example commands in the text are rendered. In keeping with long tradition, this is done with cheeseball regex substitution. Be aware that, by running make, you are implicitly trusting most of the commands found in the text to run on your system. This is no weirder than the level of trust extended to most any build process, but I don't want it to catch anyone by surprise.
There's also a links.md
, which should contain all links to external
resources.
To build the whole thing without errors, you'd need to be on a system with a
couple of external repos, Bash and the GNU coreutils, and miscellaneous
utilities (notably cowsay
, dict
, figlet
, aspell
, curl
, lynx
, and
w3m
). A recent Debian or some derivative would probably work best. One of
these days I'll wrap up all the dependencies in a package.
Brennen Bearnes (p1k3.com)