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-bufferM->--end-of-bufferC-aor<home>--move-beginning-of-lineC-eor<end>--move-end-of-lineC-for<right>-- forward one char (forward-char) or right one char (right-char). (Noteright-charmoves backward when editing right-to-left text.)M-forM-<right>orC-<right>-- forward one word (forward-word) or right one word (right-word).C-bor<left>-- backward one char (backward-char) or left one char (left-char). (Noteleft-charmoves forward when editing right-to-left text.)M-borM-<left>orC-<left>-- back one word (backward-word) or left one word (left-word).C-nor<down>-- down one line (next-line)C-vor<PageDown>-- down one page (scroll-up-command)C-por<up>-- up one line (previous-line)M-vor<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-wordorispell-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.\cMmatchescontrol-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-dor.exitor.quitto exit (andCtrl-cto terminiate a long-running SQL query). - Enter
.showto see current settings.
Meta-data
- Enter
.databasesto see a list of mounted databases. - Enter
.tablesto see a list of table names. - Enter
.indexto see a list of index names. - Enter
.schema TABLENAMEto see the create table statement for a given table.
Import and Export
- Enter
.output FILENAMEto pipe output to the specified file. (Use.output stdoutto 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 DELIMto 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 FILENAMEto execute the specified file as a SQL script.
