Initial commit

This commit is contained in:
Adam Cooper 2022-08-24 04:07:33 -04:00
commit 281b31dae6
131 changed files with 13105 additions and 0 deletions

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
*.swp
.DS_Store
f/
**/newsboat/.newsboat/cache.db*
**/newsboat/.newsboat/history.cmdline
**/newsboat/.newsboat/ttrss-pw.txt
**/xmonad/*.hi
**/xmonad/*.o

3
a/README.md Normal file
View file

@ -0,0 +1,3 @@
N.B. .bashrc Linux, .bash_profile Mac
N.B. install script should correctly install bin/ scripts.

12
a/bin/consolidate-path Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
result=":"
IFS=:
for p in $1; do
[[ "$result" == *:"$p":* ]] || result="${result}${p}:"
done
result="${result#:}"
echo "${result%:}"

54
a/ctags/.ctags Normal file
View file

@ -0,0 +1,54 @@
--exclude=.git
--exclude=.hg
--exclude=log
--exclude=tmp
--langdef=js
--langmap=js:.js
--langmap=js:+.jsx
--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/
--regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/
--regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/
--regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/
--regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/
--regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/
--regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/
--langdef=Rust
--langmap=Rust:.rs
--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/
--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/
--langdef=typescript
--langmap=typescript:.ts
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/

61
a/eg/.eg_custom/README.md Normal file
View file

@ -0,0 +1,61 @@
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
alt="Creative Commons License" style="border-width:0"
src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br /><span
xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Cheat Sheets</span>
by <a xmlns:cc="http://creativecommons.org/ns#" href="http://joshuaestes.me"
property="cc:attributionName" rel="cc:attributionURL">Joshua Estes</a> is
licensed under a <a rel="license"
href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
Attribution-ShareAlike 4.0 International License</a>. Based on a work at <a
xmlns:dct="http://purl.org/dc/terms/"
href="https://github.com/JoshuaEstes/CheatSheets"
rel="dct:source">https://github.com/JoshuaEstes/CheatSheets</a>.
Permissions beyond the scope of this license may be available at <a
xmlns:cc="http://creativecommons.org/ns#"
href="https://github.com/JoshuaEstes/CheatSheets/blob/master/LICENSE"
rel="cc:morePermissions">https://github.com/JoshuaEstes/CheatSheets/blob/master/LICENSE</a>.
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

0
a/eg/.eg_custom/ack.md Normal file
View file

75
a/eg/.eg_custom/bash.md Normal file
View file

@ -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

View file

@ -0,0 +1,8 @@
Disable/enable System Integrity Protection
* Restart the computer
* Hold down `Command-R` to reboot into Recovery Mode
* Click `Utilities`
* Select `Terminal`
* Enter `csrutil [ disable | enable ]`
* Restart the computer into Standard Mode

9
a/eg/.eg_custom/curl.md Normal file
View file

@ -0,0 +1,9 @@
cURL Cheat Sheet
================
## Basics
### Get request
```bash
curl https://domain.com
```

View file

@ -0,0 +1,5 @@
# defaults
Change the default location of screenshots:
defaults write com.apple.screencapture location <directory> && killall SystemUIServer

152
a/eg/.eg_custom/git.md Normal file
View file

@ -0,0 +1,152 @@
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'
```
## Push Branch to Remote Repository to a different branch name
```shell
git push origin localBranchName:remoteBranchName
```
Use Case: I will often use rebase, I will cut a branch off the branch I want to rebase and
do the rebase on the newly created branch. Once I am done, I will check the diff and see if
I screwed up. If it's all good, `git push -f` **NOTICE**: DO NOT `git push -f` unless you know
what you are doing.

64
a/eg/.eg_custom/gnupg.md Normal file
View file

@ -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
```

8
a/eg/.eg_custom/grep.md Normal file
View file

@ -0,0 +1,8 @@
Grep
====
## Ignore case
```shell
grep -i pattern
```

11
a/eg/.eg_custom/irssi.md Normal file
View file

@ -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
a/eg/.eg_custom/jira.md Normal file
View file

@ -0,0 +1,8 @@
Jira Cheat Sheet
================
## Find by Mentions of current user within the past 7 days
```sql
comment ~ currentUser() AND updatedDate >= -7d
```

39
a/eg/.eg_custom/ln.md Normal file
View file

@ -0,0 +1,39 @@
# ln
make a symlink to `foo.txt`
ln -s foo.txt link-to-foo.txt
# Basic Usage
Make anchor a link to target:
ln -s <target> <anchor>
# Symbolic Links (symlinks)
Make it symbolic with the `-s` flag:
$ ln -s foo.txt link-to-foo.txt
$ ls -lF
total 8
-rw-r--r-- 1 tyrion group 0 Feb 3 14:13 foo.txt
lrwxr-xr-x 1 tyrion group 7 Feb 3 14:14 link-to-foo.txt@ -> foo.txt
# Hard Links
Omit the `-s` flag:
$ ln foo.txt hard-link-to-foo.txt
$ ls -lF
total 0
-rw-r--r-- 2 tyrion group 0B Feb 3 14:13 foo.txt
-rw-r--r-- 2 tyrion group 0B Feb 3 14:13 hard-link-to-foo.txt

5
a/eg/.eg_custom/lsof.md Normal file
View file

@ -0,0 +1,5 @@
# lsof
Examine the process using a specified `port`:
lsof -i:3000 | grep LISTEN

226
a/eg/.eg_custom/mutt.md Normal file
View file

@ -0,0 +1,226 @@
Mutt Cheat Sheet
================
## General
These key bindings will work on almost any menu you are in.
| command | description |
|------------|-------------|
| * | Move to last entry
| = | Move to first entry
| : | Enter muttrc command
| > | Scroll down one line
| < | Scroll up one line
| [ | Scroll up half a page
| ] | Scroll down half a page
| ? | Help
| ; | Apply next function to tagged messages only
| ! | Invoke command in subshell
| return | Select the current entry
| esc + / | Search up
| / | Search down
| H | Move to top of page
| j | Move to next entry
| k | Move to previous entry
| ctrl + l | Redraw screen
| L | Move to bottom of page
| M | Move to middle of page
| n | Move to next match of search
| q | Exit menu
| t | Tag current entry
| z | Move to next page
| Z | Move to previous page
## Index Menu
When you first open mutt you are in the index menu.
| command | description |
|---------------|-------------|
| & | Link tagged message to current one
| # | Break the thread in two
| % | Toggle whether mailbox will be rewritten
| . | List mailboxes with new mail
| $ | Save changes to mailbox
| @ | Display full address of sender
| | | Pipe message to a shell command
| esc + tab | Jump to previous new or unread message
| return | Display message
| tab | Jump to next new or unread message
| a | Create alias from message sender
| b | Remail message to another user
| esc + c | Open a different folder (Read Only)
| c | Open a different folder
| esc + C | Make text/plain copy
| C | Copy message to another file/mailbox
| esc + d | Delete all messages in subthread
| d | Delete current message
| ctrl + D | Delete all messages in thread
| D | Delete messages matching a pattern
| esc + e | Use the current message as a template for a new one
| e | Edit the raw message
| ctrl + E | Edit attachment content type
| f | Forward message with comments
| ctrl + F | Wipe passphrase from memory
| F | Toggle the important flag for message
| g | Reply to all
| G | Retrive mail from POP server
| h | Display message and toggle header weeding
| j | Move to next undeleted message
| esc + k | Mail a PGP key
| k | Move to previous undeleted message
| ctrl + K | Extract supported public keys
| esc + l | Show current limit pattern
| l | Only show messages matching a pattern
| L | Reply to specific mailing list
| m | Compose new message
| esc + n | Jump to next subthread
| ctrl + N | Jump to next thread
| N | Toggle new flag
| o | Sort messages
| O | Sort messages in reverse order
| Q | Query external program for addresses
| q | Save changes to mailbox and quit
| r | Reply to message
| ctrl + P | Jump to previous thread
| esc + p | Jump to previous subthread
| p | Print current message
| esc + P | Check for classic PGP
| P | Jump to parent message in thread
| ctrl + R | Mark current thread as read
| R | Recall a postponed message
| esc + r | Mark current subthread as read
| esc + s | Save text/plain copy and delete
| s | Save message/attachment to mailbox/file
| esc + t | Tag current thread
| ctrl + T | Untag messages matching a pattern
| T | Tag messages matching pattern
| esc + u | Undelete all messages in subthread
| u | Undelete current entry
| ctrl + U | Undelete all messages in thread
| U | Undelete messages matching pattern
| esc + v | Collapse/uncollapse current thread
| v | Show mime attachments
| esc + V | Collapse/uncollapse all threads
| V | Show mutt version number and date
| w | Set a status flag
| W | Clear status flags from message
## Pager Menu
| command | description |
|---------|-------------|
| # | |
| a | |
| b | |
| c | |
| esc + c | |
| C | |
| esc + C | |
| d | |
| ctrl + D | |
| esc + d | |
| w | |
| W | |
| e | |
| ctrl + E | |
| f | |
| F | |
| g | |
| h | |
| j | |
| J | |
| k | |
| K | |
| & | |
| L | |
| ctrl + L | |
| m | |
| n | |
| N | |
| ctrl + N | |
| esc + n | |
| o | |
| O | |
| p | |
| ctrl + P | |
| esc + p | |
| Q | |
| q | |
| r | |
| R | |
| ctrl + R | |
| esc + r | |
| esc + e | |
| s | |
| S | |
| esc + s | |
| t | |
| T | |
| u | |
| esc + u | |
| ctrl + U | |
| v | |
| V | |
| \\ | |
| @ | |
| | | |
| ? | |
| space | |
| - | |
| ^ | |
| $ | |
| ! | |
| : | |
| . | |
| / | |
| esc + / | |
| return | |
| P | |
| esc + P | |
| esc + k | |
| ctrl + K | |
| ctrl + F | |
## Useful key remaps
These need to be placed in your `muttrc` file. I use vim and so I want to use some of the
same commands to manage my mail.
```muttrc
# Does not replace and currently mapped keys and acts like the vim command gg and takes
# you to the top of the page
bind index gg first-entry
# Replaces the retrieval of mail from a POP server. This will take you to the bottom of
# the page, just like it does in vim
bind index G last-entry
```
## Flags
When viewing messages in the index menu, you will see various flags such as `N` which mean
the messages is new and `D` which means that the message is to be deleted. This is a short
list of those flags.
| flag | description |
|------|-------------|
| ! | Message is flagged
| * | Message is tagged
| + | Message is To: you and only you
| C | Message is Cc: to you
| d | Message has attachments marked for deletion
| D | Marked for deletion
| F | Message is From: you
| K | Contains PGP key
| L | Message is sent to a subscribed mailing list
| n | Thread contains new messages (Only when thread is collapsed)
| N | Message is new
| o | Thread contains old messages (Only when thread is collapsed)
| O | Message is old
| P | Message is PGP encrypted
| r | Message has been replied to
| s | Message is signed
| S | Message is signed and verified
| T | Message is to you and has others in To: or Cc:

8
a/eg/.eg_custom/nmap.md Normal file
View file

@ -0,0 +1,8 @@
Nmap Cheat Sheet
================
## Scan a Port
```bash
nmap -p 80 google.com
```

View file

@ -0,0 +1,25 @@
OpenSSL Cheat Sheet
===================
## Generate Self-Signed Certificate and Private Key
```shell
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && openssl rsa -passin pass:x -in server.pass.key -out server.key && openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
```
- Use `server.crt` and `server.key`
### Encypt/Decrypt file
```
# Encrypt
openssl aes-128-cbc -a -e -pass pass:test -in vars -out vars.enc
# Puts encrypted data into vars.enc file
# Decrypt
openssl aes-128-cbc -a -d -pass pass:test -in vars.enc
# Outputs decrypted data to STDOUT
```
NOTE: See `openssl passpharse arguments` for information on using the password on the commandline. It can be changed to a file or an environment variable.

28
a/eg/.eg_custom/other.md Normal file
View file

@ -0,0 +1,28 @@
Other Cheat Sheets
==================
## Using `less` instead of tail
```shell
less +F -R /path/to/logfile.log
```
* To scroll up and down, press `<ctrl>+c`
* Return to tail mode, press `F`
The `+F` says to follow? The `-R` will process any ANSII color codes.
## SSH Config File
```
# ~/.ssh/config
Host test
HostName testing.example.com
Port 22222
User joshua
IdentityFile ~/.ssh/test.example.com.key
```
Next, all you need to do to ssh into the server is `ssh test` and that's it.
> **NOTE** `HostName` may be an IP Address instead of a domain name

10
a/eg/.eg_custom/pdftk.md Normal file
View file

@ -0,0 +1,10 @@
# pdftk
join a bunch of pdfs
pdftk file01.pdf file02.pdf file03.pdf cat output combined_file.pdf
Add a password to a pdf
pdftk file.pdf output file_pw.pdf user_pw Passw0rd!

View file

@ -0,0 +1,6 @@
# rename (concept, not command)
rename `index.jsx` to `index.tsx` one level down
for i in **/index.jsx; do mv -v $i ${i/jsx/tsx}; done

0
a/eg/.eg_custom/sed.md Normal file
View file

111
a/eg/.eg_custom/tar.md Normal file
View file

@ -0,0 +1,111 @@
# tar
extract .tar file
tar vfx archive.tar
unzip and extract .tar.gz or .tgz file
tar vfxz g_zipped_archive.tar.gz
turn directory into a .tar file
tar vfc tarred_directory.tar directory
turn directory into g-zipped directory
tar vfcz z_zipped_directory.tar.gz directory
# Basic Usage
`vf` means verbosely list files (`v`) and use a file (`f`), not `stdin`.
These appear in most commands.
Untar a file:
tar vfx <tar-file-to-extract>
Create a tar file from a directory:
tar vfc <name-of-tar-file> <directory-to-tar>
# Remembering the Flags
`tar` is very finicky. Flags don't need to be prepended by a hyphen, but are
instead bundled into the first word on the command line. A leading hyphen will
break some implementations or require an order. For example, `tar vfx` might
work while with a hyphen it would require `tar -xvf`, with the `x` flag first.
You can get maximum portability is you never use the hyphens, so examples here
are shown without the hyphen.
You'll almost always want `vf`. `v` verbosely lists files as they are
manipulated, and `f` means you're reading from a file, not `stdin`. You can
remember `vf` if you remember that `tar` is Very Finicky: `vf`.
Extract things from a tar file with `x` for extraction. Compress things to a
tar file with `c` for compress.
And you'll have to just remember that g-zipping is `z` and b-zipping is `j`.
# Tarring
Compress directory (`c`) into g-zipped (`z`) directory:
tar vfcz z_zipped_directory.tar.gz directory
Compress directory (`c`) into b-zipped (`j`) directory:
tar vfcj b_zipped_directory.tar.bz2 directory
Compress directory (`c`) into xz-zipped (`J`) directory:
tar vfcJ xz_zipped_directory.tar.xz directory
# Untarring
Untar (`x`) and unzip a g-zipped (`z`) file:
tar vfxz g_zipped_archive.tar.gz
Untar (`x`) and unzip a b-zipped (`j`) file:
tar vfxj b_zipped_archive.tar.bz2
Untar (`x`) and unzip an xz-zipped (`J`) file:
tar vfxJ xz_zipped_archive.tar.xz
## Partial Untarring
Extract only part of the contents (`directory/foo.txt`) from a .tar file:
tar vfx archived_directory.tar directory/foo.txt
# Display Contents
List (`t`) the contents of a tar file without untarring it:
$ tar vft tarred_directory.tar
drwxr-xr-x 0 tyrion group 0 Feb 4 14:54 directory/
-rw-r--r-- 0 tyrion group 0 Feb 4 14:54 directory/bar.txt
-rw-r--r-- 0 tyrion group 0 Feb 4 14:54 directory/foo.txt

92
a/eg/.eg_custom/tmux.md Normal file
View file

@ -0,0 +1,92 @@
Tmux Cheat Sheet
================
`ctrl + b` is default to enter before you enter the commands. `M` = Left Alt key
or ESC key
## Windows
| command | description |
|---------|-------------|
| c | Create a new window.
| & | Kill the current window.
| n | Change to the next window.
| p | Change to the previous window.
| , | Rename the current window.
| w | Choose the current window interactively.
| M-n | Move to the next window with a bell or activity marker.
| M-p | Move to the previous window with a bell or activity marker.
## Panes
| command | description |
|---------|------------ |
| " | Split the current pane into two, top and bottom.
| % | Split the current pane into two, left and right.
| x | Kill the current pane.
| ; | Move to the previously active pane.
| o | Select the next pane in the current window.
| ! | Break the current pane out of the window.
| q | Briefly display pane indexes.
## Other
| command | description |
|---------|-------------|
| d | Detach the current client.
| $ | Rename the current session.
| [ | Enter copy mode to copy text or view the history.
| f | Prompt to search for text in open windows.
| r | Force redraw of the attached client.
| L | Switch the attached client back to the last session.
| : | Enter the tmux command prompt
| ? | List all key bindings
| f | Search window titles and goto that window
| i | Briefly display window information
| r | Force redraw of the attached client.
| s | Select a new session for the attached client interactively.
| t | Show the time.
| = | Choose which buffer to paste interactively from a list.
| ] | Paste the most recently copied buffer of text.
| . | Move window
## Create a new session
Any of these will work.
```bash
tmux
tmux new
tmux new-session
```
## Reattach to a session
Any of these commands will work.
```bash
tmux at
tmux attach
tmux attach-session
```
## List sessions
Any of these commands will work.
```bash
tmux ls
tmux list-sessions
```
## How to copy and paste
1. Enter copy-mode `C-b [`
2. Move to text, press `Space` to select text, move cursor to highlight text
3. Press `Enter`
4. Back at the command prompt, press `C-b ]` and the text you selected is pasted
## References
* http://man.openbsd.org/OpenBSD-current/man1/tmux.1

50
a/eg/.eg_custom/uml.md Normal file
View file

@ -0,0 +1,50 @@
UML Cheat Sheet
===============
```
<<interface>>
<<abstract>>
<<concrete>>
- private
# protected
+ public
name : type = default value
```
Examples:
```
<<abstract>>
Name\Space\To\ClassAbstract
---
- $privateAttribute : string = ''
# $protected : integer = 1
+ $public : string = 'DefaultValue'
---
+ getPrivateAttribute() : string
+ getValueForKey($key : string) : mixed
+ get($key : string, $default : mixed = null) : mixed
```
```
Class A "uses" Class B
[Class A]- - - ->[Class B]
```
```
Class A "has a" Class B
[Class A]---->[Class B]
```
```
Company "owns" Employee
[Company]⃟----[Employee]
```
```
Ford "is a" Car
[Car]◁----[Ford]
```

5
a/eg/.eg_custom/vim.md Normal file
View file

@ -0,0 +1,5 @@
# vim
paste from clipboard into vim
"*yy OR "+yy (clarify this)

View file

@ -0,0 +1,5 @@
# youtube-dl
Download a video and convert it to MP4
youtube-dl -v -o '%(title)s.%(ext)s' --restrict-filenames --recode-video mp4 qXYh8DmBZek

4
a/eg/.eg_custom/zsh.md Normal file
View file

@ -0,0 +1,4 @@
Zsh Cheat Sheet
===============
Still haven't got around to digging in a reading the man pages for this yet.

3
a/eg/.egrc Normal file
View file

@ -0,0 +1,3 @@
[eg-config]
examples-dir = ~/builds/eg/eg/examples
custom-dir = ~/.eg_custom

2742
a/git/.git-completion Normal file

File diff suppressed because it is too large Load diff

11
a/git/.gitconfig Normal file
View file

@ -0,0 +1,11 @@
[user]
name = Adam Cooper
email = theadamcooper@protonmail.com
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
editor = vim
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true

6
a/install.sh Normal file
View file

@ -0,0 +1,6 @@
# This script should install oh-my-zsh and vim-plug
# oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

View file

@ -0,0 +1,9 @@
color background black default
color listnormal black default
color listfocus white blue
color listnormal_unread magenta default
color listfocus_unread white blue bold
color info white blue
color article black default
max-items 4096
keep-articles-days 45

View file

@ -0,0 +1,4 @@
finger
finger
finger
selfie

38
a/newsboat/.newsboat/urls Normal file
View file

@ -0,0 +1,38 @@
http://feeds.guardian.co.uk/theguardian/world/rss "nuggets"
http://www.wsws.org/rss/en.xml "nuggets"
http://www.democracynow.org/democracynow.rss "nuggets"
http://news.ycombinator.com/rss "tech"
https://lobste.rs/rss "tech"
http://www.languagehat.com/index.rdf "linguistics"
http://www.opengeodata.org/?feed=rss2 "tech"
http://feeds.arstechnica.com/arstechnica/index/ "tech"
http://feeds.feedburner.com/TheCssAwards "tech"
http://feeds.feedburner.com/CssTricks "tech"
https://protonvpn.com/blog/feed/ "tech"
https://cloudblog.withgoogle.com/rss/ "tech"
https://spreadprivacy.com/feed "tech"
https://protonmail.ch/blog/feed/ "tech"
https://os.phil-opp.com/rss.xml "tech"
http://www.bleepingcomputer.com/feed/ "tech"
https://mondediplo.com/backend "nuggets"
http://feeds.feedburner.com/Metafilter "nuggets"
http://feeds.feedburner.com/InTheseTimes "nuggets"
http://whowhatwhy.com/feed/ "nuggets"
http://jacobinmag.com/feed/ "nuggets"
http://www.thebaffler.com/blog/rss "nuggets"
http://www.dissentmagazine.org/feed "nuggets"
https://www.govtrack.us/events/events.rss?feeds=bill%3As116-1489 "nuggets"
https://www.govtrack.us/events/events.rss?feeds=bill%3Ah116-2728 "nuggets"
https://www.govtrack.us/events/events.rss?feeds=bill%3Ah116-2065 "nuggets"
https://harpers.org/feed/ "nuggets"
http://feeds.propublica.org/propublica/nerds "nuggets"
http://feeds.propublica.org/propublica/main "nuggets"
http://www.counterpunch.org/feed/ "nuggets"
http://thenewinquiry.com/rss "nuggets"
http://editor.currentaffairs.org/feed/ "nuggets"
https://www.truthdig.com/feed/ "nuggets"
http://googletesting.blogspot.com/feeds/posts/default "webdev"
http://javascriptweekly.com/rss "webdev"
http://feeds.feedburner.com/Bludice "webdev"
https://reactjs.org/feed.xml "webdev"
https://theintercept.com/feed/?lang=en "nuggets"

206
a/procs/.procs.toml Normal file
View file

@ -0,0 +1,206 @@
[[columns]]
kind = "Pid"
style = "BrightYellow"
numeric_search = true
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "User"
style = "BrightGreen"
numeric_search = false
nonnumeric_search = true
align = "Left"
[[columns]]
kind = "Separator"
style = "Magenta"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "State"
style = "ByState"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Nice"
style = "BrightMagenta"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Tty"
style = "Blue"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "UsageCpu"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "UsageMem"
style = "ByPercentage"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "VmSize"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "VmRss"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "TcpPort"
style = "BrightCyan"
numeric_search = true
nonnumeric_search = false
align = "Left"
max_width = 20
[[columns]]
kind = "UdpPort"
style = "BrightCyan"
numeric_search = true
nonnumeric_search = false
align = "Left"
max_width = 20
[[columns]]
kind = "ReadBytes"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "WriteBytes"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Slot"
style = "ByUnit"
numeric_search = false
nonnumeric_search = false
align = "Right"
[[columns]]
kind = "Separator"
style = "Magenta"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "CpuTime"
style = "BrightCyan"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "StartTime"
style = "BrightMagenta"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Docker"
style = "BrightGreen"
numeric_search = false
nonnumeric_search = true
align = "Left"
[[columns]]
kind = "Separator"
style = "Magenta"
numeric_search = false
nonnumeric_search = false
align = "Left"
[[columns]]
kind = "Command"
style = "Blue"
numeric_search = false
nonnumeric_search = true
align = "Left"
[style]
header = "Blue"
unit = "Blue"
[style.by_percentage]
color_000 = "BrightBlue"
color_025 = "BrightGreen"
color_050 = "BrightYellow"
color_075 = "BrightRed"
color_100 = "BrightRed"
[style.by_state]
color_d = "BrightRed"
color_r = "BrightGreen"
color_s = "BrightBlue"
color_t = "BrightCyan"
color_z = "BrightMagenta"
color_x = "BrightMagenta"
color_k = "BrightYellow"
color_w = "BrightYellow"
color_p = "BrightYellow"
[style.by_unit]
color_k = "BrightBlue"
color_m = "BrightGreen"
color_g = "BrightYellow"
color_t = "BrightRed"
color_p = "BrightRed"
color_x = "BrightBlue"
[search]
numeric_search = "Exact"
nonnumeric_search = "Partial"
logic = "And"
[display]
show_self = false
cut_to_terminal = true
cut_to_pager = false
cut_to_pipe = false
color_mode = "Auto"
separator = "│"
ascending = "▲"
descending = "▼"
tree_symbols = ["│", "─", "┬", "├", "└"]
abbr_sid = true
[sort]
column = 0
order = "Ascending"
[docker]
path = "unix:///var/run/docker.sock"
[pager]
mode = "Auto"

64
a/tmux/.tmux.conf Normal file
View file

@ -0,0 +1,64 @@
# 256 colors for vim
set -g default-terminal "screen-256color"
# Set default shell to zsh
set-option -g default-shell /bin/zsh
# Tmuxline
if-shell "test -f ~/.tmuxline_snapshot.conf" "source ~/.tmuxline_snapshot.conf"
# Start window numbering at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Cycle panes with C-b C-b
unbind ^B
bind ^B select-pane -t :.+
# Reload config wtih a key
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
# Mouse works as expected
set -g mouse on
# set -g mode-mouse on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
# set -g mouse-select-window on
# Scrolling works as expected
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Use the system clipboard
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# Clear the pane and its history
bind -n C-k send-keys C-l \; clear-history
# Smart pane switching with awareness of vim splits
# From github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\\ select-pane -l
# C-l is taken over by vim style pane navigation (not sure where this comes from or whether I still need this)
bind C-l send-keys 'C-l'
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

View file

@ -0,0 +1,21 @@
# This tmux statusbar config was created by tmuxline.vim
# on Mon, 13 Jul 2020
set -g status-justify "left"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=colour18,bg=colour45"
set -g status-right-style "none"
set -g pane-active-border-style "fg=colour27"
set -g status-style "none,bg=colour159"
set -g message-style "fg=colour18,bg=colour45"
set -g pane-border-style "fg=colour45"
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-style "none"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=colour27,bg=colour159"
set -g status-left "#[fg=colour255,bg=colour27] #S #[fg=colour27,bg=colour159,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour45,bg=colour159,nobold,nounderscore,noitalics]#[fg=colour18,bg=colour45] %Y-%m-%d  %H:%M #[fg=colour27,bg=colour45,nobold,nounderscore,noitalics]#[fg=colour255,bg=colour27] #h "
setw -g window-status-format "#[fg=colour27,bg=colour159] #I #[fg=colour27,bg=colour159] #W "
setw -g window-status-current-format "#[fg=colour159,bg=colour45,nobold,nounderscore,noitalics]#[fg=colour18,bg=colour45] #I #[fg=colour18,bg=colour45] #W #[fg=colour45,bg=colour159,nobold,nounderscore,noitalics]"

26
a/tmux/.tmuxp/acorn.json Normal file
View file

@ -0,0 +1,26 @@
{
"session_name": "acorn",
"windows": [{
"window_name": "ide",
"panes": [
"vim -R package.json",
"ls",
"git status"
],
"layout": "main-horizontal",
"main-pane-height": 32,
"start_directory": "~/code/acorn-glen"
}, {
"window_name": "servers",
"start_directory": "~/code/acorn-glen",
"layout": "main-horizontal",
"panes": [{
"shell_command": [ "cd ~/code/acorn-glen", "echo 'yarn dev'" ]
}, {
"shell_command": [ "sleep 4", "echo 'yarn relay --watch'" ]
}, {
"shell_command": [ "sleep 4", "echo 'yarn start'" ]
}]
}]
}

View file

@ -0,0 +1,16 @@
{
"session_name": "general",
"windows": [{
"window_name": "ytop",
"panes": ["ytop -c default-dark"]
}, {
"window_name": "newsboat",
"panes": ["newsboat"]
}, {
"window_name": "ddgr",
"panes": ["ddgr --unsafe --noua"]
}, {
"panes": ["echo 'session \"general\"'"]
}],
"start_directory": "~"
}

26
a/tmux/.tmuxp/turnip.json Normal file
View file

@ -0,0 +1,26 @@
{
"session_name": "turnip",
"windows": [{
"window_name": "ide",
"panes": [
"echo 'vim -R package.json'",
"ls",
"echo 'git was here'"
],
"layout": "main-horizontal",
"main-pane-height": 32,
"start_directory": "~/code/turnip-glen"
}, {
"window_name": "servers",
"start_directory": "~/code/turnip-glen",
"layout": "main-horizontal",
"panes": [{
"shell_command": [ "cd ~/code/cornish-glen", "yarn dev" ]
}, {
"shell_command": [ "sleep 4", "yarn relay --watch" ]
}, {
"shell_command": [ "sleep 4", "yarn start" ]
}]
}]
}

View file

@ -0,0 +1 @@
let b:ale_linters = {'javascript': ['eslint']}

98
a/vim/.vimrc Normal file