diff --git a/chapters/append/cheatsheets.qmd b/chapters/append/cheatsheets.qmd index 6c8c9c56..34b5c1c9 100644 --- a/chapters/append/cheatsheets.qmd +++ b/chapters/append/cheatsheets.qmd @@ -1,610 +1,593 @@ # Cheatsheets {#sec-append-cheat} -## Environments as Code +## Environments as code ### Checking library + repository status -| Step | R Command | Python Command | -|----------------------------------------------|------------------|----------------| -| Check whether library in sync with lockfile. | `renv::status()` | None | +| Step | R Command | Python Command | +|------------------------------------|------------------|------------------| +| Check whether library is in sync with lockfile. | `re nv::status()` | None | -### Creating and Using a Standalone Project Library +### Creating and using a standalone project library Make sure you're in a standalone project library. -+-------------------------+-------------------+-----------------------+ -| **Step** | R Command | Python Command | -+-------------------------+-------------------+-----------------------+ -| Create a standalone | `renv::init()` | ` | -| library. | | python -m venv
Step |
+R Command |
+Python Command |
+
Create a standalone library. |
+
Tip: get |
+
Convention: use Tip: |
+
Activate project library. |
+
Happens automatically if in RStudio project. |
+
|
+
Install packages as normal. |
+
|
+
|
+
Snapshot package state. |
+
|
+
|
+
Exit project environment. |
+Leave R project or |
+
|
+
Step |
+R Command |
+Python Command |
+
Move into project directory. |
+
Or open project in RStudio. |
+
|
+
Create project environment. |
+
|
+
Recommend: use |
+
Enter project environment. |
+Happens automatically or |
+
|
+
Restore packages. |
+Happens automatically or |
+
|
+
Stage |
+Command |
+What it does |
+Notes and helpful options |
+
Build |
+
|
+Builds a directory into an image. |
+
|
+
Move |
+
|
+Push a container to a registry. |
++ |
Move |
+
|
+Pull a container from a registry. |
+Rarely needed because |
+
Run |
+
|
+Run a container. |
+See flags in next table. |
+
Run |
+
|
+Stop a running container. |
+
|
+
Run |
+
|
+List running containers. |
+Useful to get container |
+
Run |
+
|
+Run a command inside a running container. |
+Basically always used to open a shell with
+ |
+
Run |
+
|
+Views logs for a container. |
++ |
Command |
+What it does/is |
+Notes + Helpful options |
+
---|---|---|
|
+System root or file path separator. |
++ |
|
+Current working directory. |
++ |
|
+Parent of working directory. |
++ |
|
+Home directory of the current user. |
++ |
|
+List objects in a directory. |
+
|
+
|
+Print working directory. |
++ |
|
+Change directory. |
+Can use relative or absolute paths. |
+
Command |
+What it does |
+Notes + Helpful options |
+
|
+Print a file from the top. |
++ |
|
+Print a file, but just a little. |
+Can be very helpful to look at a few rows of csv. +Lazily reads lines, so can be much faster than
+ |
+
|
+Look at the beginning of a file. |
+Defaults to 10 lines, can specify a different number with
+ |
+
|
+Look at the end of a file. |
+Useful for logs where the newest part is last. +The |
+
|
+Search a file using regex. |
+Writing regex can be a pain. I suggest testing on . +Often useful in combination with the pipe. |
+
|
+The pipe. |
++ |
|
+Count words in a file. |
+Use |
+
Command |
+What it does |
+Notes + Helpful Options |
+
|
+Remove. |
+
Be very careful, its permanent! |
+
|
+Copy. |
++ |
|
+Move. |
++ |
|
+Wildcard. |
++ |
|
+Make/remove directory. |
+
|
+
Command |
+What it does |
+Notes + Helpful Options |
+
|
+Create/extract archive file. |
+Almost always used with flags. +Create is usually
+ Extract is usually
+ |
+
|
+Secure copy via |
+Run on laptop to server. +Can use most |
+
Command |
+What it does |
+Helpful options |
+
---|---|---|
|
+Check storage space on device. |
+
|
+
|
+Check size of files. |
+Most likely to be used as
+ Also useful to combine with |
+
Command |
+What it does |
+Helpful Options |
+
|
+See ports and services using them. |
+Usually used with |
+
|
+Port forwards a remote port on remote host to local. |
+Remote Choose local port to match remote port. |
+
Address |
+Meaning |
+
---|---|
+ | or loopback – the machine that originated the request. |
+
+ + | +Protected address blocks used for private IP addresses. |
+