DEV Community

Discussion on: My Shell Aliases

Collapse
 
dechamp profile image
DeChamp

Love this! I have some of my own collection as well. A mix of alias and functions.

# A nice little readme function, to make a README file into a webpage
# usage: rmd path/to/README.md
rmd () {
    grip -b $1 &
    TASK_PID=$!
    sleep 10
    kill $TASK_PID
}

# Takes a video and converts it to mp4 for web
# usage: genwebmp4 path/to/video.ext
# ffmpeg can handle many ext type so you are not limited (.mov, .avi and so on)
genwebmp4 () {
    ffmpeg -i $1 -vcodec h264 -acodec aac -strict -2 $2
}

# Takes a video and converts it to webm for web
# usage: genwebm path/to/video.ext
# ffmpeg can handle many ext type so you are not limited (.mov, .avi and so on)
genwebm () {
    ffmpeg -i $1 -c:v libvpx-vp9 -b:v 2M -pass 1 -c:a libopus -f webm /dev/null && \
        ffmpeg -i $1 -c:v libvpx-vp9 -b:v 2M -pass 2 -c:a libopus $2
}

#usage: genvideothumb path/to/video.ext
genvideothumb () {
    ffmpeg -ss 00:00:01  -i $1 -vframes 1 -q:v 2 $2
}

# for those who struggle spelling! This will take your best guess and give you a list of what you probably meant.
#usage: spl paranoya 
# & paranoya 8 0: paranoia, Parana, paranoiac (as you see the first option after the 0, gives the correct spelling
spl () {
    aspell -a <<< "$1"
}

#Clean up your git branches that have already been merged in.
#usage: best to first do a git fetch --all and then run gitCleanBranches
gitCleanBranches() {
    git branch --merged | egrep -v "(^\*|master|develop)" | xargs git branch -d
}

#usage: wavToMp3 path/to/file
# no extension needed
wavToMp3() {
    ffmpeg -i $1.wav -codec:a libmp3lame -qscale:a 2 $1.mp3
}

#usage: mp3ToOgg path/to/mp3's
# no extension needed
mp3ToOgg() {
    for file in *.mp3
        do ffmpeg -i "${file}" "${file/%mp3/ogg}"
    done
}

alias itunes='/usr/local/bin/itunes'
alias storybook="start-storybook -p 9001 -c .storybook"
alias ll='ls -al'
alias dc='docker-compose '
alias dci='docker-compose images'
alias dps='docker ps'
alias dcreup='docker-compose down && docker-compose up --build'
alias deleteMergedBranches='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d'
alias dstop='docker stop $(docker ps -a -q)'
alias sf='bin/console ' //symfony console
alias memhog='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head'
alias brewup='brew update; brew upgrade; brew prune; brew cleanup; brew doctor'

I also use oh-my-zsh, with many of it's oh-my-zsh plugins. it's osx plugin is pretty awesome when working on mac, giving you ability to open current paths in the finder, or getting the current selected file in the finder, as a path in the terminal.

There are so many pluigns, you'll have to check out the oh-my-zsh plugins list.

Collapse
 
deciduously profile image
Ben Lovy

Definitely stealing those ffmpeg lines.

Collapse
 
dechamp profile image
DeChamp

please do! they helped me a lot.