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
View file

@ -0,0 +1,98 @@
" Make backspace behave in a sane manner.
set backspace=indent,eol,start
" Tab indentation: see `:help tabstop`
set shiftwidth=2
set tabstop=2
" set softtabstop=2
set expandtab
" Consider installing the Smart Tabs plugin
" Default: split right
set splitright
" Show whitespace
set listchars=eol,tab:>-,trail:~,extends:>,precedes:<,space
" Show line numbers
set number
set relativenumber
" Allow hidden buffers, don't limit to one file per window/split
set hidden
" Sane vim split naviagation (via Gaslight blog)
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" Disable filetype detection
filetype off
" vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'edkolev/tmuxline.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'dense-analysis/ale'
Plug 'Valloric/YouCompleteMe'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'pangloss/vim-javascript'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'Quramy/tsuquyomi'
Plug 'severij/vadelma'
Plug 'tpope/vim-surround'
Plug 'rust-lang/rust.vim'
call plug#end()
" NERDTree on ctrl+n
let NERDTreeShowHidden=1
map <silent> <C-n> :NERDTreeToggle<CR>
" close NERDTree after opening a file
" let g:NERDTreeQuitOnOpen=1
" Tsuquyomi
autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
" Airline
let g:airline_powerline_fonts = 1
let g:airline_theme = 'light'
let g:airline#extensions#tmuxline#enabled = 0
" Tmuxline
let g:tmuxline_theme = 'iceberg'
" YouCompleteMe <> TypeScript
if !exists("g:ycm_semantic_triggers")
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers['typescript'] = ['.']
" Enable file type detection and do language-dependent indenting
filetype plugin indent on
" Switch syntax highlighting on
syntax enable
" Set color scheme
set background=light
colorscheme vadelma
" Temporary file locations
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.undo/,/tmp//

153
a/zsh/.zshrc Normal file
View file

@ -0,0 +1,153 @@
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME=""
# Suppress display of name of default user in prompt
DEFAULT_USER=$USER
prompt_context() {}
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
export DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git nvm vi-mode)
source $ZSH/oh-my-zsh.sh
# User configuration
export PATH="/Users/adamcooper/Library/Python/3.7/bin:/Users/adamcooper/.cargo/bin:$(brew --prefix coreutils)/libexec/gnubin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:$PATH"
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
export VISUAL=vim
export EDITOR=$VISUAL
export BROWSER=w3m
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Replace native OS X ctags with Homebrew ctags
alias ctags=`brew --prefix`/bin/ctags
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Why are these not exports?
# enable git unstaged indicators - set to a non-empty value
GIT_PS1_SHOWDIRTYSTATE="."
# enable showing of untracked files - set to a non-empty value
GIT_PS1_SHOWUNTRACKEDFILES="."
# enable stash checking - set to a non-empty value
GIT_PS1_SHOWSTASHSTATE="."
# enable showing of HEAD vs its upstream
GIT_PS1_SHOWUPSTREAM="auto"
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)
## NVM ##
# Functionality now handled by Oh My Zsh plugin
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Starship
eval "$(starship init zsh)"
## FZF ##
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND="fd --hidden . $HOME" # Includes hidden files
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd -t d . $HOME"
# Tmuxp completion #
eval "$(_TMUXP_COMPLETE=source_zsh tmuxp)"
# ddgr colors
export DDGR_COLORS="MBdexy"
# exa colors
export LS_COLORS="*.md=30"
export EXA_COLORS="uu=33;43;1"
# Consolidate PATH
export PATH="$(consolidate-path "$PATH")"

5
arch/README.md Normal file
View file

@ -0,0 +1,5 @@
These are the messy dotfiles for my Arch Linux system. They're useful for
- restoring my system after a catastrophe
- almost nothing else :)
Please feel free to contact me with any questions; I'll be glad to help.

60
arch/X11/.Xresources Normal file
View file

@ -0,0 +1,60 @@
*.termName: xterm-256color
*faceName: Fantasque Sans Mono:size=10
! XTerm*eightBitInput: false
! XTerm*eightBitOutput: true
*metaSendsEscape: true
*VT100.Translations: #override \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Shift <Btn1Up>: exec-formatted("xdg-open '%t'", PRIMARY) select-start() select-end() \n\
Ctrl <Key> minus: smaller-vt-font() \n\
Ctrl <Key> plus: larger-vt-font() \n\
Ctrl <Key> 0: set-vt-font(d) \n\
*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48
*on3Clicks: regex ([[:alpha:]]+:\/\/)?([[:alnum:]!#+,.\/=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+
! Fonts {{{
Xft.antialias: true
Xft.hinting: true
Xft.rgba: rgb
Xft.hintstyle: hintfull
Xft.dpi: 220
! }}}
! Cursor {{{
*cursorTheme: Adwaita
Xcursor.size: 48
! }}}
! VT Font Menu: Unreadable
*faceSize1: 8
! VT font menu: Tiny
*faceSize2: 10
! VT font menu: Medium
*faceSize3: 12
! VT font menu: Large
*faceSize4: 16
! VT font menu: Huge
*faceSize5: 22
! Theme
*background: #f6f5f4
*foreground: #000000
*color0: #000000
*color1: #d64541
*color2: #019875
*color3: #e47833
*color4: #34495e
*color5: #674172
*color6: #12cfc0
*color7: #eeeeee
*color8: #505050
*color9: #d24d57
*color10: #019875
*color11: #f4b350
*color12: #2574a9
*color13: #913d88
*color14: #81cfe0
*color15: #ffffff

58
arch/bin/autoreply/autoreply.sh Executable file
View file

@ -0,0 +1,58 @@
#!/bin/bash
# autoreply.sh
#
# This script sends a canned email response to those who've errone-
# ously emailed me at <amcooper@gmail.com>. Once I've manually
# moved those emails into the `misdirected` folder, it iterates
# over those emails and responds.
set -euo pipefail
MISDIRECTED_DIR=/home/adam/Maildir/misdirected
if [[ -z "$(ls -A "$MISDIRECTED_DIR/cur")" ]] && [[ -z "$(ls -A "$MISDIRECTED_DIR/new")" ]]; then
echo "[autoreply.sh] The misdirected folders are currently empty. Exiting..."
exit 1
fi
# This weird feed-find-output-into-while-loop comes from
# https://github.com/koalaman/shellcheck/wiki/SC2044#correct-code
while IFS= read -r -d '' file ; do
echo "[loop] Preparing the email..."
# Make a temporary file
temporary_file=$(mktemp /tmp/autoreplyXXXXX)
# Pull sender (i.e. recipient of my email) and subject from email
recipient="$(perl -lane 'print if /^From:/' "$file" | cut -d' ' -f2-)" ### "Frantz Fanon <ffanon@riseup.net>"
subject="Re: $(perl -lane 'print if /^Subject:/' "$file" | cut -d' ' -f2-)" ### "Re: Lorem ipsum baby"
# Copy canned message to temporary file
cp /home/adam/dotfiles/arch/bin/autoreply/misdirected_email_autoreply.txt "$temporary_file"
# Append email body to temporary file
discard="0"
while IFS= read -r line ; do
if [[ $discard = "1" ]]; then
echo "$line" >> "$temporary_file"
else
if [[ -z "$line" ]]; then
discard="1"
fi
fi
done < "$file"
# Send the email!
echo "[loop] Sending reply to $recipient ... "
neomutt -s "$subject" -c amcooper@gmail.com "$recipient" < "$temporary_file"
# Move the misdirected email into `INBOX/cur`
echo "[loop] Moving the emails..."
mv "$file" /home/adam/Maildir/INBOX/cur
echo "[loop] Done."
done < <(find "$MISDIRECTED_DIR" -path "$MISDIRECTED_DIR/tmp" -prune -o -type f -print0)
echo "[autoreply.sh] All done!"

View file

@ -0,0 +1,12 @@
Hi,
Looks like you've mistakenly emailed me at my old GMail address. I get a
misdirected email at that address about once a week. Please double check
your recipient's email address.
Regards,
A.C.
[This is an automated email reply. For more context, see:
https://theadamcooper.com/home/wrong-email.html ]

View file

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
if [[ -n $(secret-tool lookup service nextcloud) ]]; then
/usr/bin/vdirsyncer discover
/usr/bin/vdirsyncer sync --force-delete my_contacts/z-app-generated--contactsinteraction--recent
else
echo "Failed to unlock database"
fi

13
arch/bin/consolidate-path Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# Usage: PATH="$(consolidate-path "$PATH")"
#
# Remove duplicate entries from PATH.
result=":"
IFS=:
for p in $1; do
[[ "$result" == *:"$p":* ]] || result="${result}${p}:"
done
result="${result#:}"
echo "${result%:}"

View file

@ -0,0 +1,65 @@
#!/bin/bash
#
# facetimehd-reinstall.sh
#
# Reinstalls the facetimehd kernel module. We do this because each time we bump
# the kernel, this module usually breaks. The script can be set as a pacman hook
# to run after each kernel bump. The script should be run as root.
#
# Ref.:
# https://github.com/patjak/facetimehd/wiki/Installation#get-started-on-arch
set -euo pipefail
#
# These text wrangles are meant to convert package numbers from pacman style to
# uname style. So:
# 5.18.16.arch1-1 -> 5.18.16-arch1-1
# 5.15.58-2 -> 5.15.58-2-lts
#
kernel_release=$(pacman -Qi linux | grep Version | \
perl -ple 's/^Version.*([0-9]+\.[0-9]+\.[0-9]+)\.(.*)$/$1-$2/')
kernel_release_lts=$(pacman -Qi linux-lts | grep Version | \
perl -ple 's/^Version.*([0-9]+\.[0-9]+\.[0-9]+.*)$/$1-lts/')
cd /home/adam/builds/bcwc_pcie || exit 1
#
# Linux
#
echo "*** Linux FacetimeHD driver ***"
echo "[linux] make clean"
KERNELRELEASE=$kernel_release make clean
echo "[linux] make"
KERNELRELEASE=$kernel_release make
echo "[linux] make install"
KERNELRELEASE=$kernel_release make install
echo "[linux] depmod"
depmod "$kernel_release"
if ! (modprobe --set-version "$kernel_release" -r bdc_pci); then
echo "[linux] Removal of module bdc_pci failed."
fi
if ! (modprobe --set-version "$kernel_release" -r facetimehd); then
echo "[linux] Removal of module facetimehd failed."
fi
echo "[linux] Installing module facetimehd"
modprobe --set-version "$kernel_release" facetimehd
#
# Linux LTS
#
echo "*** Linux-LTS FacetimeHD driver ***"
echo "[linux-lts] make clean"
KERNELRELEASE=$kernel_release_lts make clean
echo "[linux-lts] make"
KERNELRELEASE=$kernel_release_lts make
echo "[linux-lts] make install"
KERNELRELEASE=$kernel_release_lts make install
echo "[linux-lts] depmod"
depmod "$kernel_release_lts"
if ! (modprobe --set-version "$kernel_release_lts" -r bdc_pci); then
echo "[linux-lts] Removal of module bdc_pci failed."
fi
if ! (modprobe --set-version "$kernel_release_lts" -r facetimehd); then
echo "[linux-lts] Removal of module facetimehd failed."
fi
echo "[linux-lts] Installing module facetimehd"
modprobe --set-version "$kernel_release_lts" facetimehd

View file

@ -0,0 +1,3 @@
#!/bin/bash
notify-send "Systemd unit failure: $1" "The systemd unit $1 has failed"

19
arch/bin/joplin-rename.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# joplin-rename.sh
#
# This script slugifies joplin entities (notes and todos)
# (Work in progress)
set -euo pipefail
set -x
joplin use test-notebook
while IFS= read -r -d '' item ; do
echo "$item"
done < <(joplin ls)
echo "[joplin-rename] All done!"

7
arch/bin/notmuch-hook.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
notmuch new
# retag all "new" messages "inbox" and "unread"
notmuch tag +inbox +unread -new -- tag:new
# tag all messages from "me" as sent and remove tags inbox and unread
notmuch tag -new -inbox +sent -- from:adam@theadamcooper.com

10
arch/bin/w3m-wallabagger.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
# curl commands are currently '--insecure' until the certificate situation is sorted out
token=$(curl --silent --insecure -X POST --data grant_type=password --data client_id=3_3kfqif569iqsk8s88koccsk8kkg8oc0o4k8kckoo8ss84cgw0k --data client_secret=4s5ioftf8juocc0woskscogogwgw0wwwsg4cccoscwoc0c88cc --data username=adam --data password="$(secret-tool lookup Title wallabag)" 'https://wallabag.theadamcooper.com/oauth/v2/token' | jshon -e access_token | sed 's/"//g')
if [[ -n $token ]]; then
curl --silent --insecure -X POST --header "Authorization: Bearer ${token}" --data url="$1" 'https://wallabag.theadamcooper.com/api/entries.json' &> /dev/null
else
echo "$(date +"%Y-%m-%d %H:%M") Invalid token" >> /home/adam/.config/local/share/w3m/w3m-wallabagger.log
fi

3
arch/bin/xmonad-recompile.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
xmonad --recompile

44
arch/fish/config.fish Normal file
View file

@ -0,0 +1,44 @@
if status is-interactive
# Commands to run in interactive sessions can go here
fish_add_path --path /usr/sbin /usr/bin /sbin /bin /usr/local/bin /opt/local/bin /opt/local/sbin /usr/local/go/bin $HOME/.local/bin $HOME/.cargo/bin $HOME/.cargo/env $HOME/code/go/bin $HOME/.rbenv
# Currently using the default $MANPATH; see /etc/man_db.conf
set --global fish_key_bindings fish_vi_key_bindings
## XDG
set --global --export XDG_CONFIG_HOME "$HOME/.config"
set --global --export XDG_DATA_HOME "$HOME/.config/local/share"
set --global --export XDG_CACHE_HOME "$HOME/.config/cache"
set --global --export EDITOR "vim"
set --global --export VISUAL "vim"
# FZF
set --global --export FZF_DEFAULT_COMMAND "fd --no-ignore --hidden --type f" # Includes hidden files
set --global --export FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
fzf_key_bindings
# bat theme
set --global --export BAT_THEME OneHalfLight
# exa colors
set --global --export LS_COLORS "*.md=36"
# ddgr
set --global --export BROWSER w3m
set --global --export DDGR_COLORS "MBdexy"
# navi
set --global --export NAVI_TAG_COLOR 6
set --global --export NAVI_COMMENT_COLOR 3
navi widget fish | source
# starship
starship init fish | source
## zoxide ##
zoxide init fish | source
end

32
arch/fish/fish_variables Normal file
View file

@ -0,0 +1,32 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR --export --path GOPATH:/home/adam/code/go/
SETUVAR __fish_initialized:3100
SETUVAR _fish_abbr_exi:exa\x20\x2d\x2dall\x20\x2d\x2dlong\x20\x2d\x2dicons\x20\x2d\x2dgroup
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:005fd7
SETUVAR fish_color_comment:990000
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:009900
SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:00a6b2
SETUVAR fish_color_param:00afff
SETUVAR fish_color_quote:999900
SETUVAR fish_color_redirection:00afff
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:\x1d
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan

View file

@ -0,0 +1,172 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.fish
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# Key bindings
# ------------
function fzf_key_bindings
# Store current token in $dir as root for the 'find' command
function fzf-file-widget -d "List files and folders"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -l prefix $commandline[3]
# "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not
# $dir itself, even if hidden.
test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | sed 's@^\./@@'"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS"
eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end
end
if [ -z "$result" ]
commandline -f repaint
return
else
# Remove last token from commandline.
commandline -t ""
end
for i in $result
commandline -it -- $prefix
commandline -it -- (string escape $i)
commandline -it -- ' '
end
commandline -f repaint
end
function fzf-history-widget -d "Show command history"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m"
set -l FISH_MAJOR (echo $version | cut -f1 -d.)
set -l FISH_MINOR (echo $version | cut -f2 -d.)
# history's -z flag is needed for multi-line support.
# history's -z flag was added in fish 2.4.0, so don't use it for versions
# before 2.4.0.
if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];
history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result
and commandline -- $result
else
history | eval (__fzfcmd) -q '(commandline)' | read -l result
and commandline -- $result
end
end
commandline -f repaint
end
function fzf-cd-widget -d "Change directory"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -l prefix $commandline[3]
test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type d -print 2> /dev/null | sed 's@^\./@@'"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS"
eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
if [ -n "$result" ]
cd $result
# Remove last token from commandline.
commandline -t ""
commandline -it -- $prefix
end
end
commandline -f repaint
end
function __fzfcmd
test -n "$FZF_TMUX"; or set FZF_TMUX 0
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
if [ -n "$FZF_TMUX_OPTS" ]
echo "fzf-tmux $FZF_TMUX_OPTS -- "
else if [ $FZF_TMUX -eq 1 ]
echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- "
else
echo "fzf"
end
end
bind \ct fzf-file-widget
bind \cr fzf-history-widget
bind \ec fzf-cd-widget
if bind -M insert > /dev/null 2>&1
bind -M insert \ct fzf-file-widget
bind -M insert --user \cr fzf-history-widget
bind -M insert \ec fzf-cd-widget
end
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
set -l commandline (commandline -t)
# strip -option= from token if present
set -l prefix (string match -r -- '^-[^\s=]+=' $commandline)
set commandline (string replace -- "$prefix" '' $commandline)
# eval is used to do shell expansion on paths
eval set commandline $commandline
if [ -z $commandline ]
# Default to current directory with no --query
set dir '.'
set fzf_query ''
else
set dir (__fzf_get_dir $commandline)
if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ]
# if $dir is "." but commandline is not a relative path, this means no file path found
set fzf_query $commandline
else
# Also remove trailing slash after dir, to "split" input properly
set fzf_query (string replace -r "^$dir/?" -- '' "$commandline")
end
end
echo $dir
echo $fzf_query
echo $prefix
end
function __fzf_get_dir -d 'Find the longest existing filepath from input string'
set dir $argv
# Strip all trailing slashes. Ignore if $dir is root dir (/)
if [ (string length -- $dir) -gt 1 ]
set dir (string replace -r '/*$' -- '' $dir)
end
# Iteratively check if dir exists and strip tail end of path
while [ ! -d "$dir" ]
# If path is absolute, this can keep going until ends up at /
# If path is relative, this can keep going until entire input is consumed, dirname returns "."
set dir (dirname -- "$dir")
end
echo $dir
end
end

2742
arch/git/.git-completion Normal file

File diff suppressed because it is too large Load diff

20
arch/git/.gitconfig Normal file
View file

@ -0,0 +1,20 @@
[user]
name = Adam Cooper
email = adam@theadamcooper.com
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
features = side-by-side line-numbers decorations
whitespace-error-style = 22 reverse
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
[init]
defaultBranch = main

51
arch/install.sh Executable file
View file

@ -0,0 +1,51 @@
#!/bin/bash
echo "Upgrading packages**"
sudo pacman -Syu
echo "**Installing packages: vim, tmux, python3, cmake, stow, fonts-powerline, snapd, etc.**"
sudo pacman -S --no-confirm git curl zsh gvim tmux python python-pip cmake stow lastpass-cli rust
echo "source $HOME/.cargo/env" >> ./zsh/.zshrc
echo "**Installing powerline and tmuxp**"
# pip3 install powerline-status
pip3 install --user tmuxp
echo "**Installing plug.vim**"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "**Installing diff-so-fancy**"
curl -fsSL -o ~/.local/bin/diff-so-fancy https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/third_party/build_fatpack/diff-so-fancy
sudo chmod 755 ~/.local/bin/diff-so-fancy
echo "**Backing up config files**"
[[ -f ~/.zshrc ]] && mv -v ~/.zshrc ~/.zshrc.bak
[[ -f ~/.vimrc ]] && mv -v ~/.vimrc ~/.vimrc.bak
[[ -f ~/.tmux.conf ]] && mv -v ~/.tmux.conf ~/.tmux.conf.bak
[[ -f ~/.git-completion ]] && mv -v ~/.git-completion ~/.git-completion.bak
[[ -f ~/.gitconfig ]] && mv -v ~/.gitconfig ~/.gitconfig.bak
[[ -f ~/.oysttyerrc ]] && mv -v ~/.oysttyerrc ~/.oysttyerrc.bak
[[ -f ~/.oysttyerkey ]] && mv -v ~/.oysttyerkey ~/.oysttyerkey.bak
[[ -f ~/.egrc ]] && mv -v ~/.egrc ~/.egrc.bak
[[ -f /usr/local/bin/consolidate-path ]] && mv -v /usr/local/bin/consolidate-path /usr/local/bin/consolidate-path.bak
echo "**Installing new config files**"
stow -t ~ zsh
stow -t ~ vim
stow -t ~ tmux
stow -t ~ git
stow -t ~ newsboat
stow -t ~ eg
stow -t ~ oysttyer
stow -t /usr/local/bin bin
# echo "**Installing ddgr**"
# pip3 install ddgr
echo "**Installing NVM**"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# echo "**Installing Yarn**"
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# sudo apt-get update && sudo apt-get install --no-install-recommends yarn
# echo "**Installing Oh My Zsh**"
# git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# echo "**Installing zsh-nvm**"
# git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
echo "**Switching to zsh**"
chsh -s /bin/zsh
echo "[TODO] **Download and install bat cb eg exa fd newsboat consolidate-path**"
echo "**Please restart the system and run ~/dotfiles/post-install.sh**"
/bin/zsh

View file

@ -0,0 +1,27 @@
bind-key G end
bind-key g home
bind-key j down
bind-key k up
browser "w3m %u"
# Color key https://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
# color22 green
# color199 magenta
# color255 light grey
color listfocus color255 color199
color listfocus_unread color255 color199 bold
color info color255 color22
color title color255 color22 bold
color hint-key color255 color22 bold
color hint-separator color255 color22 bold
confirm-exit yes
define-filter "nitter feeds" "tags !# \"nitter_personal\" and tags !# \"nitter_institutional\" and tags !# \"nitter_noise\""
feed-sort-order firsttag
keep-articles-days 45
max-items 4096
notify-program "/usr/bin/notify-send"
urls-source "ttrss"
ttrss-url "https://rss.theadamcooper.com/"
ttrss-login "adam"
ttrss-passwordeval "secret-tool lookup service ttrss"
ttrss-flag-star "s"
ttrss-flag-publish "p"

View file

@ -0,0 +1,4 @@
Guardian
pool
rss
deeplinks

View file

@ -0,0 +1,7 @@
"query:miscellany Articles:tags # \"miscellany\""
"query:nitter_personal Articles:tags # \"nitter_personal\""
"query:nitter_institutional Articles:tags # \"nitter_institutional\""
"query:nitter_noise Articles:tags # \"nitter_noise\""
"query:nuggets Articles:tags # \"nuggets\""
"query:release_notes Articles:tags # \"release_notes\""
"query:tech Articles:tags # \"tech\""

View file

@ -0,0 +1 @@
ck=X&cs=X&at=14814274-sTXAoAlc9gpgjRR451UsnG0ZLRodvDD6rfeOmJGHZ&ats=V8MtTSuNb5HKy1JGFC2q3T3DhdpfGbjdRKCCFeo0zc9Z8

11
arch/oysttyer/.oysttyerrc Normal file
View file

@ -0,0 +1,11 @@
# keyf=/Users/adamcooper/.oysttyerkey
oauthkey=17N3a4JBR8jJsbBBdwxfAqM5a
oauthsecret=pIuaI8sDqwMH7eqthVpqTAA1zY37pB3MY4EfrVFHnSLOpElg0T
ansi=1
separator= * * * * * * * * * * *
doublespace=1
vcheck=1
urlopen=surf-open.sh %U
synch=1
mentions=1
verify=1

16
arch/post-install.sh Executable file
View file

@ -0,0 +1,16 @@
# Post-install script
echo "**Installing Node and NPM with NVM**"
echo "source $HOME/.nvm/nvm.sh" >> ./zsh/.zshrc
stow -t ~ -R zsh
nvm install lts/dubnium
nvm use default
echo "**Installing Typescript**"
npm install -g typescript
echo "**Installing some essentials**"
sudo pacman -S bat cb fzf ripgrep
echo ""
echo "All that\'s left is the vim plugins. Install them by running:"
echo " $ vim -c \":PlugInstall\""
echo "and then compile YouCompleteMe: "
echo " $ python ~/.vim/plugged/YouCompleteMe/install.py --ts-completer --rust-completer"
echo "and you're off to the races."

82
arch/tmux/.tmux.conf Normal file
View file

@ -0,0 +1,82 @@
# 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_theme_snapshot" "source ~/.tmuxline_theme_snapshot"
# Start window numbering at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Change prefix to C-sp
unbind-key C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
# 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 oer by vim style pane navigation (not sure where this comes from or whether I still need it)
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
# The next line throws a syntax error.
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace cb"
# 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 cb"
# tmux-weather
run-shell /home/adam/code/tmux-weather/tmux-weather.tmux
# tmux-battery
run-shell /home/adam/code/tmux-battery/battery.tmux
# tmux-cpu
run-shell /home/adam/code/tmux-cpu/cpu.tmux
# tmux-protonvpn
run-shell /home/adam/code/tmux-protonvpn/protonvpn.tmux

View file

@ -0,0 +1,30 @@
# This tmux statusbar config was created by tmuxline.vim on Tue, 14 Jul 2020
# (and then tweaked later with weather, battery status, CPU stats)
set -g status-interval 5
set -g status-justify "left"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=colour52,bg=colour214"
set -g status-right-style "none"
set -g pane-active-border-style "fg=colour202"
set -g status-style "none,bg=colour228"
set -g message-style "fg=colour52,bg=colour214"
set -g pane-border-style "fg=colour214"
set -g status-right-length "100"
set -g status-left-length "100"
set-option -g @tmux-weather-location "Atlantic Beach, New York, United States"
set-option -g @tmux-weather-format "%c+%20+%t+%w"
set-option -g @tmux-weather-units "u"
set-option -g @batt_remain_short 'true'
set-option -g @protonvpn_disconnected_text "🖧 "
set-option -g @protonvpn_connecting_text "…"
set-option -g @protonvpn_connecting_fg_color "colour166"
set-option -g @protonvpn_connected_text "⚛️ "
setw -g window-status-activity-style "none"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=colour166,bg=colour228"
set -g status-left "#[fg=colour255,bg=colour202] #S #[fg=colour202,bg=colour228,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour166,bg=colour228,nobold,nounderscore,noitalics]#(pactl list sinks | grep Mute | sed -e 's/Mute: //' | sed -e 's/no/🔊/' | sed -e 's/yes/🔇/') #{protonvpn_status_color} #{protonvpn_status} #{cpu_fg_color}#{cpu_icon} #[fg=colour166] #{battery_status_bg} #{battery_icon} #{battery_percentage} #{battery_remain}  #{weather}  %m-%d %a %H:%M #[fg=colour202,bg=colour228,nobold,nounderscore,noitalics]#[fg=colour255,bg=colour202] #h "
setw -g window-status-format "#[fg=colour166,bg=colour228] #I #[fg=colour166,bg=colour228] #W "
setw -g window-status-current-format "#[fg=colour228,bg=colour214,nobold,nounderscore,noitalics]#[fg=colour52,bg=colour214] #I #[fg=colour52,bg=colour214] #W #F #[fg=colour214,bg=colour228,nobold,nounderscore,noitalics]"

View file

@ -0,0 +1,25 @@
{
"session_name": "acorn",
"windows": [{
"window_name": "ide",
"panes": [
"vim -R package.json",
"ls",
"git status"
],
"layout": "main-horizontal",
"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,8 @@
{
"session_name": "general",
"windows": [{
"panes": ["/etc/update-motd.d/90-custom"]
}],
"start_directory": "~"
}

View file

@ -0,0 +1,18 @@
{
"session_name": "morning",
"windows": [{
"window_name": "btm",
"panes": ["btm --color default-light"]
}, {
"window_name": "newsboat",
"panes": ["newsboat"]
}, {
"window_name": "ddgr",
"panes": ["ddgr --colors=ecdgxy 'Subcomandante Marcos'"]
}, {
"window_name": "general",
"panes": ["date"]
}],
"start_directory": "~"
}

105
arch/vim/.vimrc Normal file
View file

@ -0,0 +1,105 @@
" Make backspace behave in a sane manner.
set backspace=indent,eol,start
" Spaces indentation
set expandtab
set tabstop=2
" set softtabstop=2
set shiftwidth=2
" Consider installing the Smart Tabs plugin
" Show whitespace
set listchars=eol,tab:>-,trail:~,extends:>,precedes:<,space
" Show line numbers
set number
" Default: split right
set splitright
" Allow hidden buffers, don't limit to one file per window/split
set hidden
" Sane vim split naviagation (via Gaslight blog)
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" Disable filetype detection
filetype off
" Adjust cursor style to mode
" Normal: block; Insert: beam; Replace: underscore
" all blinking
let &t_EI = "\<Esc>[1 q"
let &t_SI = "\<Esc>[5 q"
let &t_SR = "\<Esc>[3 q"
" reset the cursor on start
augroup CursorReset
au!
autocmd VimEnter * silent !echo -ne "\e[2 q"
augroup END
" vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'edkolev/tmuxline.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'dense-analysis/ale'
Plug 'Valloric/YouCompleteMe'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'pangloss/vim-javascript'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'Quramy/tsuquyomi'
Plug 'rust-lang/rust.vim'
Plug 'neovimhaskell/haskell-vim'
Plug 'severij/vadelma'
Plug 'tpope/vim-surround'
call plug#end()
" Tsuquyomi
autocmd filetype typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
" Airline
let g:airline_powerline_fonts = 1
let g:airline_theme = 'light'
let g:airline#extensions#tmuxline#enabled = 0
" ALE
let g:ale_linters = {'haskell': ['hlint', 'hdevtools']}
" YouCompleteMe
noremap <F8> :YcmCompleter GoTo<CR>
" YouCompleteMe <> TypeScript
if !exists("g:ycm_semantic_triggers")
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers['typescript'] = ['.']
" Enable file type detection and do language-dependent indenting
filetype plugin indent on
" Switch syntax highlighting on
syntax enable
" Set color scheme
set background=light
colorscheme vadelma
" Temporary file locations
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.undo/,/tmp//

46
arch/xmobar/.xmobarrc Normal file
View file

@ -0,0 +1,46 @@
Config { overrideRedirect = False
, font = "xft:InconsolataGo Nerd Font Mono:size=8"
, additionalFonts = ["xft:JoyPixels:size=8"]
, bgColor = "#ffff99"
, fgColor = "#191970"
, position = TopW L 90
, commands = [ Run WeatherX "KLGA"
[ ("clear", "🌣")
, ("sunny", "🌣")
, ("mostly clear", "🌤")
, ("mostly sunny", "🌤")
, ("partly sunny", "⛅")
, ("fair", "🌑")
, ("cloudy","☁")
, ("overcast","☁")
, ("partly cloudy", "⛅")
, ("mostly cloudy", "🌧")
, ("considerable cloudiness", "⛈")]
[ "--template", "<skyConditionS> <tempF>°F"
, "-L", "0"
, "-H", "25"
, "--low" , "blue"
, "--normal", "#f8f8f2"
, "--high" , "red"
] 36000
, Run Cpu
[ "-L", "3"
, "-H", "50"
, "--high" , "red"
, "--normal", "darkgreen"
] 10
, Run Alsa "default" "Master"
[ "--template", "<volumestatus>"
, "--suffix" , "True"
, "--"
, "--on", ""
]
, Run Memory ["--template", "Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Date "%a %Y-%m-%d <fc=#191970>%H:%M</fc>" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %alsa:default:Master% | %cpu% | %memory% * %swap% | %KLGA% | %date% "
}

14
arch/xmonad/autostart.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
/usr/sbin/keepassxc &
sleep 16
# /usr/sbin/qutebrowser --restore home & sleep 5 && sh -c "wmctrl -r qutebrowser -t 2"
/usr/sbin/qutebrowser & sleep 5 && sh -c "wmctrl -r qutebrowser -t 2"
/usr/sbin/xterm -fa 'Fantasque Sans Mono:size=8' -e btm --battery --color gruvbox-light & sleep 5 && sh -c "wmctrl -r btm -t 1"
# /usr/sbin/xterm -e newsboat & sleep 5 && sh -c "wmctrl -r newsboat -t 4"
# /usr/sbin/xterm -e joplin & sleep 5 && sh -c "wmctrl -r joplin -t 5"
/usr/sbin/cbatticon &
/usr/sbin/nextcloud &
/usr/sbin/xterm -e neomutt & sleep 5 && sh -c "wmctrl -r neomutt -t 3"
# /usr/sbin/xterm -e aerc & sleep 5 && sh -c "wmctrl -r aerc -t 3"

42
arch/xmonad/xmonad.hs Normal file
View file

@ -0,0 +1,42 @@
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.Ungrab
main :: IO ()
main = xmonad
. ewmh
=<< statusBar "xmobar" myXmobarPP toggleStrutsKey myConfig
where
toggleStrutsKey :: XConfig Layout -> (KeyMask, KeySym)
toggleStrutsKey XConfig{ modMask = m } = (m, xK_b)
myConfig = def
{ borderWidth = 4
, terminal = "xterm"
, modMask = mod4Mask
, focusedBorderColor = "#ff00ff"
}
myXmobarPP :: PP
myXmobarPP = def
{ ppSep = magenta ""
, ppTitle = shorten 32
, ppTitleSanitize = xmobarStrip
, ppCurrent = wrap (mediumblue "[") (mediumblue "]")
, ppHidden = midnightblue . wrap " " ""
, ppHiddenNoWindows = teal . wrap " " ""
, ppUrgent = red . wrap (red "!") (red "!")
}
where
midnightblue, mediumblue, magenta, red, white, yellow, teal :: String -> String
midnightblue = xmobarColor "#191970" ""
mediumblue = xmobarColor "#0000cd" ""
magenta = xmobarColor "#ff79c6" ""
white = xmobarColor "#f8f8f2" ""
yellow = xmobarColor "#f1fa8c" ""
red = xmobarColor "#ff5555" ""
teal = xmobarColor "#008080" ""

53
arch/zsh/.zsh/_keep Normal file
View file

@ -0,0 +1,53 @@
#compdef _keep keep
function _keep {
local -a commands
_arguments -C \
"-v[Enables verbose mode]:" \
"--verbose[Enables verbose mode]:" \
"--help[Show the help message and exit]:" \
"1: :->cmnds" \
"*::arg:->args"
case $state in
cmnds)
commands=(
"edit:Edit a saved command."
"github_token:Register a GitHub Token to use GitHub Gists as a backup."
"grep:Searches for a saved command."
"init:Initializes the CLI."
"list:Shows the saved commands."
"new:Saves a new command."
"pull:Pull commands from saved GitHub gist."
"push:Push commands to a secret GitHub gist."
"rm:Deletes a saved command."
"run:Executes a saved command."
"update:Check for an update of Keep."
)
_describe "command" commands
;;
esac
case "$words[1]" in
edit)
_keep_edit
;;
rm)
_keep_commands
;;
run)
_keep_commands
;;
esac
}
function _keep_edit {
_arguments \
"--editor[Editor to use]"
}
function _keep_commands {
local -a commands
commands=("${(@f)$(keep completion --zsh)}")
_describe "command" commands
}

49
arch/zsh/.zshenv Normal file
View file

@ -0,0 +1,49 @@
## XDG
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.config/local/share"
export XDG_CACHE_HOME="$HOME/.config/cache"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export HISTSIZE=9998
export SAVEHIST=10000
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.cargo/env:$HOME/code/go/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.rbenv:$PATH"
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
export EDITOR="vim"
export VISUAL="vim"
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# FZF
export FZF_DEFAULT_COMMAND="fd --no-ignore --hidden --type f" # Includes hidden files
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# bat theme
export BAT_THEME=OneHalfLight
# exa colors
export LS_COLORS="rs=0:fi=35:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*.md=36"
# ddgr
export BROWSER=w3m
export DDGR_COLORS="MBdexy"
# navi
export NAVI_TAG_COLOR=6
export NAVI_COMMENT_COLOR=3
# Consolidate PATH
export PATH="$(consolidate-path "$PATH")"

132
arch/zsh/.zshrc Normal file
View file

@ -0,0 +1,132 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
HISTFILE=$ZDOTDIR/.zsh_history
# terminal colors
export COLORTERM=24bit
# Setting some opts
# setopt correct_all
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt share_history # share command history data
setopt long_list_jobs
setopt interactivecomments
# Initialize the completion system
# fpath=(~/config/zsh/.zsh $fpath)
autoload -U compinit ; compinit
## Vi keybindings for the shell ##
bindkey -v
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
## History navigation by search pattern
autoload history-search-end
zle -N history-beginning-search-backward-end \
history-search-end
zle -N history-beginning-search-forward-end \
history-search-end
bindkey '^[[A' history-beginning-search-backward-end
bindkey '^[[B' history-beginning-search-forward-end
## Aliases
source ~/.config/zsh/aliases.zsh
source ~/.config/zsh/completion.zsh
source ~/.config/zsh/termsupport.zsh
source ~/.config/zsh/theme-and-appearance.zsh
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Add pwd to history
# This version should strip any existing pwd from the command before adding the
# current pwd. This eliminates the pileup of these pwd comments when reusing
# old commands (e.g., with up-arrow).
function zshaddhistory() {
history_item="${${1%%$'\n'}%%$' ###'*} ### ${PWD}"
print -sr ${(z)history_item}
fc -p
return 1
}
# Starship
eval "$(starship init zsh)"
## FZF ##
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source ~/.vim/plugged/fzf/shell/completion.zsh
source ~/.vim/plugged/fzf/shell/key-bindings.zsh
# Use fd (https://github.com/sharkdp/fd) instead of the default find
# command for listing path candidates.
# - The first argument to the function ($1) is the base path to start traversal
# - See the source code (completion.{bash,zsh}) for the details.
_fzf_compgen_path() {
fd --no-ignore --hidden --follow --exclude ".git" . "$1"
}
# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
fd --no-ignore --type d --hidden --follow --exclude ".git" . "$1"
}
# Block and beam cursors for vim mode
cursor_mode() {
# See https://ttssh2.osdn.jp/manual/4/en/usage/tips/vim.html for cursor shapes
cursor_block='\e[2 q'
cursor_beam='\e[6 q'
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne $cursor_block
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne $cursor_beam
fi
}
zle-line-init() {
echo -ne $cursor_beam
}
zle -N zle-keymap-select
zle -N zle-line-init
}
cursor_mode
## zoxide ##
eval "$(zoxide init zsh)"
# navi #
eval "$(navi widget zsh)"
# tmuxp completion
eval "$(_TMUXP_COMPLETE=source_zsh tmuxp)"
source /home/adam/.cargo/env
source /usr/share/nvm/init-nvm.sh
# rbenv
eval "$(rbenv init -)"
# broot
source /home/adam/.config/broot/launcher/bash/br
# tea
PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/adam/.config/tea/autocomplete.zsh"

2
arch/zsh/aliases.zsh Normal file
View file

@ -0,0 +1,2 @@
alias exi='exa --icons --group -al'
alias qb='QT_SCALE_FACTOR=1.5 /usr/bin/qutebrowser &'

75
arch/zsh/completion.zsh Normal file
View file

@ -0,0 +1,75 @@
# fixme - the load process here seems a bit bizarre
zmodload -i zsh/complist
WORDCHARS=''
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu # show completion menu on successive tab press
setopt complete_in_word
setopt always_to_end
# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu select
# case insensitive (all), partial-word and substring completion
if [[ "$CASE_SENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
else
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
fi
fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
if [[ "$OSTYPE" = solaris* ]]; then
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm"
else
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm -w -w"
fi
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' cache-path $ZSH_CACHE_DIR
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
usbmux uucp vcsa wwwrun xfs '_*'
# ... unless we really want to.
zstyle '*' single-ignored show
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
expand-or-complete-with-dots() {
print -Pn "%F{red}…%f"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
# Set the function as the default tab completion widget
bindkey -M emacs "^I" expand-or-complete-with-dots
bindkey -M viins "^I" expand-or-complete-with-dots
bindkey -M vicmd "^I" expand-or-complete-with-dots
fi
# automatically load bash completion functions
autoload -U +X bashcompinit && bashcompinit

137
arch/zsh/termsupport.zsh Normal file
View file

@ -0,0 +1,137 @@
# Set terminal window and tab/icon title
#
# usage: title short_tab_title [long_window_title]
#
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen, iterm, and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title {
emulate -L zsh
setopt prompt_subst
[[ "$INSIDE_EMACS" == *term* ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
: ${2=$1}
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*)
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
;;
screen*|tmux*)
print -Pn "\ek${1:q}\e\\" # set screen hardstatus
;;
*)
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
else
# Try to use terminfo to set the title
# If the feature is available set title
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
echoti tsl
print -Pn "$1"
echoti fsl
fi
fi
;;
esac
}
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
# Avoid duplication of directory in terminals with independent dir display
if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
fi
# Runs before showing the prompt
function omz_termsupport_precmd {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh
setopt extended_glob
# split command into array of arguments
local -a cmdargs
cmdargs=("${(z)2}")
# if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in
<->) # %number argument:
# use the same <number> passed as an argument
job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument:
# use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac
# override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}"
fi
fi
# cmd name only, or if this is sudo or ssh, the next cmd
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
local LINE="${2:gs/%/%%}"
title '$CMD' '%100>...>$LINE%<<'
}
autoload -U add-zsh-hook
add-zsh-hook precmd omz_termsupport_precmd
add-zsh-hook preexec omz_termsupport_preexec
# Keep Apple Terminal.app's current working directory updated
# Based on this answer: https://superuser.com/a/315029
# With extra fixes to handle multibyte chars and non-UTF-8 locales
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
# Emits the control sequence to notify Terminal.app of the cwd
# Identifies the directory using a file: URI scheme, including
# the host name to disambiguate local vs. remote paths.
function update_terminalapp_cwd() {
emulate -L zsh
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
add-zsh-hook precmd update_terminalapp_cwd
# Run once to get initial cwd set
update_terminalapp_cwd
fi

View file

@ -0,0 +1,55 @@
# ls colors
autoload -U colors && colors
# Enable ls colors
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# TODO organise this chaotic logic
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
# Find the option for using colors in ls, depending on the version
if [[ "$OSTYPE" == netbsd* ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
elif [[ "$OSTYPE" == openbsd* ]]; then
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
# with color and multibyte support) are available from ports. "colorls"
# will be installed on purpose and can't be pulled in by installing
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null && alias ls='colorls -G'
elif [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
# this is a good alias, it works by default just using $LSCOLORS
ls -G . &>/dev/null && alias ls='ls -G'
# only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
# otherwise, gls will use the default color scheme which is ugly af
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
else
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
if [[ -z "$LS_COLORS" ]]; then
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
fi
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi
fi
# enable diff color if possible.
if command diff --color . . &>/dev/null; then
alias diff='diff --color'
fi
# GTK3 scaling
# These variables used to be set. Not sure why I unset them. They fix text and
# icon sizes on the HiDPI monitor.
export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
setopt auto_cd
setopt multios
setopt prompt_subst

21
m/README.md Normal file
View file

@ -0,0 +1,21 @@
- FIXED The both method of installing fzf has left me without the `:Files` func-
tionality.
- FIXED diff-so-fancy
- FIXED What's really not working is nvm. If you install it with bash, zsh can't see
it.
- add source $HOME/.cargo/env - does this persist or must I add it to .zshrc?
- chsh not working?
- N.B. .bashrc Linux, .bash_profile Mac
- FIXED After the install script runs, the user needs to install the vim plugins by
opening vim and running :PlugInstall - how do you get the pid of the latest
process or a particular process?
- FIXED tmux powerline doesn't work out of the box
- FIXED? nvm - not working right? Time to add the filigree!
- FIXED Maybe we need a post-install script for nvm install lts/dubnium and nvm
use lts/dubnium, and then npm install -g typescript, and then exhort the user
to run vim and ycm.
- FIXED make aptitude install vim et al automatically accept without user input
- FIXED same with rust
- FIXED do existence tests before mv

13
m/bin/consolidate-path Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# Usage: PATH="$(consolidate-path "$PATH")"
#
# Remove duplicate entries from PATH.
result=":"
IFS=:
for p in $1; do
[[ "$result" == *:"$p":* ]] || result="${result}${p}:"
done
result="${result#:}"
echo "${result%:}"

61
m/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
m/eg/.eg_custom/ack.md Normal file
View file

75
m/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
m/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
m/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
m/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
m/eg/.eg_custom/grep.md Normal file
View file

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

11
m/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
m/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
m/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

Some files were not shown because too many files have changed in this diff Show more