With git 2.9.3 uses the word tree instead of directory. This would mean the dirty git flag was always showing in the bash prompt. Now look for tree and directory.
66 lines
1.5 KiB
Bash
66 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Taken from: http://www.commandlinefu.com/commands/view/4873/google-spell-checker
|
|
function spellcheck () {
|
|
typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>" https://www.google.com/tbproxy/spell|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");
|
|
}
|
|
|
|
function min-jpg {
|
|
tmpfile=`mktemp`
|
|
ogfile="$1"
|
|
jpegtran -optimize -perfect -outfile $tmpfile $ogfile
|
|
mv $tmpfile $ogfile
|
|
}
|
|
|
|
function min-png {
|
|
tmpfile=`mktemp`
|
|
ogfile="$1"
|
|
pngcrush -rem alla -reduce -brute $ogfile $tmpfile
|
|
mv $tmpfile $ogfile
|
|
}
|
|
|
|
function parse_git_status {
|
|
if [[ $(git status 2> /dev/null | wc -l) -eq 0 ]]; then
|
|
return
|
|
fi
|
|
|
|
if [[ $(git status 2> /dev/null | grep -E "working tree|directory clean" | wc -l) -eq 0 ]]; then
|
|
echo ' ∓'
|
|
fi
|
|
}
|
|
|
|
function parse_git_branch {
|
|
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
|
|
}
|
|
|
|
function get-create-date {
|
|
date=`date -r "$1" +"%F"`
|
|
echo $date
|
|
}
|
|
|
|
function add-date-prefix {
|
|
DIR=`dirname "$1"`
|
|
FILE=`basename "$1"`
|
|
DATE=`date -r "$1" +"%F"`
|
|
|
|
mv "$1" "$DIR/$DATE_$FILE"
|
|
}
|
|
|
|
function get-bitrate {
|
|
echo `exiftool -AudioBitrate "$1" | awk '{print $4}'`": $1"
|
|
}
|
|
|
|
function _hostname-color {
|
|
case `whoami` in
|
|
'bsandidge') echo $blue;;
|
|
'buddy') echo $blue;;
|
|
'root') echo $bred;;
|
|
*) echo $purple;;
|
|
esac
|
|
}
|
|
|
|
function _hostname-show {
|
|
hostname -s | tr '[A-Z]' '[a-z]'
|
|
}
|
|
|