Bash: some+ aliases generator + few tweaks.
This commit is contained in:
parent
f202f6bec6
commit
dede296618
@ -50,6 +50,9 @@ echo
|
||||
# Clean
|
||||
echo "Cleaning..."
|
||||
|
||||
# Optimize repo
|
||||
git gc
|
||||
|
||||
# Remove node_modules
|
||||
find . -name node_modules -print0 | xargs -0 rm -rf
|
||||
|
||||
|
@ -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)"; }
|
||||
|
@ -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 character’s 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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user