Replace the server alias with a function that optionally takes an argument specifying the port number

Inspired by @padolsey’s https://gist.github.com/1525217#gistcomment-71652.
This commit is contained in:
Mathias Bynens
2011-12-31 11:42:42 +01:00
parent 147eff2778
commit 958517dcf4
2 changed files with 9 additions and 0 deletions
+2
View File
@@ -25,6 +25,8 @@ alias undopush="git push -f origin HEAD^:master"
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1"
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# Enhanced WHOIS lookups
alias whois="whois -h whois-servers.net"
# Flush Directory Service cache
+7
View File
@@ -3,6 +3,13 @@ function md() {
mkdir -p "$@" && cd "$@"
}
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="$1"
[ -z "$port" ] && port=8000
open "http://localhost:${port}/" && python -m SimpleHTTPServer "$port"
}
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
function httpcompression() {