Last active
March 1, 2019 11:36
-
-
Save foxleigh81/f7eba29f9ebb6a8292de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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="agnoster" | |
# Example aliases | |
alias ohmyzsh="code ~/.oh-my-zsh" | |
alias zshreload="source ~/.zshrc" | |
# 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. | |
# DISABLE_AUTO_TITLE="true" | |
# Uncomment the following line to disable command auto-correction. | |
# DISABLE_CORRECTION="true" | |
# Uncomment the following line to display red dots whilst waiting for completion. | |
COMPLETION_WAITING_DOTS="true" | |
fpath=(/usr/local/share/zsh-completions $fpath) | |
# 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="mm/dd/yyyy" | |
# 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) | |
# 'Branch' can be found here https://github.com/marioizquierdo/git-branch-zsh-command | |
plugins=(git branch osx npm npm nvm vscode zsh-wakatime) | |
source $ZSH/oh-my-zsh.sh | |
# User configuration | |
export PATH=$HOME/bin:/usr/local/bin:$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='nano' | |
else | |
export EDITOR='nano' | |
fi | |
# Hass cli vars | |
export HASS_SERVER=http://arctic.foxnet:8123 | |
export HASS_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJiMDQ2NWQxMGEyNzA0MzQ2OThhZjljNDc2YWEyMmY2NSIsImlhdCI6MTU1MDY4MjI5NiwiZXhwIjoxODY2MDQyMjk2fQ.KeEDbXiJ_A9L1QfOwxk6FsuO3HI1v-h5T2uGNrdi2oE | |
# Compilation flags | |
# export ARCHFLAGS="-arch x86_64" | |
# ssh | |
# export SSH_KEY_PATH="~/.ssh/dsa_id" | |
# Add path to openSSL | |
# export PATH="/usr/local/opt/openssl/bin:$PATH" | |
# ------------------------------------------------------------------- | |
# Git aliases | |
# ------------------------------------------------------------------- | |
alias ga='git add' | |
alias gaa='git add --all' | |
alias gp='git push' | |
alias gl='git pull' | |
alias glp='git pull && git push' | |
alias gs='git status' | |
alias gd='git diff' | |
alias gcmsg='git commit -m' | |
alias gmcsg='gcmsg' | |
alias gma='git commit -am' | |
alias gb='git branch' | |
alias gpb='git push --set-upstream origin `git symbolic-ref --short HEAD`' | |
alias gc='git commit' | |
alias gra='git remote add' | |
alias grr='git remote rm' | |
alias gcl='git clone' | |
alias gta='git tag -a -m' | |
alias gf='git reflog' | |
alias gdb='git branch -d' | |
alias gco='git fetch && git checkout' | |
alias gsync='git fetch -p' | |
# ------------------------------------------------------------------- | |
# Other aliases | |
# ------------------------------------------------------------------- | |
alias sudo='nocorrect sudo ' | |
alias dev='cd ~/Dev' | |
alias cd..='cd ..' | |
alias cat='pygmentize -g -O style=colorful,linenos=1' | |
# Project Aliases and shell functions | |
# Run docker processes using docker-compose | |
dcs() { | |
if [[ $@ == "up" ]]; then | |
# Start a production version | |
command docker-compose up | |
elif [[ $@ == "up -dev" ]]; then | |
# Start a development version | |
command docker-compose -f docker-compose-dev.yml up | |
elif [[ $@ == "down" ]]; then | |
# Destroy active image | |
command docker-compose down | |
elif [[ $@ == "purge" ]]; then | |
# Destroy ALL active image and container | |
# (Careful, this wipes every docker container/image on your machine) | |
command docker-compose down && docker rmi $(docker images -q) | |
else | |
command echo "'site' requires a parameter of 'up', 'down' or 'purge'" | |
fi | |
} | |
# Switches to common config locations | |
config() { | |
if [[ $@ == "zsh" ]]; then | |
# configure ZSH | |
command code ~/.zshrc | |
elif [[ $@ == "ha" ]]; then | |
# configure home assistant | |
dir=/Volumes/share/foxnet_config/homeassistant | |
command code $dir && cd $dir | |
elif [[ $@ == "arctic" ]]; then | |
# configure arctic configs | |
dir=/Volumes/share/foxnet_config | |
command code $dir && cd $dir | |
fi | |
} | |
# Copies the contents of the current directory into the parent | |
# directory and then deletes the current directory | |
unwrap() { | |
THISDIR=`basename $PWD` | |
if [ -z "$(ls -A)" ]; then | |
echo "No files to unwrap." | |
else | |
cp -r * ../ | |
fi | |
echo "Removing directory" | |
cd .. | |
rm -rf $THISDIR | |
} | |
up() { | |
if [[ $@ == 1 ]]; then | |
# Go up one folder (cd ..) | |
cd .. | |
elif [[ $@ == 2 ]]; then | |
# Go up two folders (cd ../..) | |
cd ../.. | |
elif [[ $@ == 3 ]]; then | |
# Go up three folders (cd ../../..) | |
cd ../../.. | |
else | |
echo "'Up' requires a parameter of 1,2 or 3" | |
fi | |
} | |
rnrepo() { | |
command git config user.name "98dfsj" | |
command git config user.email "98dfsj@royalnavy.io" | |
} | |
# Administer foxnet servers and containers | |
foxnet() { | |
if [[ $2 == 'x' ]]; then | |
# SSH into server and then docker exec into container | |
command ssh -tt foxleigh81@${1}.foxnet docker exec -it ${3} /bin/bash | |
elif [[ $2 == 'list' ]]; then | |
# SSH into server and then list all docker containers | |
command ssh -tt foxleigh81@${1}.foxnet docker container ls --format '\table{{.Names}}\\t{{.Status}}\\t{{.Ports}}' | |
else | |
# SSH Directly into server | |
command ssh -tt foxleigh81@${1}.foxnet | |
fi | |
} | |
# TODO: Set correct ports based on IPs and port forwarding and fix parse error | |
# Administer foxnet servers and containers | |
# remote-foxnet() { | |
# if [[ $2 == 'x' ]]; then | |
# # SSH into server and then docker exec into container | |
# if [[ $1 == 'arctic']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 1000 docker exec -it ${3} /bin/bash | |
# elif [[ $1 == 'fennec']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 2000 docker exec -it ${3} /bin/bash | |
# fi | |
# elif [[ $2 == 'list' ]]; then | |
# # SSH into server and then list all docker containers | |
# if [[ $1 == 'arctic']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 1000 docker container ls --format '\table{{.Names}}\\t{{.Status}}\\t{{.Ports}}' | |
# elif [[ $1 == 'fennec']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 2000 docker container ls --format '\table{{.Names}}\\t{{.Status}}\\t{{.Ports}}' | |
# fi | |
# else | |
# # SSH Directly into server | |
# if [[ $1 == 'arctic']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 1000 | |
# elif [[ $1 == 'fennec']]; then | |
# command ssh -tt foxleigh81@home.foxleigh.me -p 2000 | |
# fi | |
# fi | |
# } | |
alias nelson='cd ~/Dev/nelson && ls' | |
alias ccp='cd ~/Dev/nelson/royalnavy.io' | |
alias cpp='cd ~/Dev/blog.foxleigh.me' | |
# tabtab source for electron-forge package | |
# uninstall by removing these lines or running `tabtab uninstall electron-forge` | |
[[ -f /Users/alex/.config/yarn/global/node_modules/tabtab/.completions/electron-forge.zsh ]] && . /Users/alex/.config/yarn/global/node_modules/tabtab/.completions/electron-forge.zsh | |
export NVM_DIR="/Users/alex/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
alias arctic='foxnet arctic' | |
alias fennec='foxnet fennec' | |
alias kit='foxnet kit' | |
# Smarthome commands | |
alias lights='hass-cli service call homeassistant.toggle --arguments entity_id=group.AlexOfficeLights' | |
alias music='hass-cli service call media_player.media_play_pause --arguments entity_id=media_player.spotify'el9k/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment