Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rcfiles
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
rcfiles
Commits
58e14c11
Commit
58e14c11
authored
4 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Sort shell functions.
parent
4b2bf4de
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.bashrc
+102
-102
102 additions, 102 deletions
.bashrc
with
102 additions
and
102 deletions
.bashrc
+
102
−
102
View file @
58e14c11
...
...
@@ -146,54 +146,26 @@ alias wb="ssh -t workbench.shore.co.il 'if tmux ls >/dev/null 2>&1; then tmux a;
alias
wifi-portal
=
'curl --silent --fail --write-out "%{redirect_url}" --output /dev/null http://detectportal.firefox.com/success.txt'
alias
xargs
=
"xargs "
tfp
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform plan
-out
tfplan
"
$@
"
else
terraform plan
-out
tfplan
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
}
tfaa
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform apply
-auto-approve
"
$@
"
else
terraform apply
-auto-approve
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
blue
()
{
printf
'\e[1;94m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
tfr
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform refresh
"
$@
"
else
terraform refresh
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
bold
()
{
printf
'\e[1m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
tfi
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform import
"
$@
"
else
terraform import
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
cyan
()
{
printf
'\e[1;96m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
tfv
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform validate
"
$@
"
else
terraform validate
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
ddg
()
{
w3m
"https://duckduckgo.com/lite/?q=
$(
echo
"
$@
"
| urlencode
)
"
}
genpass
()
{
...
...
@@ -202,6 +174,17 @@ genpass () {
echo
}
gen_csr
()
{
name
=
"
${
1
:-
site
}
"
openssl req
-new
-newkey
rsa:4096
-nodes
-out
"
$name
.csr"
-keyout
"
$name
.key"
}
green
()
{
printf
'\e[1;92m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
jt
()
{
if
command
-v
pygmentize
>
/dev/null
then
...
...
@@ -211,44 +194,40 @@ jt () {
fi
}
bold
()
{
printf
'\e[1m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
red
()
{
printf
'\e[1;91m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
green
()
{
printf
'\e[1;92m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
yellow
()
{
printf
'\e[1;93m'
||
true
magenta
()
{
printf
'\e[1;95m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
blue
()
{
printf
'\e[1;94m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
match_ssl_pair
()
{
if
[
"$#"
-ne
2
]
then
echo
"Usage: match_ssl_pair private_key certificate"
return
1
fi
tempkey
=
"
$(
mktemp
)
"
tempcert
=
"
$(
mktemp
)
"
openssl pkey
-pubout
-outform
PEM
-in
"
$1
"
>
"
$tempkey
"
openssl x509
-pubkey
-noout
-in
"
$2
"
>
"
$tempcert
"
cmp
"
$tempkey
"
"
$tempcert
"
>
/dev/null
exitcode
=
"
$?
"
rm
"
$tempkey
"
"
$tempcert
"
return
"
$exitcode
"
}
magenta
()
{
printf
'\e[1;95m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
# shellcheck disable=SC2120
prune_ssh_sockets
()
{
{
[
"
${
1
:-}
"
!=
'-f'
]
&&
[
"
${
1
:-}
"
!=
'--force'
]
;
}
||
killall
-v
ssh
||
true
find ~/.ssh/
\
-maxdepth
1
\
-type
s
\
\!
-name
'cm_*.sock'
\
-execdir
sh
-c
'lsof -t "$1" >/dev/null || rm "$1"'
_
{}
\;
}
cyan
()
{
printf
'\e[1;9
6
m'
||
true
red
()
{
printf
'\e[1;9
1
m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
...
...
@@ -258,11 +237,6 @@ ssh_keyscan_add () {
sort
-uo
"
$HOME
/.ssh/known_hosts"
"
$HOME
/.ssh/known_hosts"
}
gen_csr
()
{
name
=
"
${
1
:-
site
}
"
openssl req
-new
-newkey
rsa:4096
-nodes
-out
"
$name
.csr"
-keyout
"
$name
.key"
}
sync_comics
()
{
local
this_month last_month format
format
=
'+kodi.shore.co.il:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*'
...
...
@@ -278,39 +252,65 @@ sync_podcasts () (
unison podcasts
)
ddg
()
{
w3m
"https://duckduckgo.com/lite/?q=
$(
echo
"
$@
"
| urlencode
)
"
tfaa
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform apply
-auto-approve
"
$@
"
else
terraform apply
-auto-approve
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
}
toux
()
{
touch
"
$@
"
chmod
+x
"
$@
"
tfi
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform import
"
$@
"
else
terraform import
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
}
match_ssl_pair
()
{
if
[
"$#"
-ne
2
]
tfp
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
echo
"Usage: match_ssl_pair private_key certificate"
return
1
terraform plan
-out
tfplan
"
$@
"
else
terraform plan
-out
tfplan
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
tempkey
=
"
$(
mktemp
)
"
tempcert
=
"
$(
mktemp
)
"
openssl pkey
-pubout
-outform
PEM
-in
"
$1
"
>
"
$tempkey
"
openssl x509
-pubkey
-noout
-in
"
$2
"
>
"
$tempcert
"
cmp
"
$tempkey
"
"
$tempcert
"
>
/dev/null
exitcode
=
"
$?
"
rm
"
$tempkey
"
"
$tempcert
"
return
"
$exitcode
"
}
# shellcheck disable=SC2120
prune_ssh_sockets
()
{
{
[
"
${
1
:-}
"
!=
'-f'
]
&&
[
"
${
1
:-}
"
!=
'--force'
]
;
}
||
killall
-v
ssh
||
true
find ~/.ssh/
\
-maxdepth
1
\
-type
s
\
\!
-name
'cm_*.sock'
\
-execdir
sh
-c
'lsof -t "$1" >/dev/null || rm "$1"'
_
{}
\;
tfr
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform refresh
"
$@
"
else
terraform refresh
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
}
tfv
()
{
workspace
=
"
$(
terraform workspace show
)
"
if
[
"
$workspace
"
=
"default"
]
||
[
!
-f
"
$workspace
.tfvars"
]
then
terraform validate
"
$@
"
else
terraform validate
-var-file
"
$workspace
.tfvars"
"
$@
"
fi
}
toux
()
{
touch
"
$@
"
chmod
+x
"
$@
"
}
yellow
()
{
printf
'\e[1;93m'
||
true
echo
"
$@
"
printf
'\e[0m'
||
true
}
__prompt
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment