diff --git a/cheatsheets/emacs b/cheatsheets/emacs new file mode 100644 index 0000000..57b76e9 --- /dev/null +++ b/cheatsheets/emacs @@ -0,0 +1,70 @@ +# Basic usage + + Indent Select text then press TAB + Cut CTRL-w + Copy ALT-w + Paste CTRL-y + Search/Find CTRL-s + Replace ALT-% (ALT-SHIFT-5) + Save CTRL-x CTRL-s + Load/Open CTRL-x CTRL-f + Undo CTRL-x u + Highlight all text CTRL-x h + Directory listing CTRL-x d + Cancel a command ESC ESC ESC + Font size bigger CTRL-x CTRL-+ + Font size smaller CTRL-x CTRL-- + +# Buffers + + Split screen vertically CTRL-x 2 + Split screen vertically with 5 row height CTRL-u 5 CTRL-x 2 + Split screen horizontally CTRL-x 3 + Split screen horizontally with 24 column width CTRL-u 24 CTRL-x 3 + Revert to single screen CTRL-x 1 + Hide the current screen CTRL-x 0 + Kill the current screen CTRL-x k + Move to the next buffer CTRL-x O + Select a buffer CTRL-x b + Run command in the scratch buffer CTRL-x CTRL-e + +# Other stuff + + Open a shell ALT-x eshell + Goto a line number ALT-x goto-line + Word wrap ALT-x toggle-word-wrap + Spell checking ALT-x flyspell-mode + Line numbers ALT-x linum-mode + Toggle line wrap ALT-x visual-line-mode + Compile some code ALT-x compile + List packages ALT-x package-list-packages + +# Sudoing within eshell + + By default when using the sudo command within eshell you'll just + get "permission denied" messages. To overcome that type: + + alias sudo '*sudo $*' + +# Line numbers + + To add line numbers and enable moving to a line with CTRL-l: + + (global-set-key "\C-l" 'goto-line) + (add-hook 'find-file-hook (lambda () (linum-mode 1))) + +# Org-mode + + To begin org-mode ALT-x org-mode + Table column separator Vertical/pipe character + Reorganize table TAB + Section heading * + Open/collapse section TAB + Open/collapse All CTRL-TAB + Export in other file formats (eg HTML,PDF) CTRL-c CTRL-e + + To make org-mode automatically wrap lines: + + (add-hook 'org-mode-hook + '(lambda () + (visual-line-mode 1))) diff --git a/cheatsheets/gpg b/cheatsheets/gpg new file mode 100644 index 0000000..53acf3c --- /dev/null +++ b/cheatsheets/gpg @@ -0,0 +1,173 @@ +# Create a key + + gpg --gen-key + + +# Show keys + + To list a summary of all keys + + gpg --list-keys + + To show your public key + + gpg --armor --export + + To show the fingerprint for a key + + gpg --fingerprint KEY_ID + +# Search for keys + + gpg --search-keys 'user@emailaddress.com' + + +# To Encrypt a File + + gpg --encrypt --recipient 'user@emailaddress.com' example.txt + + +# To Decrypt a File + + gpg --output example.txt --decrypt example.txt.gpg + + +# Export keys + + gpg --output ~/public_key.txt --armor --export KEY_ID + gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID + + Where KEY_ID is the 8 character GPG key ID. + + Store these files to a safe location, such as a USB drive, then + remove the private key file. + + shred -zu ~/private_key.txt + +# Import keys + + Retrieve the key files which you previously exported. + + gpg --import ~/public_key.txt + gpg --allow-secret-key-import --import ~/private_key.txt + + Then delete the private key file. + + shred -zu ~/private_key.txt + +# Revoke a key + + Create a revocation certificate. + + gpg --output ~/revoke.asc --gen-revoke KEY_ID + + Where KEY_ID is the 8 character GPG key ID. + + After creating the certificate import it. + + gpg --import ~/revoke.asc + + Then ensure that key servers know about the revokation. + + gpg --send-keys KEY_ID + +# Signing and Verifying files + + If you're uploading files to launchpad you may also want to include + a GPG signature file. + + gpg -ba filename + + or if you need to specify a particular key: + + gpg --default-key -ba filename + + This then produces a file with a .asc extension which can be uploaded. + If you need to set the default key more permanently then edit the + file ~/.gnupg/gpg.conf and set the default-key parameter. + + To verify a downloaded file using its signature file. + + gpg --verify filename.asc + +# Signing Public Keys + + Import the public key or retrieve it from a server. + + gpg --keyserver --recv-keys + + Check its fingerprint against any previously stated value. + + gpg --fingerprint + + Sign the key. + + gpg --sign-key + + Upload the signed key to a server. + + gpg --keyserver --send-key + +# Change the email address associated with a GPG key + + gpg --edit-key + adduid + + Enter the new name and email address. You can then list the addresses with: + + list + + If you want to delete a previous email address first select it: + + uid + + Then delete it with: + + deluid + + To finish type: + + save + + Publish the key to a server: + + gpg --send-keys + +# Creating Subkeys + + Subkeys can be useful if you don't wish to have your main GPG key + installed on multiple machines. In this way you can keep your + master key safe and have subkeys with expiry periods or which may be + separately revoked installed on various machines. This avoids + generating entirely separate keys and so breaking any web of trust + which has been established. + + gpg --edit-key + + At the prompt type: + + addkey + + Choose RSA (sign only), 4096 bits and select an expiry period. + Entropy will be gathered. + + At the prompt type: + + save + + You can also repeat the procedure, but selecting RSA (encrypt only). + To remove the master key, leaving only the subkey/s in place: + + gpg --export-secret-subkeys > subkeys + gpg --export > pubkeys + gpg --delete-secret-key + + Import the keys back. + + gpg --import pubkeys subkeys + + Verify the import. + + gpg -K + + Should show sec# instead of just sec.