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
5aea62e8
Commit
5aea62e8
authored
1 year ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
ipinfo script.
Get IP info from ipinfo.io.
parent
c3547642
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.bashrc
+1
-1
1 addition, 1 deletion
.bashrc
Documents/bin/ipinfo
+36
-0
36 additions, 0 deletions
Documents/bin/ipinfo
with
37 additions
and
1 deletion
.bashrc
+
1
−
1
View file @
5aea62e8
...
...
@@ -231,7 +231,7 @@ gen_csr () {
jt
()
{
if
command
-v
pygmentize
>
/dev/null
then
python3
-m
json.tool
"
$@
"
| pygmentize
-l
j
avascript
python3
-m
json.tool
"
$@
"
| pygmentize
-l
j
son
else
python3
-m
json.tool
"
$@
"
fi
...
...
This diff is collapsed.
Click to expand it.
Documents/bin/ipinfo
0 → 100755
+
36
−
0
View file @
5aea62e8
#!/bin/sh
set
-eu
is_ip
()
{
echo
"
$1
"
|
grep
--extended-regexp
--quiet
'[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
}
usage
()
{
echo
"USAGE:
$(
basename
"
$0
"
)
[-h] [hostname or IP address]"
>
&2
echo
"If no address is passed, the internet IP address is used instead."
>
&2
}
if
[
"$#"
-eq
0
]
then
address
=
"
$(
curl
--silent
--fail
--show-error
https://myip.shore.co.il/
)
"
elif
[
"$#"
-gt
1
]
then
usage
exit
1
elif
[
"
$1
"
=
"-h"
]
then
usage
elif
is_ip
"
$1
"
then
address
=
"
$1
"
else
address
=
"
$(
dig +short
"
$1
"
)
"
fi
if
command
-v
pygmentize
>
/dev/null
then
curl
--silent
--fail
--show-error
--header
"Accept: application/json"
"https://ipinfo.io/
${
address
}
"
| pygmentize
-l
json
else
curl
--fail
--show-error
--header
"Accept: application/json"
"https://ipinfo.io/
${
address
}
"
fi
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