Skip to content

Commit

Permalink
updated readme, copied from gist
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Jun 19, 2015
1 parent 4989303 commit 014f040
Show file tree
Hide file tree
Showing 14 changed files with 896 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Cheat Sheets
============

> **NOTE**: This repo is best used by placing a bookmark in your address bar.
This is a collection of cheat sheets that I have compiled over the years that I
put together while learning various tools. They contain some good information
and a few gems that I have learned along the way. Feel free to contribute.

## Contents

- [Bash]
- [Git]
- [GnuPG]
- [irssi]
- [JIRA]
- [mutt]
- [nmap]
- [openssl]
- [tmux]
- [uml]
- [vim]
- [zsh]
- [other]

## License

<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img
Expand All @@ -22,4 +44,18 @@ rel="cc:morePermissions">https://github.com/JoshuaEstes/CheatSheets/blob/master/

See [LICENSE] for full license.


[Bash]: https://github.com/JoshuaEstes/CheatSheets/blob/master/bash.md
[Git]: https://github.com/JoshuaEstes/CheatSheets/blob/master/git.md
[GnuPG]: https://github.com/JoshuaEstes/CheatSheets/blob/master/gnupg.md
[irssi]: https://github.com/JoshuaEstes/CheatSheets/blob/master/irssi.md
[JIRA]: https://github.com/JoshuaEstes/CheatSheets/blob/master/jira.md
[mutt]: https://github.com/JoshuaEstes/CheatSheets/blob/master/mutt.md
[nmap]: https://github.com/JoshuaEstes/CheatSheets/blob/master/nmap.md
[openssl]: https://github.com/JoshuaEstes/CheatSheets/blob/master/openssl.md
[tmux]: https://github.com/JoshuaEstes/CheatSheets/blob/master/tmux.md
[uml]: https://github.com/JoshuaEstes/CheatSheets/blob/master/uml.md
[vim]: https://github.com/JoshuaEstes/CheatSheets/blob/master/vim.md
[zsh]: https://github.com/JoshuaEstes/CheatSheets/blob/master/zsh.md
[other]: https://github.com/JoshuaEstes/CheatSheets/blob/master/other.md
[LICENSE]: https://github.com/JoshuaEstes/CheatSheets/blob/master/LICENSE
75 changes: 75 additions & 0 deletions bash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Bash Cheat Sheet
================

## Moving

| command | description |
|----------|--------------------------------|
| ctrl + a | Goto BEGINNING of command line |
| ctrl + e | Goto END of command line |
| ctrl + b | move back one character |
| ctrl + f | move forward one character |
| alt + f | move cursor FORWARD one word |
| alt + b | move cursor BACK one word |

## Other

| command | description |
|----------|--------------------------------|
| ctrl + d | Delete the character under the cursor |
| ctrl + l | Clear the screen (same as clear command) |
| ctrl + p | Fetch the previous command from the history list, moving back in the list (same as up arrow) |
| ctrl + n | Fetch the next command from the history list, moving forward in the list (same as down arrow) |
| ctrl + u | Clear all BEFORE cursor |
| ctrl + k | Clear all AFTER cursor |
| ctrl + r | Search backward starting at the current line and moving 'up' through the history as necessary |
| crtl + s | Search forward starting at the current line and moving 'down' through the history as necessary |
| ctrl + c | kill whatever is running |
| ctrl + d | Exit shell (same as exit command) |
| ctrl + w | delete the word BEFORE the cursor |
| ctrl + t | swap the last two characters before the cursor |
| ctrl + y | paste (if you used a previous command to delete) |
| ctrl + z | Place current process in background |
| ctrl + _ | undo |
| esc + t | Swap last two words before the cursor |
| esc + . | |
| esc + _ | |
| alt + [Backspace] | delete PREVIOUS word |
| alt + < | Move to the first line in the history |
| alt + > | Move to the end of the input history, i.e., the line currently being entered |
| alt + ? | |
| alt + * | |
| alt + . | print the LAST ARGUMENT (ie "vim file1.txt file2.txt" will yield "file2.txt") |
| alt + c | |
| alt + d | |
| alt + l | |
| alt + n | |
| alt + p | |
| alt + r | |
| alt + t | |
| alt + u | |
| ~[TAB][TAB] | List all users |
| $[TAB][TAB] | List all system variables |
| @[TAB][TAB] | List all entries in your /etc/hosts file |
| [TAB] | Auto complete |
| !! | Run PREVIOUS command (ie `sudo !!`) |
| !vi | Run PREVIOUS command that BEGINS with vi |
| cd - | change to PREVIOUS working directory |

# Kill a job

n = job number, to list jobs, run `jobs`

```bash
kill %n
```

Example:

```bash
kill %1
```

## References

1. http://cnswww.cns.cwru.edu/php/chet/readline/readline.html
141 changes: 141 additions & 0 deletions git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
Git Cheat Sheet
===============

## Subtree Example

### Add sub-project as remote

```bash
git remote add -f RemoteName RemoteUrl
```

### Run `git subtree` command

```bash
git subtree add --prefix Path/To/Put/Code NameOfRemote master --squash
```

#### Pull subtree as needed

```bash
git fetch NameOfRemote master
git subtree pull --prefix Path/To/Put/Code NameOfRemote master --squash
```

### Reference

* http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree

## Create a branch without a parent

Very useful when you are updating a project that you are rewriting. For example,
say you are using semantic versioning and are wanting to start a new major
version.

```bash
git checkout --orphan BRANCH
```

## Delete All Branches that have been merged

Great for cleaning up local branches that aren't being used any more.

```bash
git checkout master
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
```

## Ignore changes to a file that is being tracked

### Ignore

```bash
git update-index --assume-unchanged [directory|file]
```

### Unignore

```bash
git update-index --no-assume-unchanged [directory|file]
```

## How to ignore dirty submodules

Edit your ``.git/config`` and add ``ignore = dirty``.

```text
[submodule "path/to/submodule"]
path = path/to/submodule
url = git://github.com/username/repo.git
ignore = dirty
```

## Clone a repo and give name other than origin

```bash
git clone -o upstream https://repo.git
```

## Ignore Files for Repository without using `.gitignore`

Add the file `.git/info/exclude` and fill it with the contents you want to ignore. This will ONLY apply to the
repository and will not be tracked by git.

## Squash Commits

```bash
git log
```

Count the number of commits that you have made, let's say the previous 5 are your commits.

```bash
git rebase -i HEAD~5
```

The first commit leave as `pick` the rest will need to be changed to `squash`. After that you will be able to
leave a new commit message or just leave as is to keep the commit messages from all previous commits.

## Search for a specific line of code/file in the history

```bash
git log -S[search term]
```

Example:

```bash
git log -SThatOneFile.php
```

## Copy file from one branch to current branch

Copy a file from `branch` and put into staging.

```bash
git checkout BRANCH path/to/file.ext

# Real Life Examples
git checkout origin/featureBranch web/js/random.js
# Pulls into your current branch web/js/random.js from
# origin/featureBranch
```

## Git Grepping for fun and profit!

```shell
# Basic grep (case sensitive)
$ git grep 'search term'

# Case Insensitive search
$ git grep -i 'search term'

# Search within a directory
$ git grep 'search term' src/

# Search only files with `php` extension
$ git grep 'search term' -- '*.php'

# Grep in the 'src/` directory, only yml files
$ git grep 'search term' -- 'src/**.yml'
```
64 changes: 64 additions & 0 deletions gnupg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
GnuPG Cheat Sheet
=================

## Listing Key Pairs

```bash
gpg --list-keys
```

For listing keys with the fingerprint, run

```bash
gpg --fingerprint
```

## Generate New Key Pair

```bash
gpg --gen-key
```

## Encrypt a message on command line

```bash
echo "Put message here" | gpg --armor --encrypt --recipient Joshua > FILE.gpg
```

This will put the encrypted text into `FILE.gpg` which you can send to someone or keep for
later use. For decrypting the message, see the next section.

## Decrypt a message from the command line

```bash
cat FILE.gpg | gpg
```

Displays the decrypted text on the command line.

## Only display user X's key information

```bash
gpg --fingerprint Joshua
```

## Signing Messages

```bash
echo "This is a top secret message" | gpg --clearsign
```

## Signing Text Files

```bash
gpg --clearsign example.txt
```

This will create `example.txt.asc` file.

## Verify Signatures

```bash
gpg --verifiy example.txt.asc
```

11 changes: 11 additions & 0 deletions irssi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Irssi Cheat Sheet
=================

M = Meta Key, meta key is either the left alt or esc key.

| command | description |
|----------|-------------|
| M + p | Scroll up in window
| M + n | Scroll down in window
| ctrl + p | Previous window
| ctrl + n | Next window
8 changes: 8 additions & 0 deletions jira.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Jira Cheat Sheet
================

## Find by Mentions of current user within the past 7 days

```sql
comment ~ currentUser() AND updatedDate >= -7d
```
Loading

0 comments on commit 014f040

Please sign in to comment.