reset git history

This commit is contained in:
Noah Masur
2020-06-03 08:31:58 -06:00
commit a368fda34d
37 changed files with 8031 additions and 0 deletions

86
zsh/aliases Normal file
View File

@ -0,0 +1,86 @@
# ls aliases
alias ls='exa'
alias ll='ls -alhF'
alias la='ls -A'
alias l='ls -CFA'
alias lh='ls -l'
# alias lh='ls -lhtraF'
# Old aliases
alias inv='source ~/.venv/inventorybot/bin/activate'
alias awscli='source ~/.venv/aws/bin/activate'
alias gstory='source ~/.venv/gstory/bin/activate'
alias stu='source ~/.venv/stupid/bin/activate'
alias r='/projects/device42/run'
alias qu='/projects/device42/utils/quickupdate-noah'
alias qudb='/projects/device42/utils/debug-noah'
alias dlog='/projects/device42/logwatch.sh'
alias hlog='/projects/soc-utils/Hive_Bot/utils/logwatch.sh'
alias bot='cd /projects/device42/inventorybot'
alias tap='terraform apply'
alias mod='cd /projects/terraform/modules'
alias hs='cd /projects/soc-utils/Hive_Scripts'
alias esc='cd /projects/soc-utils/Hive_Responders/Escalator'
# Emacs
emacsenv='~/Documents/GitHub/dotfiles/bin/emacs_env'
# Improved CLI Tools
alias ping='prettyping --nolegend'
alias cat='bat'
alias icat='$PROJ/dotfiles/iterm/imgcat'
alias h='http -Fh --all'
alias search='googler -j'
alias checkip='curl checkip.amazonaws.com'
# Dotfile and config shortcuts
alias aliases='edit $DOTS/zsh/aliases'
alias zenv='edit $DOTS/zsh/env'
alias zrc='edit $DOTS/zsh/zrcsh.symlink'
alias reload='source ~/.zshrc'
alias runbootstrap='$DOTS/scripts/bootstrap'
alias sshc='edit ~/.ssh/config'
alias hosts='edit /etc/hosts'
# Navigation shortcuts
alias dots='cd $DOTS'
alias org='cd ~/Dropbox\ \(Take-Two\)/org'
alias proj='cd $PROJ'
alias tpt='cd $PROJ/thirdpartytrust'
alias hv='cd $PROJ/soc-utils/Hive_Bot/hivebot'
alias tf='cd $TFDIR'
alias gs='cd $TFDIR/projects/ghoststory'
alias pd='cd $TFDIR/projects/privatedivision'
alias t2='cd $TFDIR/projects/take2games'
alias kb='cd $TFDIR/projects/kerbalspaceprogram'
alias di='cd $TFDIR/projects/disintegration'
alias slack='cd $PROJ/slack'
alias misty='cd $PROJ/misty'
alias dl='cd ~/Downloads'
alias ssl='echo openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr'
# Virtualenv
alias d='deactivate'
alias pv='cd $WORKON_HOME'
alias ip='source $WORKON_HOME/ipython/bin/activate'
alias tp='source $WORKON_HOME/thirdpartytrust/bin/activate'
alias hive='source $WORKON_HOME/hivebot/bin/activate'
# Docker
alias dc='$DOTS/bin/docker_cleanup'
alias dr='docker run'
alias db='docker build . -t'
alias connect='docker run --rm -v ~/.aws:/root/.aws -v ~/.ssh:/root/.ssh -it connect-aws'
# Python
alias py='python'
alias domisty='cd $PROJ/misty && ./buildrun.sh'
# Rust
alias ca='cargo'
# Non-MacOS
if [ $(uname) = "Linux" ]; then
alias pbcopy='xclip -selection clipboard -in'
alias pbpaste='xclip -selection clipboard -out'
fi

105
zsh/functions Normal file
View File

@ -0,0 +1,105 @@
# Open in Emacs
edit() {
emacsclient --no-wait --alternate-editor="emacs" "$@" &> /dev/null & disown
}
# Create QR code from link
qr() { qrencode "$1" -t ANSIUTF8 -o -; }
# Open directory in projects
prj() {
local projdir
projdir=$(ls $PROJ | fzf)
if [[ -z $projdir ]]
then
return 1
else
cd $projdir
fi
}
# Activate pyenv virtualenv
venv() {
source ~/.pyenv/versions/$1/bin/activate
}
# Temporarily enter iPython interpreter with its Pyenv
ipy() {
STORED_VENV=$VIRTUAL_ENV
source $WORKON_HOME/ipython/bin/activate && \
ipython && \
deactivate && \
if [ $STORED_VENV ]; then
source $STORED_VENV/bin/activate
fi
}
# Run pylint on all python files
lint() {
fd -IH -t f .py$ | xargs pylint
}
# Stolen from: https://github.com/davidpdrsn/dotfiles/blob/master/zsh/functions
# Extract archives
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# fe [FUZZY PATTERN] - Open the selected file with the default editor
# - Bypass fuzzy finder if there's only one match (--select-1)
# - Exit if there's no match (--exit-0)
fe() {
local file
file=$(fzf --query="$1" --select-1 --exit-0)
[ -n "$file" ] && ${EDITOR:-vim} "$file"
}
# fd - cd to selected directory
fcd() {
local dir
dir=$(find ${1:-*} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}
# dir - fd name of dir in this directory
dir() {
# fd ".*$1.*" -H -d 1
ls -lha | rg "$1"
}
# vers - switch to pyenv virtualenv with fuzzy menu
vers() {
local version
version=$(pyenv versions --bare --skip-aliases | fzf)
if [[ -z $version ]]
then
return 1
else
source $WORKON_HOME/$version/bin/activate
fi
}
# unsetaws - remove all AWS environment variables
unsetaws() {
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
}

107
zsh/ohmyzsh Normal file
View File

@ -0,0 +1,107 @@
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="remy"
# ZSH_THEME="agnoster"
# ZSH_THEME="typewritten"
ZSH_THEME="nicoulaj"
# Removes the prompt when encountering a .env file
ZSH_DOTENV_PROMPT=false
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# 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.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=~/.zsh/custom
# Which plugins would you like to load?
# Standard 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=(
ripgrep
docker
dotenv
osx
cargo
gem
)
source $ZSH/oh-my-zsh.sh
# User configuration
# 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
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Auto-Suggestions
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=6,bg=6"
export ZSH_AUTOSUGGEST_STRATEGY=(completion history)
bindkey '^ ' autosuggest-accept
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

18
zsh/vim Normal file
View File

@ -0,0 +1,18 @@
### Activate vi / vim mode:
bindkey -v
# Remove delay when entering normal mode (vi)
KEYTIMEOUT=5
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ $KEYMAP == vicmd ]] || [[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ $KEYMAP == main ]] || [[ $KEYMAP == viins ]] || [[ $KEYMAP = '' ]] || [[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
# Start with beam shape cursor on zsh startup and after every command.
zle-line-init() { zle-keymap-select 'beam'}

12
zsh/zshrc.symlink Normal file
View File

@ -0,0 +1,12 @@
DOTFILE=`readlink ~/.zshrc`
export DOTS=`dirname "$(dirname $DOTFILE)"`
source $DOTS/zsh/env
source $DOTS/zsh/ohmyzsh
source $DOTS/zsh/aliases
source $DOTS/zsh/functions
source $DOTS/zsh/vim
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source ~/.iterm2_shell_integration.zsh