This file contains hidden or 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
syntax on | |
colorscheme desert | |
set listchars=tab:>-,trail:~,extends:>,precedes:< | |
"set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< | |
set list | |
set noshowmatch | |
set iskeyword+=- | |
" persistent undo | |
set undodir=~/.vim/undodir |
This file contains hidden or 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
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
#------------------------------------------------------------------------------ | |
# Alias | |
#------------------------------------------------------------------------------ | |
alias la='ls -la' | |
alias ll='ls -l' |
This file contains hidden or 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
#export PS1="\e[0;32m[\\u@\h:\\W]\$ \e[m" | |
#export PS1="\e[1;32m\\u@\h\e[m:\e[1;34m\\W\e[m\$ " | |
#export PS1="\[\033[01;32m\]\u@\h\[\033[0m\]:\[\033[01;34m\]\W\[\033[0m\]\$ " | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\[\033[00;33m\]\u@\h\[\033[0m\]:\[\033[01;34m\]\w\[\033[00;32m\]\$(parse_git_branch)\[\033[0m\]\n\[\033[00;33m\]> $\[\033[0m\] " |
This file contains hidden or 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
**/*~ | |
**/.DS_STORE | |
**/.vscode | |
# terraform | |
**/.terraform | |
**/*.tfstate | |
**/*.tfstate.* | |
**/crash.log | |
**/override.tf |
This file contains hidden or 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
# column names | |
# https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html | |
logGroupName= | |
logStreamName= | |
aws logs filter-log-events --start-time `date -d 2018-9-28T18:00:00Z +%s`000 --log-group-name $logGroupName --log-stream-names $logStreamName --filter-pattern REJECT | |
aws logs filter-log-events --start-time `date -d 2018-9-28T18:00:00Z +%s`000 --log-group-name $logGroupName --log-stream-names $logStreamName --filter-pattern REJECT | jq -r '.events[] | "\(.timestamp) \(.message)"' | cut -d ' ' -f1,5,6,7,8,14 | awk '{print system("date -d @" substr($0,1,10)) substr($0,14)}' |
This file contains hidden or 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
to insert text at the beginning of a block of text | |
ctrl+v (visual block mode) | |
down arrow to block out lines | |
shift+i to insert | |
type desired text | |
esc | |
to append to the end of line | |
add a $ when blocking lines | |
shift+a to append |
This file contains hidden or 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
# getting close | |
cat ~/scripts/tfplan.sh | |
#!/usr/bin/env bash | |
planfile=$HOME/plans/${PWD##*/}_$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8) | |
planfilepr=$planfile'PR.md' | |
terraform plan "$@" | tee $planfile | |
# build a PR | |
sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" $planfile | |
echo '## Terraform Plan' > $planfilepr |
This file contains hidden or 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
awk '/policy = <<-EOF/{f=1; next}/^ EOF/{f=0}f' filename.tf | jq |
This file contains hidden or 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
find /home/jayers -exec ls -ald {} \; | awk '{ print $4," ",$NF }' | awk -F \/ '{ print $1,"/",$4,"/",$5,"/",$NF}' | grep -v jayers |
This file contains hidden or 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
grep -Proh --include \*.tf --exclude-dir=.terraform --exclude-dir=.git '\$\{var\.[\w]+\}' | sort | uniq -c | sort -nr | |
find ~/tf/ -name *.tf -exec grep -Proh '\$\{var.[\w]+\}' {} \; | sort | uniq -c | sort -nr > ~/temp/varlist |