#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '

# https://github.com/gsamokovarov/jump
eval "$(jump shell --bind=j)"

alias map='telnet mapscii.me'

# # ex - archive extractor
# # usage: ex <file>
ex ()
{
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2)   tar xjf $1   ;;
      *.tar.gz)    tar xzf $1   ;;
      *.bz2)       bunzip2 $1   ;;
      *.rar)       unrar x $1     ;;
      *.gz)        gunzip $1    ;;
      *.tar)       tar xf $1    ;;
      *.tbz2)      tar xjf $1   ;;
      *.tgz)       tar xzf $1   ;;
      *.zip)       unzip $1     ;;
      *.Z)         uncompress $1;;
      *.7z)        7z x $1      ;;
      *)           echo "'$1' cannot be extracted via ex()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}

# # Change the window title of X terminals
# case ${TERM} in
# 	xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
# 		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
# 		;;
# 	screen*)
# 		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
# 		;;
# esac

# alias cp="cp -i"                          # confirm before overwriting something
# alias df='df -h'                          # human-readable sizes
# alias free='free -m'                      # show sizes in MB
# alias np='nano -w PKGBUILD'
# #alias more=less


# # ---
# # sys stuff
# # ---
# alias nas-mount="sudo systemctl start media-nas.mount"
# alias nas-unmount="sudo systemctl stop media-nas.mount"
#
# iso-mount() {
# 	sudo mount -o loop "$1" /media/iso
# }
# alias iso-unmount="sudo umount /media/iso"
#
# # https://en.wikipedia.org/wiki/List_of_common_resolutions
# alias res-low="xrandr -s 1920x1080"
# alias res-med="xrandr -s 2560x1440"
# alias res-high="xrandr -s 3840x2160"
#
# alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll"

# # ---
# # misc
# # ---
# downstream() {
#     output="output.mp4"
# 	# https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
# 	if [[ -n $2 ]]; then
# 		output=$2
# 	fi
# 	ffmpeg -i "$1" -c copy -bsf:a aac_adtstoasc "/home/poq/syncDir/0_downloads/${output}"
# }
alias videoCompressor="/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2104_videoCompressor/src/vc_v2.sh"
# alias videoWatermark="/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2104_videoCompressor/src/vcwm_v1.sh"
# alias webserver-start="/home/poq/syncDir/gitRepos/git.mz.fo/localWebServer/sh/startWebserver.sh"
# gpx2jon() {
# 	cd /home/poq/syncDir/gitRepos/git.mz.fo/gpx2jon/src
# 	source venv/bin/activate
# 	python archi.py -s /home/poq/syncDir/gitRepos/git.mz.fo/fiodb/db/gpx2jon/sites
# 	deactivate
# }
# gpx2jon-with-build-all() {
# 	gpx2jon
# 	frodr.com-build-all
# }
alias imgResize='/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2305_imgResizer/resize.sh 1200'
alias notesArchiver='/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2306_notesArchiver/notesArchiver.sh'
alias toJpg='/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2306_toJpg/toJpg.sh'
alias gpxImporter='python /home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2308_gpxImporter/importer.py'

# ---
# ajp related
# ---
# ajp-cp2dropbox() {
# 	"/home/poq/syncDir/gitRepos/git.mz.fo/miniProjects/2106_ajpDropboxDeployer/archi.sh" "$1" "$2"
# }
podigy() {
    cd /home/poq/syncDir/gitRepos/git.mz.fo/podigy/src
	source venv/bin/activate
	python archi.py -s /home/poq/syncDir/gitRepos/git.mz.fo/fiodb/db/podigy/sites
    deactivate
}
# podigy-pywsdb() {
# 	podigy
# 	/home/poq/syncDir/gitRepos/git.mz.fo/pyws/deploy/deployToBuildServer.sh db
# }
#
# # ---
# # c19vaxno
# # ---
# #alias c19vaxno-deploy="/home/poq/syncDir/gitRepos/gitlab/c19vaxno/helperScripts/deployToGitlab.sh"
#
# # ---
# # hummed
# # ---
# hummed-activate() {
# 	cd /home/poq/syncDir/gitRepos/git.mz.fo/hummed/src
# 	source venv/bin/activate
# }
#
# hummed() {
#     hummed-activate
#     python /home/poq/syncDir/gitRepos/git.mz.fo/hummed/src/archi.py "$@"
#     deactivate
#     jump-to-downloads
# }
#
# # ---
# # jeton
# # ---
# jeton() {
# 	cd /home/poq/syncDir/gitRepos/git.mz.fo/jeton/src/
# 	source venv/bin/activate
# 	python archi.py -s /home/poq/syncDir/gitRepos/git.mz.fo/fiodb/db/jeton/in/sites -r $1
# 	deactivate
# }
#
# # ---
# # server syncs/backups/deploys
# # ---
# srv-guru-backup() {
# 	echo "[srv-guru-backup]: <=== download wc2sd/exec/"
# 	rsync -v -a --progress --stats --e 'ssh -p 1808' trunk@135.181.193.110:/home/trunk/wc2sd/exec/ /home/poq/syncDir/gitRepos/git.mz.fo/srv.guru/trunk/wc2sd/exec/
# 	echo "[srv-guru-backup]: <=== download wc2sd/db/"
# 	rsync -v -a --progress --stats -e 'ssh -p 1808' trunk@135.181.193.110:/home/trunk/wc2sd/db/ /home/poq/syncDir/gitRepos/git.mz.fo/srv.guru/trunk/wc2sd/db/
# 	echo "[srv-guru-backup]: <=== download cron_export/"
# 	rsync -v -a --progress --stats -e 'ssh -p 1808' trunk@135.181.193.110:/home/trunk/cron_export/ /home/poq/syncDir/gitRepos/git.mz.fo/srv.guru/trunk/cron_export/
# 	echo "[srv-guru-backup]: <=== download .ssh/"
# 	rsync -v -a --progress --stats -e 'ssh -p 1808' trunk@135.181.193.110:/home/trunk/.ssh/ /home/poq/syncDir/gitRepos/git.mz.fo/srv.guru/trunk/.ssh/
# }

# ---
# misc websites
# ---
alias 00101111.xyz-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/00101111.xyz/www/ trunk@167.235.77.26:/var/www/00101111.xyz/"
# alias mz.fo-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/mz.fo/www/ trunk@167.235.77.26:/var/www/mz.fo/"

# # ---
# # pusterom.com
# # ---
# alias pusterom.com-themeUpd="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 22' /home/poq/syncDir/gitRepos/git.mz.fo/pusterom-hht/src/Pusterom/ root@209.38.217.93:/var/www/humhub/themes/Pusterom/"

# ---
# jongleur
# ---
jcssbuilder() {
	cd /home/poq/syncDir/gitRepos/git.mz.fo/jCssBuilder/src
	source venv/bin/activate
	python /home/poq/syncDir/gitRepos/git.mz.fo/jCssBuilder/src/archi.py
	deactivate
}
jongleur-activate() {
	cd /home/poq/syncDir/gitRepos/gitlab/jongleur/src
	source venv/bin/activate
}
jump-to-downloads() {
    cd /home/poq/syncDir/0_downloads
}
ajp.fm-build() {
	jongleur-activate
	/home/poq/syncDir/gitRepos/git.mz.fo/ajp.fm/jongleur/run.sh
	deactivate
    jump-to-downloads
}
ajp.fm-build-all() {
	jongleur-activate
	/home/poq/syncDir/gitRepos/git.mz.fo/ajp.fm/jongleur/runAll.sh
	deactivate
    jump-to-downloads
}
alias ajp.fm-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/ajp.fm/jongleur/html_export/ trunk@167.235.77.26:/var/www/ajp.fm/jongleur/"
# antijanteboka.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/antijanteboka.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# antijanteboka.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/antijanteboka.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias antijanteboka.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/antijanteboka.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/antijanteboka.com/jongleur/"
# antijantemiriam.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/antijantemiriam.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# antijantemiriam.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/antijantemiriam.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias antijantemiriam.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/antijantemiriam.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/antijantemiriam.com/jongleur/"
# billgoats.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/billgoats.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# billgoats.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/billgoats.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias billgoats.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/billgoats.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/billgoats.com/jongleur/"
# curious.art-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/curious.art/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# curious.art-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/curious.art/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias curious.art-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/curious.art/jongleur/html_export/ trunk@167.235.77.26:/var/www/curious.art/jongleur/"
# curiouscreators.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/curiouscreators.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# curiouscreators.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/curiouscreators.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias curiouscreators.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/curiouscreators.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/curiouscreators.com/jongleur/"
# frodr.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/frodr.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# frodr.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/frodr.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias frodr.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/frodr.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/frodr.com/jongleur/"
# klevstul.com-build() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/klevstul.com/jongleur/run.sh
# 	deactivate
#     jump-to-downloads
# }
# klevstul.com-build-all() {
# 	jongleur-activate
# 	/home/poq/syncDir/gitRepos/git.mz.fo/klevstul.com/jongleur/runAll.sh
# 	deactivate
#     jump-to-downloads
# }
# alias klevstul.com-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/git.mz.fo/klevstul.com/jongleur/html_export/ trunk@167.235.77.26:/var/www/klevstul.com/jongleur/"
#