Last active
December 10, 2015 03:18
-
-
Save semio/4373578 to your computer and use it in GitHub Desktop.
some shell functions
This file contains 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
# Compare svn versions and zip the changed files. | |
# usage: svnecf tarfile start_rev end_rev | |
# credit: http://code.davelens.be/blog/detail/svn-export-all-changed-files-between-two-revisions-in-a-tarball | |
function svnecf() | |
{ | |
tarfile=$1 | |
start_rev=$2 | |
end_rev=$3 | |
if [[ "$end_rev" == "" ]]; then | |
end_rev='HEAD' | |
fi | |
svn diff -r "$start_rev":"$end_rev" --summarize | | |
awk '{if ($1 != "D") print $2}'| | |
xargs -I "{}" tar -rvf "$tarfile" "{}" | |
} | |
# Start an HTTP server from a directory, optionally specifying the port | |
# credit: https://github.com/mathiasbynens/dotfiles | |
function server() { | |
local port="${1:-8000}" | |
sleep 1 && 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 doesn’t break anything for bin | |
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment