Bash: New aliases + prevent duplicates in $PATH + some refactoring.

This commit is contained in:
Artem Sapegin
2012-12-13 16:26:57 +04:00
parent 5b8ee712c4
commit 38359da2f6
5 changed files with 42 additions and 12 deletions

View File

@ -14,7 +14,9 @@ alias pjf="cd ~/Dropbox/Projects/_Forks"
alias pjm="cd ~/Dropbox/Projects/!"
alias o="open"
alias oo="open ."
alias e="subl"
alias marked="open -a marked"
alias +x="chmod +x"
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`

View File

@ -27,6 +27,16 @@ function httpcompression() {
encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
}
# Show HTTP headers for given URL
# Usage: headers <URL>
# https://github.com/rtomayko/dotfiles/blob/rtomayko/bin/headers
function headers() {
curl -sv -H "User-Agent: Mozilla/5 Gecko" "$@" 2>&1 >/dev/null |
grep -v "^\*" |
grep -v "^}" |
cut -c3-
}
# Escape UTF-8 characters into their 3-byte format
function escape() {
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
@ -240,7 +250,7 @@ function rasterize() {
[[ $filename != *png ]] && filename="$filename.png"
phantomjs <(echo "
var page = new WebPage();
page.viewportSize = { width: 1280, height_: 1024 };
page.viewportSize = { width: 1280 };
page.open('$url', function (status) {
if (status !== 'success') {
console.log('Unable to load the address.');
@ -257,4 +267,4 @@ function rasterize() {
echo "Screenshot saved to: $filename"
fi
}
}