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
[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases | |
function alias_completion() { | |
local namespace="alias_completion" | |
# parse function based completion definitions, where capture group 2 => function and 3 => trigger | |
local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)' | |
# parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments | |
local alias_regex="alias ([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'" | |
# create array of function completion triggers, keeping multi-word triggers together | |
eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))" |
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
#Terraform version switch | |
function terraformv() { | |
if [ $# -eq 1 ]; then | |
if test -f "/opt/terraform/terraform-${1}"; then | |
sudo rm /opt/terraform/terraform | |
sudo ln -s "/opt/terraform/terraform-${1}" /opt/terraform/terraform | |
echo "switched to terraform-${1}" | |
else | |
echo "terraform-${1} does not exist, pls download from https://releases.hashicorp.com/terraform/ first and store in /opt/terraform." | |
return 1 |
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
{ | |
"extractors": [ | |
{ | |
"title": "Remote Address", | |
"extractor_type": "regex", | |
"converters": [], | |
"order": 0, | |
"cursor_strategy": "copy", | |
"source_field": "message", | |
"target_field": "remote_addr", |