Bash: some+ aliases generator + few tweaks.

This commit is contained in:
Artem Sapegin 2013-01-10 14:56:34 +04:00
parent f202f6bec6
commit dede296618
4 changed files with 15 additions and 7 deletions

View File

@ -50,6 +50,9 @@ echo
# Clean
echo "Cleaning..."
# Optimize repo
git gc
# Remove node_modules
find . -name node_modules -print0 | xargs -0 rm -rf

View File

@ -77,7 +77,7 @@ done
alias dos2unix="perl -pi -e 's/\r\n?/\n/g'"
# Password generator
password() { openssl rand -base64 ${1:-8} | c; }
password() { openssl rand -base64 ${1:-8}; }
# Show $PATH in a readable way
alias path='echo -e ${PATH//:/\\n}'
@ -88,8 +88,8 @@ alias npm-release='npm version minor -m "%s"'
# Grunt
alias gw="grunt deploy --debug && grunt watch --debug"
alias gs="grunt deploy --debug && grunt serve --debug"
gi() { grunt init:$@; }
alias gs="grunt deploy --debug && grunt watch server --debug"
gi() { grunt-init $@; }
# Magic Project Opener
function proj { cd "$("$HOME/dotfiles/bin/opener.py" "$HOME/Dropbox/Projects" $1 -w project $2)"; }

View File

@ -40,13 +40,13 @@ function headers() {
# Escape UTF-8 characters into their 3-byte format
function escape() {
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
echo # newline
echo
}
# Get a characters Unicode code point: £ → \x00A3
function codepoint() {
perl -e "use utf8; print sprintf('\x%04X', ord(\"$@\"))"
echo # newline
echo
}
# Remove screenshots from desktop
@ -238,3 +238,8 @@ function rasterize() {
echo "Screenshot saved to: $filename"
fi
}
# Add special aliases that will copy result to clipboard (escape → escape+)
for cmd in password hex2hsl hex2rgb escape codepoint; do
eval "function $cmd+() { $cmd \$@ | c; }"
done

View File

@ -42,8 +42,8 @@ function _prepend_path() {
[ -d /usr/local/bin ] && _prepend_path "/usr/local/bin"
[ -d /usr/local/share/npm/bin ] && _prepend_path "/usr/local/share/npm/bin"
command -v brew >/dev/null 2>&1 && _prepend_path "$(brew --prefix coreutils)/libexec/gnubin"
[ -d ~/dotfiles/bin ] && _prepend_path "~/dotfiles/bin"
[ -d ~/bin ] && _prepend_path "~/bin"
[ -d ~/dotfiles/bin ] && _prepend_path "$HOME/dotfiles/bin"
[ -d ~/bin ] && _prepend_path "$HOME/bin"
export PATH
# Colors