8 cheatsheet snippets
emacs cursor movement shortcuts
M-g g <N>
orM-g M-g <N>
-- go to line( goto-line
)M-g c <N>
-- go to character( goto-char
)M-g <TAB> <N>
-- go to columnin the current line M-<
--beginning-of-buffer
M->
--end-of-buffer
C-a
or<home>
--move-beginning-of-line
C-e
or<end>
--move-end-of-line
C-f
or<right>
-- forward one char (forward-char
) or right one char (right-char
). (Noteright-char
moves backward when editing right-to-left text.)M-f
orM-<right>
orC-<right>
-- forward one word (forward-word
) or right one word (right-word
).C-b
or<left>
-- backward one char (backward-char
) or left one char (left-char
). (Noteleft-char
moves forward when editing right-to-left text.)M-b
orM-<left>
orC-<left>
-- back one word (backward-word
) or left one word (left-word
).C-n
or<down>
-- down one line (next-line
)C-v
or<PageDown>
-- down one page (scroll-up-command
)C-p
or<up>
-- up one line (previous-line
)M-v
or<PageUp>
-- up one page (scroll-down-command
)C-x C-n
-- set current column as "goal" column for up/down movementC-u C-x C-n
-- cancel current goal column
various emacs shortcuts
- In org-mode,
<s[tab]
inserts a BEGIN_SRC/END_SRC block. (Think "insert source".) - Bookmarks
C-x r b
- jump to bookmarkC-x r m
- create (make) bookmark
M-o M-s
/M-o M-S
- center line / center paragraphM-<Home>
,M-<Page Up>
, etc. - move in other window/frame (without losing focus on the current window/frame)cursor movement
C-a
/C-e
- beginning of line / end of lineM-a
/M-e
- beginning of sentence / end of sentenceC-b
/C-f
- backward one character / forward one characterC-p
/C-n
- previous line / next line
C-l
- recenter top/bottomC-j
- newline and indentC-c h
- hide lines matchingC-h e
- show echo area messages
Spell checking cheat-sheet for emacs.
M-$
-ispell-word
orispell-region
(depending on whether something is selected)[SPACE]
- Skip this word—continue to consider it incorrect, but don't change it here.r newword [RETURN]
- Replace the word, just this time, with new. (The replacement string will be rescanned for more spelling errors.)R new [RETURN]
- Replace the word with new, and do a query-replace so you can replace it elsewhere in the buffer if you wish. (The replacements will be rescanned for more spelling errors.)a
- Accept the incorrect word—treat it as correct, but only in this editing session.A
- Accept the incorrect word—treat it as correct, but only in this editing session and for this buffer.i
- Insert this word in your private dictionary file so that Aspell or Ispell or Hunspell will consider it correct from now on, even in future sessions.m
- Likei
, but you can also specify dictionary completion information.u
- Insert the lower-case version of this word in your private dictionary file.l word [RETURN]
- Look in the dictionary for words that match word. These words become the new list of “near-misses”; you can select one of them as the replacement by typing a digit. You can use*
in word as a wildcard.C-g X
- Quit interactive spell checking, leaving point at the word that was being checked. You can restart checking again afterward withC-u M-$
.x
- Quit interactive spell checking and move point back to where it was when you started spell checking.q
- Quit interactive spell checking and kill the spell-checker subprocess.?
- Help
Via the emacs FAQ.
Cheat Sheet for JavaScript Regular Expressions
flags
/pattern/g
- global/pattern/i
- case-insensitive/pattern/m
- multi-line
patterns
\s
- any whitespace character ([\f\n\r\t\v\u00A0\u2028\u2029]
)\S
- any non-whitespace character ([^\f\n\r\t\v\u00A0\u2028\u2029]
)[\s\S]
- commonly used for "anything including newlines (alternative[^]
)\S
- any non-whitespace character ([^\f\n\r\t\v\u00A0\u2028\u2029]
)\w
- any word character (alpha, numeric or underscore) ([a-zA-Z0-9_]
)\W
- any non-word character ([^a-zA-Z0-9_]
)\d
- any digit ([0-9]
)\D
- any non-digit ([^0-9]
)\cX
- control character X (e.g.\cM
matchescontrol-M
(^M
))\b
- word boundary (the position between a word char and whitespace)\B
- not a word boundary ([^\b]
).\xhh
- the character with hex codehh
\uhhhh
- the character with hex codehhhh
Cheat Sheet for Linux Run Levels
"Standard" Linux uses the following run levels:
- Run Level 0 is halt (shutdown).
- Run Level 1 is single-user mode.
- Run Level 2 is multi-user mode (without networking)
- Run Level 3 is multi-user mode (with networking). This is the normal "terminal" mode. (I.e., before the display manager is run).
- Run Level 4 is undefined.
- Run Level 5 is multi-usermode with a GUI display manager (X11).
- Run Level 6 is reboot.
In Debian and its derivatives run levels 2 thru 5 are the same: multi-user mode with networking, and with a display manager if available.
- Run Level 0 is halt (shutdown).
- Run Level 1 is single-user mode.
- Run Level 2-5 is multi-user mode with networking and a GUI display manager when available.
- Run Level 6 is reboot.
Debian also adds Run Level S, which is executed when the system first boots.
Also see Wikipedia's article on run levels.
A Cheat Sheet for SQLite
General
- Most of the SQLite "meta" commands begin with a dot. When in doubt, try
.help
- Use
Ctrl-d
or.exit
or.quit
to exit (andCtrl-c
to terminiate a long-running SQL query). - Enter
.show
to see current settings.
Meta-data
- Enter
.databases
to see a list of mounted databases. - Enter
.tables
to see a list of table names. - Enter
.index
to see a list of index names. - Enter
.schema TABLENAME
to see the create table statement for a given table.
Import and Export
- Enter
.output FILENAME
to pipe output to the specified file. (Use.output stdout
to return to the default behavior or printing results to the console.) - Enter
.mode [csv|column|html|insert|line|list|tabs|tcl]
to change the way in which query results are printed. - Enter
.separator DELIM
to change the delimiter used in (list
-mode) exports and imports. (Defaults to|
.) - Enter
.dump [TABLEPATTERN]
to create a collection of SQL statements for recreating the database (or just those tables with naames matching the optional TABLEPATTERN). - Enter
.read FILENAME
to execute the specified file as a SQL script.