Compare commits

...

26 Commits

Author SHA1 Message Date
Marcus Noble
0bacc63a5c Removed k9s cluster details 2021-07-02 06:31:56 +01:00
Marcus Noble
0bbded8b58 Added rustup 2021-07-01 07:14:11 +01:00
2cd75934ac Updated installed cli tools and aliases 2021-06-27 17:27:40 +01:00
a6b8d2b29e Updated 2021-06-08 08:55:29 +01:00
Marcus Noble
072aeb4c42 Changed default git branch 2021-06-08 08:53:38 +01:00
Marcus Noble
8fd8077ba1 Fixed changelog-changed for non-master 2021-06-07 15:11:10 +01:00
ff544ee43e added git-clone alias 2021-05-16 12:01:32 +01:00
Marcus Noble
b171074349 Updated k9s config / skin 2021-05-14 05:50:31 +01:00
Marcus Noble
18a78386a4 Fixed k9s linking 2021-05-14 05:38:41 +01:00
Marcus Noble
13a55a8b7a Updated some starship and added doggo alias 2021-05-13 14:18:57 +01:00
Marcus Noble
299f345a54 Updated starship config 2021-05-10 11:21:26 +01:00
Marcus Noble
d92841b3f4 Handle git email 2020-12-07 07:07:54 +00:00
dcaf6f8b17 Added make task to upgrade deps 2020-12-07 06:39:28 +00:00
fda40a53cd Always use ssh for GitHub 2020-12-07 06:39:16 +00:00
6a035990da Remove prefix 2020-12-06 13:20:26 +00:00
b40d7e7a6a Merge branch 'master' of https://git.cluster.fun/AverageMarcus/dotfiles into master 2020-11-25 17:25:11 +00:00
23353843a1 Fix AWS 2020-11-25 17:24:16 +00:00
74b4c585c2 Avoid using exa my mistake 2020-11-25 17:24:10 +00:00
929cdf0f25 Update '.config/starship.toml' 2020-11-20 08:02:29 +00:00
Marcus Noble
4f582027f3
Fix typo in pre-req task 2020-10-13 14:18:12 +01:00
Marcus Noble
868de6144f
fix assume role 2020-10-13 10:44:32 +01:00
Marcus Noble
a66272c2db
Added aws-specific helpers 2020-10-13 10:18:20 +01:00
3e41fe0705 Support additional dotfiles 2020-10-03 08:27:31 +01:00
567910bdb6 Update dotfiles 2020-09-27 19:58:44 +01:00
93f499d34b Add '.k9s/skin.yml' 2020-09-17 02:17:53 +00:00
ea8321b336 Add '.k9s/config.yml' 2020-09-17 02:17:36 +00:00
11 changed files with 338 additions and 52 deletions

View File

@ -1,32 +1,70 @@
prompt_order=["directory","git_branch","git_commit","git_state","git_status","package","golang","nodejs","terraform","memory_usage","aws","kubernetes","cmd_duration","custom","line_break","jobs","battery","time","character"]
format = """\
$status\
$cmd_duration\
$line_break\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$aws\
$kubernetes\
$helm\
$golang\
$nodejs\
$terraform\
$package\
$custom\
$line_break\
$jobs\
$time\
$character\
"""
command_timeout = 1000
add_newline = true
[character]
symbol = "⚡️ "
error_symbol = "✗ "
use_symbol_for_status = true
style_success = "yellow"
success_symbol = "[✨](yellow)"
error_symbol = "[✗](red)"
[aws]
symbol = " "
displayed_items = "profile"
[docker]
symbol = " "
format = "[$symbol$profile]($style) "
[git_commit]
only_detached = true
prefix = "(#"
[golang]
symbol = " "
format = "[$symbol$version]($style) "
[kubernetes]
format = '[$symbol$context \($namespace\)]($style) '
symbol = "ﴱ "
style = "bold blue"
disabled = false
[terraform]
show_version = true
format = "[$symbol$version]($style) "
[nodejs]
symbol = " "
[status]
style = "red"
symbol = "✗"
format = '[↪ \[$symbol $common_meaning$signal_name$maybe_int\]]($style)'
map_symbol = true
disabled = false
[helm]
format = "[$symbol$version]($style) "
symbol = " "
[cmd_duration]
format = " took [$duration]($style) "
[package]
symbol = "📦"
format = "[$symbol$version]($style) "

View File

@ -1,21 +1,45 @@
# Rename existing tools
alias _cat=`which cat`
alias _curl=`which curl`
alias _ls="/bin/ls"
alias _grep="/bin/grep"
alias _diff=`which diff`
alias _du=`which du`
alias _df=`which df`
alias _find=`which find`
alias _top=`which top`
alias _ps="/bin/ps"
alias _dig=`which dig`
# Aliases
alias grep='grep --color=auto'
alias watch='watch '
alias cat=' bat '
alias curl='curlie'
alias ls=' exa --group-directories-first --icons --header --git --ignore-glob=.git'
alias grep='rg'
alias diff='delta'
alias du='dust'
alias df='duf -hide special'
alias find='fd'
alias bandwhich='sudo bandwhich'
alias top='btm'
alias ps='procs'
alias dig='dog'
alias machine-info='macchina -t Boron --bar'
alias watch='watch '
alias tmp='cd $(mktemp -d)'
alias ls=' exa --group-directories-first --header --git'
lt() {
DEPTH=$(echo $1 | grep "^[0-9]*$")
if [ "$DEPTH" = "" ]
then
if [ "$DEPTH" = "" ]; then
DEPTH=2
else
shift
fi
ls --tree -L $DEPTH -I "cache|log|logs|node_modules|vendor" $@
ls -l --tree -L $DEPTH -I ".git|cache|log|logs|node_modules|vendor" $@
}
alias aws='docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws -e AWS_PROFILE -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY amazon/aws-cli'
alias aws='docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws -e AWS_PROFILE -e AWS_DEFAULT_REGION -e AWS_REGION amazon/aws-cli'
git-clone() {
git clone $1
cd "$(basename "$1" .git)"
}

24
.dotfiles/aws Normal file
View File

@ -0,0 +1,24 @@
alias aws='docker pull -q amazon/aws-cli:latest 1> /dev/null && docker run --rm -i -v ~/.aws:/root/.aws -v $(pwd):/aws -e NO_COLOR=true -e AWS_PROFILE -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN amazon/aws-cli'
assume-role() {
ROLE=$1
if [[ -z "$ROLE" ]]; then
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_SESSION_TOKEN=
else
OUTPUT=$(aws sts assume-role --role-arn $ROLE --role-session-name assumed-role-session --query Credentials --output json)
export AWS_ACCESS_KEY_ID=$(echo $OUTPUT | jq -r .AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $OUTPUT | jq -r .SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $OUTPUT | jq -r .SessionToken)
fi
aws sts get-caller-identity
}
aws-decode-message() {
ENCODED=$1
aws sts decode-authorization-message --query DecodedMessage --output text --encoded-message $ENCODED | jq -r '.context.action, .context.resource'
}

View File

@ -1,11 +1,13 @@
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/goworkspace/bin"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/goworkspace/bin:$HOME/.cargo/bin"
export EDITOR='vim'
export VISUAL='code'
# AWS
export AWS_PROFILE=$(cat ~/.aws/profile)
export AWS_DEFAULT_REGION=eu-west-1
export AWS_REGION=eu-west-1
if [ -f ~/.aws/profile ]; then
export AWS_PROFILE=$(cat ~/.aws/profile)
export AWS_DEFAULT_REGION=eu-west-1
export AWS_REGION=eu-west-1
fi
# Node
export NODE_ENV=localhost
@ -17,3 +19,6 @@ export GO111MODULE=on
# Krew
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# Starship
export STARSHIP_LOG=error

View File

@ -73,7 +73,7 @@ source <(kubectl completion zsh)
## Merge multiple kubeconfigs
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
KUBECONFIG="$HOME/.kube/config"
OTHER_CLUSTERS="$(join_by :$HOME/.kube/clusters/ $(echo $HOME/.kube/clusters/$(ls $HOME/.kube/clusters)))"
OTHER_CLUSTERS="$(join_by :$HOME/.kube/clusters/ $(echo $HOME/.kube/clusters/$(/bin/ls $HOME/.kube/clusters)))"
export KUBECONFIG=$KUBECONFIG:$OTHER_CLUSTERS
## Kubectl exec

View File

@ -1,6 +1,5 @@
[user]
name = Marcus Noble
email = git@marcusnoble.co.uk
[core]
editor = /usr/bin/vim
@ -9,6 +8,9 @@
[push]
default = simple
[init]
defaultBranch = main
[credential]
helper = store
@ -22,7 +24,7 @@
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
branch-name = "!git rev-parse --abbrev-ref HEAD"
changelog-changed = "!test $(git diff --name-only HEAD origin/master | grep CHANGELOG.md | wc -l | xargs) = 1"
changelog-changed = "!test $(git diff --name-only HEAD origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | grep CHANGELOG.md | wc -l | xargs) = 1"
main = "!git remote set-head origin --auto && git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') && git pull"
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u origin $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') ; else echo "Wat?!"; fi; }; func"
@ -39,3 +41,23 @@
[diff]
compactionHeuristic = true
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[delta]
plus-style = "syntax #012800"
minus-style = "syntax #340001"
syntax-theme = Monokai Extended
navigate = true
[interactive]
diffFilter = delta --color-only
[url "ssh://git@github.com"]
insteadOf = https://github.com
[url "ssh://git@gitlab.et-scm.com/"]
insteadOf = https://gitlab.et-scm.com

View File

@ -8,7 +8,7 @@ module.exports = {
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
scrollback: 100000,
scrollback: 10000000,
// default font size in pixels for all tabs
fontSize: 13,

26
.k9s/config.yml Normal file
View File

@ -0,0 +1,26 @@
k9s:
refreshRate: 2
maxConnRetry: 5
enableMouse: false
headless: false
logoless: false
crumbsless: false
readOnly: false
noIcons: false
logger:
tail: 100
buffer: 5000
sinceSeconds: -1
fullScreenLogs: false
textWrap: false
showTime: false
currentContext:
currentCluster:
clusters:
thresholds:
cpu:
critical: 90
warn: 70
memory:
critical: 90
warn: 70

75
.k9s/skin.yml Normal file
View File

@ -0,0 +1,75 @@
# Base16 Material - k9s color config
# Scheme author: Nate Peterson
# Template author: Jef LeCompte (https://jef.buzz)
k9s:
# General K9s styles
body:
fgColor: '#eeffff'
bgColor: '#263238'
logoColor: '#89ddff'
# ClusterInfoView styles
info:
fgColor: '#c3e88d'
sectionColor: '#eeffff'
# Frame styles
frame:
# Borders styles
border:
fgColor: '#82aaff'
focusColor: '#89ddff'
# MenuView attributes and styles
menu:
fgColor: '#eeffff'
keyColor: '#c3e88d'
# Used for favorite namespaces
numKeyColor: '#c3e88d'
# CrumbView attributes for history navigation.
crumbs:
fgColor: '#89ddff'
bgColor: '#263238'
activeColor: '#263238'
# Resource status and update styles
status:
newColor: '#eeffff'
modifyColor: '#ffcb6b'
addColor: '#c3e88d'
errorColor: '#f07178'
highlightcolor: '#89ddff'
killColor: '#f07178'
completedColor: '#c3e88d'
# Border title styles.
title:
fgColor: '#eeffff'
bgColor: '#263238'
highlightColor: '#c792ea'
counterColor: '#c792ea'
filterColor: '#c792ea'
# Specific views styles
views:
# TableView attributes.
table:
fgColor: '#82aaff'
bgColor: '#263238'
cursorColor: '#89ddff'
# Header row styles.
header:
fgColor: '#82aaff'
bgColor: '#263238'
sorterColor: '#c792ea'
# YAML info styles.
yaml:
keyColor: '#f07178'
colonColor: '#89ddff'
valueColor: '#eeffff'
# Logs styles.
logs:
fgColor: '#eeffff'
bgColor: '#263238'

28
.zshrc
View File

@ -1,29 +1,9 @@
# pre-reqs
if [ ! -f ~/.shell-prereqs-installed ];
then
echo "Installing prereqs"
which brew > /dev/null || bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
[ -d ~/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
which fzf > /dev/null || brew install fzf
which bat > /dev/null || brew install bat
which curlie > /dev/null | brew install rs/tap/curlie
which exa > /dev/null || brew install exa
which kubectl > /dev/null || brew install kubectl
which tkn > /dev/null || brew install tektoncd/tools/tektoncd-cli
which k9s > /dev/null || brew install k9s
which helm > /dev/null || brew install helm
which go > /dev/null || brew install go
which jq > /dev/null || brew install jq
which kind > /dev/null || brew install kind
which kubectx > /dev/null || brew install kubectx
brew list --cask homebrew/cask-fonts/font-open-dyslexic-nerd-font > /dev/null || brew install homebrew/cask-fonts/font-open-dyslexic-nerd-font
which starship > /dev/null || brew install starship
touch ~/.shell-prereqs-installed
fi
for filename in ~/.dotfiles/*; do
source $filename
done
for filename in ~/.additional_dotfiles/*; do
source $filename
done
eval "$(starship init zsh)"

92
Makefile Normal file
View File

@ -0,0 +1,92 @@
SHELL := bash
.PHONY: Install
install: pre-reqs dotfiles ## Installs all dotfiles and associated.
.PHONY: pre-reqs
pre-reqs: ## Install all required binaries.
which brew > /dev/null || bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"; \
[ -d ~/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; \
brew list --cask homebrew/cask-fonts/font-open-dyslexic-nerd-font > /dev/null || brew install homebrew/cask-fonts/font-open-dyslexic-nerd-font; \
which rustup > /dev/null || curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path; \
which fzf > /dev/null || brew install fzf; \
which bat > /dev/null || brew install bat; \
which curlie > /dev/null || brew install rs/tap/curlie; \
which exa > /dev/null || brew install exa; \
which kubectl > /dev/null || brew install kubectl; \
which tkn > /dev/null || brew install tektoncd/tools/tektoncd-cli; \
which k9s > /dev/null || brew install k9s; \
which helm > /dev/null || brew install helm; \
which go > /dev/null || brew install go; \
which jq > /dev/null || brew install jq; \
which kind > /dev/null || brew install kind; \
which kubectx > /dev/null || brew install kubectx; \
which tldr > /dev/null || brew install tldr; \
which progress > /dev/null || brew install progress; \
which htop > /dev/null || brew install htop; \
which starship > /dev/null || brew install starship; \
which macchina > /dev/null || cargo install macchina; \
which rg > /dev/null || brew install ripgrep; \
which delta > /dev/null || brew install git-delta; \
which dust > /dev/null || brew install dust; \
which duf > /dev/null || brew install duf; \
which fd > /dev/null || brew install fd; \
which bandwhich > /dev/null || brew install bandwhich; \
which btm > /dev/null || cargo install bottom; \
which procs > /dev/null || brew install procs; \
which dog > /dev/null || brew install dog
.PHONY: upgrade
upgrade: ## Upgrade all required binaries.
brew list --cask homebrew/cask-fonts/font-open-dyslexic-nerd-font > /dev/null && brew upgrade homebrew/cask-fonts/font-open-dyslexic-nerd-font; \
which rustup > /dev/null || rustup update; \
which fzf > /dev/null && brew upgrade fzf; \
which bat > /dev/null && brew upgrade bat; \
which curlie > /dev/null && brew upgrade rs/tap/curlie; \
which exa > /dev/null && brew upgrade exa; \
which kubectl > /dev/null && brew upgrade kubectl; \
which tkn > /dev/null && brew upgrade tektoncd/tools/tektoncd-cli; \
which k9s > /dev/null && brew upgrade k9s; \
which helm > /dev/null && brew upgrade helm; \
which go > /dev/null && brew upgrade go; \
which jq > /dev/null && brew upgrade jq; \
which kind > /dev/null && brew upgrade kind; \
which kubectx > /dev/null && brew upgrade kubectx; \
which tldr > /dev/null && brew upgrade tldr; \
which progress > /dev/null && brew upgrade progress; \
which htop > /dev/null && brew upgrade htop; \
which starship > /dev/null && brew upgrade starship; \
which macchina > /dev/null && cargo install macchina; \
which rg > /dev/null && brew upgrade ripgrep; \
which delta > /dev/null && brew upgrade git-delta; \
which dust > /dev/null && brew upgrade dust; \
which duf > /dev/null && brew upgrade duf; \
which fd > /dev/null && brew upgrade fd; \
which bandwhich > /dev/null && brew upgrade bandwhich; \
which btm > /dev/null && cargo install bottom; \
which procs > /dev/null && brew upgrade procs; \
which dog > /dev/null && brew upgrade dog
.PHONY: dotfiles
dotfiles: ## Installs the dotfiles.
@GITEMAIL=$$(git config --get user.email); \
for file in $(shell find $(CURDIR) -name ".*" -not -name ".gitignore" -not -name ".git" -not -name ".config" -not -name ".k9s" -not -name ".github" -not -name ".*.swp" -not -name ".gnupg"); do \
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/$$f; \
done; \
git config --system --add user.email $$GITEMAIL; \
mkdir -p $(HOME)/.additional_dotfiles; touch $(HOME)/.additional_dotfiles/credentials; \
mkdir -p $(HOME)/.config; \
for file in $(shell find $(CURDIR)/.config -type f); do \
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/.config/$$f; \
done; \
mkdir -p $(HOME)/.k9s; \
for file in $(shell find $(CURDIR)/.k9s -type f); do \
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/.k9s/$$f; \
done; \
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'