Created
April 18, 2017 10:37
-
-
Save W-Floyd/8fd7ac9c4f38e4b7ededf257b8d2229c to your computer and use it in GitHub Desktop.
Bash aliases
This file contains hidden or 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
function mkex { | |
if ! chmod +x "${1}"; then | |
sudo chmod +x "${1}" | |
fi | |
} | |
function youtube-best { | |
youtube-dl -f bestvideo+bestaudio $1 | |
} | |
function youtube-music { | |
youtube-dl -f 140 $1 --embed-thumbnail -o '%(title)s.%(ext)s' | |
} | |
function yml-fetch { | |
$HOME/repository/common/Scripts/yauto.py "$1" | |
} | |
function yml-update { | |
/usr/share/ypkg/yupdate.py "$1" "$2" | |
} | |
lsdir () { | |
if [ -z "${1}" ]; then | |
find . -maxdepth 1 -mindepth 1 -type d | sort | |
else | |
find "${1}" -maxdepth 1 -mindepth 1 -type d | sort | |
fi | |
} | |
function repo-setup { | |
mkdir "$1" | |
cd "$1" | |
git init | |
echo "include ../Makefile.common" > Makefile | |
yml-fetch "$2" | |
} | |
pngchunks () { | |
identify -verbose "${1}" | pcregrep -M " Properties(\n|.)* Artifacts:" | sed -e '1d' -e '$d' | sed 's/ *//' | grep '^png' | |
} | |
gut () { | |
echo -e "It's \e[32mgit\e[39m, not \e[31mgut\e[39m!" | |
git "${@}" | |
} | |
gir () { | |
echo -e "It's \e[32mgit\e[39m, not \e[31mgir\e[39m!" | |
git "${@}" | |
} | |
gst () { | |
git status | |
} | |
gps () { | |
git ps | |
} | |
gpsh () { | |
git push | |
} | |
seq2 () { | |
seq "${1}" "${2}" | sed 's/^/2^/' | bc | |
} | |
gimp-export () { | |
if ! [ "$(oext "${1}")" = 'xcf' ]; then | |
echo "File \"${1}\" is not a xcf file" | |
return 1 | |
fi | |
__gimp_sub () { | |
gimp -i --batch-interpreter=python-fu-eval -b - << EOF | |
import gimpfu | |
def convert(filename): | |
img = pdb.gimp_file_load(filename, filename) | |
new_name = filename.rsplit(".",1)[0] + ".png" | |
layer = pdb.gimp_image_merge_visible_layers(img, 1) | |
pdb.gimp_file_save(img, layer, new_name, new_name) | |
pdb.gimp_image_delete(img) | |
convert('${1}') | |
pdb.gimp_quit(1) | |
EOF | |
} | |
# My instance of GIMP throws some errors no matter what, so | |
__gimp_sub "${1}" &> /dev/null | |
} | |
jpg50 () { | |
convert "${1}" -scale 50% "${1%.*}.jpg" | |
} | |
glr () { | |
git lr "$@" | |
} | |
gad () { | |
git add "$@" | |
} | |
gcm () { | |
git cm "$@" | |
} | |
gdif () { | |
git diff "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment