Inspired by The MIT CSAIL course by the same name.
-
CLI intutition
--version
(-V
)--verbose
(-v
)- Command-line flag conventions
- Dashes
- short vs long flags
- Usually use long in scripts, save me a trip to the man page
- Args vs options
- double-dash
- man vs --help
- man page vs function page
- Read the error message in full.
git status
- Symlinks
- --follow-symlinks
-
Git intuition
- Git != GitHub
- https://missing.csail.mit.edu/2020/version-control/
-
Env vars
.profile
and rc scripts- PATH, PYTHONPATH/GOPATH/etc.
- Shell vars are not the same!
source
ing stuff.- Installers will often ask you, or restart shell
- Meaning and usage of:
a=b cmd
-
Writing portable scripts
- Hashbang (
chmod +x
) - Use conventions!
- Short/long flags
- --help, --verbose
- Your program should be quiet
- Line breaks!
- I'm weird and end lines in
true
- I'm weird and end lines in
- Warnings
- stdout/stderr
- Exit status
- Say how to fix it
- The limits of arguments
- [Yy]* or [Nn]* in a loop
- Shell scripts
- Bash, POSIX sh, vs other sh for hashbang
set -o errexit -o pipefail -o noclobber -o nounset
cd "$(dirname "${0}")"
- How to quote variables that could have spaces or dollars
- Curlies and quotes "foo-${bar}-baz"
- Nested quotes
- Literals should be $'isn't this cool?'
- IFS splitting
find -print0
if COMMAND
justs tests the exit code!!- test and [ are just binaries whose exit code doesn't indicate error!
- test -n, -z, -f
&&
and||
operators vs-a
and-o
operators.
- Defensive coding
- Does file exist? If not, make it or give informative error
- Does tool exist? if not, give informative error (give install command)
- State management instead of imperative commands
- How to parse flags
- https://stackoverflow.com/a/33826763/1078199
- Easy-ish
- https://stackoverflow.com/a/29754866/1078199
- Fancier. At this point, consider a real language.
- https://stackoverflow.com/a/33826763/1078199
- When to use a real language
- Compatability problems
- Arcane syntax
- Python script
click
- To package or not to package (more than one machine, more than one use-case)
- How to deal with deps
- How to parse flags
- Python API
main
vs othermain
- Hashbang (
-
Using the shell
- https://missing.csail.mit.edu/2020/course-shell/
- https://missing.csail.mit.edu/2020/shell-tools/
- Whitespace
- Diff between shell and exec (when to use sh -c)
- Why
sudo echo blah > file
doesn't work.echo blah | sudo tee file
does
- Ctrl+R
sudo !!
or Ctrl+R Ctrl+Asudo
- When to quote, always '' or $''
- Ctrl+D
- Ctrl+C/Ctrl+\
- Using
less
- Keys: j, k, PageUp, PageDown, g, G, /
- Using
tmux
-
Unix maintenance
- alias, PATH, symlink-binaries, which, startup-scripts
- Package management dumpster fire
- Installing packages without root
- brew/apt/yum/etc.
- Language-level package manager
- pip might not know about packages installed with apt
- Binaries tho?
- pip has more packages than apt
- Nix
- Installing from source
-
Tools
- find/fd
- grep/rg
- sed
- jq/yq
- xargs
- pandoc
- ffmpeg
- https://missing.csail.mit.edu/2020/data-wrangling/
- gnu make
-
Markdown
- Usage: doc-strings, README.md, Messenger (!)
- Elements: lists, quotes, links, headings, bold, code blocks, code inline, LaTeX sometimes
- Pandoc
-
Zsh customization
-
Interacting with the community
- How to contribute to an open source project
- Look for
Contributing
- File or find an issue
- say you are working on a PR
- Fork a repo (GitHub)
- (do the fix)
- Run tests
- Submit a PR (GitHub)
- Why try?
- Look for
- How to ask for help
- Prior research
- Short, Self Contained, Correct (Compilable), Example
- Shorten all var-names, strings, and lists
- http://sscce.org/
- Live online code compiling (jsfiddle, sqlfiddle, TS playground, Rust playground, etc.)
- Docker, if the problem is system dependent
- 80% of the time, this action actually helps you solve your own problem.
- More details at the end
- Check back frequently
- GitHub specific:
- File an issue
- StackOverflow specific:
- Know what questions are "off topic".
- Overly broad questions of preference "which JS framework is best?" are usually considered off-topic.
- Use tags, use comments, revise your original question to add info and stratigically bump.
- Know what questions are "off topic".
- IRC etiquette
- How to contribute to an open source project