myip alias.

This commit is contained in:
Artem Sapegin 2013-09-19 21:38:15 +04:00
parent a6efd30db7
commit 8fc442eb91
2 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,8 @@ alias rm="rm -i"
# Gzip-enabled `curl`
#alias gurl="curl --compressed"
alias myip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'"
# Software/libraries update
alias update="source "$HOME/dotfiles/setup/update.sh""

View File

@ -290,6 +290,8 @@ EOF
# Usage: server [port]
function server() {
local port="${1:-8000}"
echo "Access from network: http://$(myip):$port"
echo
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesnt break anything for binary files)
@ -301,6 +303,6 @@ function sayit() {
}
# Add special aliases that will copy result to clipboard (escape → escape+)
for cmd in password hex2hsl hex2rgb escape codepoint ssh-key; do
for cmd in password hex2hsl hex2rgb escape codepoint ssh-key myip; do
eval "function $cmd+() { $cmd \$@ | c; }"
done