|
|
|
# no tmuxifier, just tmux-commands for creating a dev-session
|
|
|
|
function tmd() {
|
|
|
|
cd ~/Sites/$1
|
|
|
|
tmux rename-session $1
|
|
|
|
|
|
|
|
git status
|
|
|
|
tmux rename-window gitngulp
|
|
|
|
tmux split-window -h -p 50 -d
|
|
|
|
tmux new-window -n scss -d
|
|
|
|
tmux new-window -n js -d
|
|
|
|
tmux new-window -n templates -d
|
|
|
|
tmux send-keys -t scss 'cd src/scss && vim' Enter
|
|
|
|
tmux send-keys -t js 'cd src/js && vim' Enter
|
|
|
|
tmux send-keys -t templates 'cd public && ls' Enter
|
|
|
|
tmux select-window -t gitngulp
|
|
|
|
tmux select-pane -t 2
|
|
|
|
tmux send-keys -t gitngulp 'gulp' Enter
|
|
|
|
}
|
|
|
|
|
|
|
|
# generate screenshots from url
|
|
|
|
function screenshot() {
|
|
|
|
cd ~/Downloads/
|
|
|
|
pageres $1 320x500 --filename '<%= url %>-mobile' --crop --delay 3
|
|
|
|
pageres $1 1000x750 --filename '<%= url %>-tablet' --crop --delay 3
|
|
|
|
pageres $1 1400x1000 --filename '<%= url %>-desktop' --crop --delay 3
|
|
|
|
}
|
|
|
|
|
|
|
|
# convert a video to mp4 + webm in one go for web
|
|
|
|
function videoconvert() {
|
|
|
|
ffmpeg -i $1 -acodec libvorbis -aq 7 -ac 2 -vcodec libvpx -b:v 2M -qmax 16 -threads 4 $1.webm
|
|
|
|
ffmpeg -i $1 -acodec libfdk_aac -cutoff 18000 -vcodec libx264 -b:v 2M -qmax 16 -threads 4 $1.mp4
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# a small function for finding stuff
|
|
|
|
function fname() {
|
|
|
|
find . -iname "*$@*";
|
|
|
|
}
|
|
|
|
|
|
|
|
# create and change to directory/folder
|
|
|
|
function take() {
|
|
|
|
mkdir -p $1
|
|
|
|
cd $1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# find process by name and kill them
|
|
|
|
function grepkill() {
|
|
|
|
ps -axf | grep -v grep | grep "$@" | awk '{print $2}' | xargs kill
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# open changed files in git index
|
|
|
|
function gch () {
|
|
|
|
vim `git status | grep modified | awk '{print $3}'`
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# creates an archive from given directory
|
|
|
|
mktar() { tar cvf "${1%%/}.tar" "${1%%/}"; }
|
|
|
|
mktgz() { tar cvzf "${1%%/}.tgz" "${1%%/}"; }
|
|
|
|
mkzip() { zip -r "${1%%/}" "${1%%/}"; }
|
|
|
|
|
|
|
|
|
|
|
|
# easy extract
|
|
|
|
extract () {
|
|
|
|
if [ -f $1 ] ; then
|
|
|
|
case $1 in
|
|
|
|
*.tar.bz2) tar xvjf $1 ;;
|
|
|
|
*.tar.gz) tar xvzf $1 ;;
|
|
|
|
*.bz2) bunzip2 $1 ;;
|
|
|
|
*.rar) rar x $1 ;;
|
|
|
|
*.gz) gunzip $1 ;;
|
|
|
|
*.tar) tar xvf $1 ;;
|
|
|
|
*.tgz) tar xvzf $1 ;;
|
|
|
|
*.tbz2) tar xvjf $1 ;;
|
|
|
|
*.tbz) tar xvjf $1 ;;
|
|
|
|
*.zip) unzip $1 ;;
|
|
|
|
*.Z) uncompress $1 ;;
|
|
|
|
*.7z) 7z x $1 ;;
|
|
|
|
*) echo "don't know how to extract '$1'..." ;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
echo "'$1' is not a valid file!"
|
|
|
|
fi
|
|
|
|
}
|