Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pages/bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ Exporting bash functions is better than alias, as it is accessible outside of th
User your_username
ForwardX11 yes
ForwardX11Trusted yes
DynamicForward 127.0.0.1:61080 # (I think) this allows other SSH sessions to use this one, so you don't have to log in again.
ControlPath ~/.ssh/.%r@%h:%p
ControlMaster auto
DynamicForward 127.0.0.1:61080 # This enables port forwarding through the SSL tunnel (more below)
ControlPath ~/.ssh/.%r@%h:%p # (with 'ControlMaster auto' set) specifies the localation of the control socket for ssh multiplexing (See below)
ControlMaster auto # This allows multiple SSH sessions to use same SSL tunnel so that you don't have to log in again (called ssh multiplexing)
ServerAliveInterval 100 # stop the connection from closing automatically.
```

Port forwading ('DynamicForward' option above) is very general and can be used for many different things, including a similar effect to ProxyJump (see below). Port forwarding can be used to forward traffice to a different host:port combination. More on ssh port forwarding: https://www.redhat.com/sysadmin/ssh-dynamic-port-forwarding

SSH Multiplexing ('ControlMaster','ControlPath',etc.) is focused scpeficially on allowing multiple ssh sessions to share the same "master" session. As long as the master session is active, new ssh sessions can simply connect automatically without having to log in again. This is very useful when combined with Proxy-jumping (below). It is a good security practice to close the master session when you won't be connecting again for a while (like at the end of the day). More on on ssh multiplexing: https://www.techrepublic.com/article/how-to-use-multiplexing-to-speed-up-the-ssh/

Proxy-jump to iterate login commands (a la Bryan)
```
Host flatiron
Expand Down Expand Up @@ -78,3 +82,4 @@ ls runs{0..9}.out # will try to ls 10 files from 0 to 9 (I think
# ZSH

Bash superset. ‘Oh my ZSH’ on github, package manager. Grep automatically at the shell.

54 changes: 51 additions & 3 deletions pages/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,64 @@ Good for:

Useful commands:

Rectangles.
Due to the complexitly of emacs, here, we assume some familiarity with the basics ( check out this [Emacs tutorial](https://www.gnu.org/software/emacs/tour/) ).

`ctrl-a/y` cut and paste.
a rule of thumb is that most 'commands' will involve `ctrl-<key>` (hold ctrl while typing <key>, then release both), and
then various macros and addons usually use `meta-<key>` and usually some more input, where the `meta` key is usually the left alt key.
`Esc` can be used as a stand in for meta, but should *not* be held down `Esc <key>` = `meta-<key>`.

`ctrl-space` is highlighting.
run `$ emacs -nw file_to_edit` to run emacs in the terminal (without '-nw', emacs will try to open it's own window)

`ctrl-x ctrl-s` saves the current buffer(file)

`ctrl-x ctrl-c` close emacs (will prompt you to save files, etc. in the 'minibuffer' at the bottom of the screen)

`ctrl-x u` undo changes

`ctrl-z` sends emacs to the background - resume with `$ %emacs` assuming emacs is the only 'job' running in the background

`ctrl-g` and `Esc Esc`, can be used to cancel partially entered commands.

`ctrl-space` is set marker

Set marker(`ctrl-space`), then `ctrl-w` will *cut* the selected text.

Set marker(`ctrl-space`), then `meta-w`(usually `left alt-w`) will *copy* the selected text.

`ctrl-y` will yank(paste) at the current cursor position

`ctrl-x ctrl-f` file_name will open 'file_name' in current active buffer

opening multiple buffers:

`ctrl-x 2` splits current buffer in to two buffers with a horizontal split

`ctrl-x 3` splits current buffer in to two buffers with a vertical split

`ctrl-x o` cycle between the 'split' buffers

`ctrl-x 1` closes all 'split' buffers except the active one

`meta-x shell` opens a shell (sometimes in new 'split' buffer, sometimes in current buffer depending on the configuration)

Working with "Rectangles" which are a rectangular segment (in terms of rows and columns) of a file.
To define a rectangle, place a marker in one of the corners:
- navigate to any corner of the rectangle (you can use the arrow keys to navigate)
- type `ctrl-space' to set a marker at that corner
- navigate to the opposite (diagonally) corner
- use any of the following 'rectangle' commands
- kill rectangle `C-x r k`
- yank rectangle `C-x r y`
- open rectangle, shifting text right C-x r o
- blank out rectangle C-x r c
- prefix each line with a string C-x r t

Can split between a shell and a editing screen.

Will auto-save things.

GNU.org's [cheat sheet](https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf)

## Sublime Text (text editor)

Pros:
Expand Down