summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Graffagnino <vito@graffagnino.xyz>2020-09-08 13:31:02 +0100
committerVito Graffagnino <vito@graffagnino.xyz>2020-09-08 13:31:02 +0100
commit8cc927e930d5b6aafe3e9862a61e81705479a1b4 (patch)
treed9b75e65c2440ef0943c5598ccdddaf50a06ca44
Initial commit. .z* files added
-rw-r--r--.zlogin2
-rw-r--r--.zsh.d/_buku53
-rw-r--r--.zsh.d/_cht21
-rw-r--r--.zshaliases151
-rw-r--r--.zshenv186
-rw-r--r--.zshfunc5970
-rw-r--r--.zshopts23
-rw-r--r--.zshrc116
8 files changed, 6522 insertions, 0 deletions
diff --git a/.zlogin b/.zlogin
new file mode 100644
index 0000000..41fc778
--- /dev/null
+++ b/.zlogin
@@ -0,0 +1,2 @@
+mpd
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
diff --git a/.zsh.d/_buku b/.zsh.d/_buku
new file mode 100644
index 0000000..66303b6
--- /dev/null
+++ b/.zsh.d/_buku
@@ -0,0 +1,53 @@
+#compdef buku
+#
+# Completion definition for buku.
+#
+# Author:
+# Arun Prakash Jana <engineerarun@gmail.com>
+#
+
+setopt localoptions noshwordsplit noksharrays
+local -a args
+args=(
+ '(-a --add)'{-a,--add}'[add bookmark]:URL tags'
+ '(--ai)--ai[auto-import bookmarks]'
+ '(-c --comment)'{-c,--comment}'[comment on bookmark]'
+ '(--cached)--cached[visit Wayback Machine cached version]:index/url'
+ '(--colors)--colors[set output colors in 5-letter string]:color string'
+ '(-d --delete)'{-d,--delete}'[delete bookmark]'
+ '(--deep)--deep[search matching substrings]'
+ '(-e --export)'{-e,--export}'[export bookmarks]:html/md/db output file'
+ '(--expand)--expand[expand a tny.im shortened URL]:index/shorturl'
+ '(-f --format)'{-f,--format}'[limit fields in print and JSON output]:value'
+ '(-h --help)'{-h,--help}'[show help]'
+ '(-i --import)'{-i,--import}'[import bookmarks]:html/md/db input file'
+ '(--immutable)--immutable[disable title update from web]:value'
+ '(-j --json)'{-j,--json}'[show JSON output for print and search]:file'
+ '(-k --unlock)'{-k,--unlock}'[decrypt database]'
+ '(-l --lock)'{-l,--lock}'[encrypt database]'
+ '(-n --count)'{-n,--count}'[results per page]:value'
+ '(--nc)--nc[disable color output]'
+ '(--np)--np[noninteractive mode]'
+ '(-o --open)'{-o,--open}'[open bookmarks in browser]'
+ '(--oa)--oa[browse all search results immediately]'
+ '(-p --print)'{-p,--print}'[show bookmark details]'
+ '(-r --sreg)'{-r,--sreg}'[match a regular exression]:regex'
+ '(--replace)--replace[replace a tag]:tag to replace'
+ '(-s --sany)'{-s,--sany}'[match any keyword]:keyword(s)'
+ '(-s --sall)'{-s,--sall}'[match all keywords]:keyword(s)'
+ '(--shorten)--shorten[shorten a URL using tny.im]:index/url'
+ '(--suggest)--suggest[show a list of similar tags]'
+ '(-t --stag)'{-t,--stag}'[search by tag or show tags]'
+ '(--tacit)--tacit[reduce verbosity]'
+ '(--tag)--tag[set tags, use + to append, - to remove]'
+ '(--threads)--threads[max connections for full refresh]:value'
+ '(--title)--title[set custom title]'
+ '(-u --update)'{-u,--update}'[update bookmark]'
+ '(--url)--url[set url]:url'
+ '(-V)-V[check latest upstream release]'
+ '(-v --version)'{-v,--version}'[show program version]'
+ '(-w --write)'{-w,--write}'[open editor]'
+ '(-x --exclude)'{-x,--exclude}'[exclude keywords]:keyword(s)'
+ '(-z --debug)'{-z,--debug}'[enable debugging mode]'
+)
+_arguments -S -s $args
diff --git a/.zsh.d/_cht b/.zsh.d/_cht
new file mode 100644
index 0000000..e1a4230
--- /dev/null
+++ b/.zsh.d/_cht
@@ -0,0 +1,21 @@
+#compdef cht.sh
+
+__CHTSH_LANGS=($(curl -s cheat.sh/:list))
+_arguments -C \
+ '--help[show this help message and exit]: :->noargs' \
+ '--shell[enter shell repl]: :->noargs' \
+ '1:Cheat Sheet:->lang' \
+ '*::: :->noargs' && return 0
+
+if [[ CURRENT -ge 1 ]]; then
+ case $state in
+ noargs)
+ _message "nothing to complete";;
+ lang)
+ compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};;
+ *)
+ _message "Unknown state, error in autocomplete";;
+ esac
+
+ return
+fi
diff --git a/.zshaliases b/.zshaliases
new file mode 100644
index 0000000..a491f9b
--- /dev/null
+++ b/.zshaliases
@@ -0,0 +1,151 @@
+###############################################################################
+#
+# LINUX COMMANDS AND ALIASES --- {{{
+#
+###############################################################################
+###############################################################################
+#
+# General --- {{{
+#
+###############################################################################
+
+if [ -f "/usr/lib/w3m/cgi-bin/treat_as_url.cgi" ]; then
+ alias w3mu="w3m /usr/lib/cgi-bin/treat_as_url.cgi"
+fi
+
+alias ..="cd .."
+alias ...="cd ../.."
+alias ....="cd ../../.."
+alias .....="cd ../../../.."
+alias ......="cd ../../../../.."
+alias b="export BROWSER='w3m' && buku"
+alias bye="logout"
+alias c="fasd_cd -d"
+alias chancli="python $HOME/bin/git-src/chancli/chancli.py"
+alias cleanup="sudo pacman -Rns $(pacman -Qtdq)" # remove orphaned packages
+alias cls="clear"
+alias config='/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME'
+alias deprot="chmod og+rx"
+alias deprotw="chmod og+rxw"
+alias df="df -h"
+alias drpre3att="java -jar $COMP/Palm/webos/Homebrew/Tools/04-webosdoctorp224mantaatt.jar"
+alias drpre3wr="java -jar $COMP/Palm/webos/Homebrew/Tools/04-webosdoctorp224mantawr.jar"
+alias drtouchpad="java -jar $COMP/Palm/webos/Homebrew/Tools/05-webosdoctorp305hstnhwifi.jar --auto"
+alias drtouchpad-activate="java -jar $COMP/Palm/webos/Homebrew/Tools/07-tptoolbox_v42/devicetool2.jar"
+alias drive="$HOME/bin/gdrive-osx-x64"
+alias du="du -h"
+alias emx="/usr/bin/emacs -nw"
+alias fbhami="sftp fxunb.sr.bham.ac.uk"
+alias fucl="sftp vgg@ftp.star.ucl.ac.uk"
+alias galias="nvim $HOME/.zshaliases"
+alias galiasenv="nvim $HOME/.zshenv"
+alias galiasfunc="nvim $HOME/.zshfunc"
+alias garbage='gvfs-trash -f'
+alias garbage-list='gvfs-ls -h trash://'
+alias garbage-empty='gvfs-trash --empty' # empty trash globally (all partitions)
+alias grep="grep --color=auto"
+alias gonotts="ssh $GPUServer"
+alias gua='/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME remote | xargs -L1 /usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME push --all'
+alias gunzip="gzip -d"
+alias hkp0="ssh 192.168.0.200"
+alias herts="ssh -XC vgg@star.herts.ac.uk"
+alias hertc="ssh -XC vgg@uhhpc.herts.ac.uk"
+alias hertsc="ssh -XC vgg@stri-cluster.herts.ac.uk"
+alias phkp0="ping 192.168.0.200"
+alias hkp1="ssh hongkongphooey.is-a-geek.net"
+alias phkp1="ping hongkongphooey.is-a-geek.net"
+alias hkp2="ssh hongkongphooy.ddns.net"
+alias phkp2="ping hongkongphooy.ddns.net"
+alias kali="sudo mount -t ext4 /dev/sda10 /Kali"
+alias lo="logout"
+alias l="ls -pCFG"
+alias ls="ls -pCFG"
+alias ll='ls -alF'
+alias la='ls -A'
+alias less_alias="less $HOME/.zshaliases"
+alias less_env="less $HOME/.zshenv"
+alias less_func="less $HOME/.zshfunc"
+alias lnx1="ssh -l vgg lnx1.sr.bham.ac.uk"
+alias more_alias="more $HOME/.zshaliases"
+alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)"
+alias nds="nmcli dev status"
+alias nwoff="nmcli radio wifi off"
+alias nwon="nmcli radio wifi on"
+alias nix="~/bin/NixNote2-x86_64.AppImage"
+alias ohmyzsh="nvim ~/.oh-my-zsh"
+alias odw="cd ~/Documents/RC/divinum-officium/web && python -m http.server --cgi 8000 & "
+alias osxrw="sudo mount /dev/sda2 -t hfsplus -o rw,sizelimit=199622000640 /MacOSX"
+alias osxro="sudo mount /dev/sda2 -t hfsplus -o ro,sizelimit=199622000640 /MacOSX"
+alias osxdrw="sudo mount -o remount,rw,force /MacOSX-Data1"
+alias osxdrwx="sudo mount -o remount,rwx,force /MacOSX-Data1"
+alias osdxro="sudo mount -o remount,ro,force /MacOSX-Data1"
+alias osxd2rw="sudo mount -o remount,rw,force /MacOSX-Data2"
+alias osd2xro="sudo mount -o remount,ro,force /MacOSX-Data2"
+alias osxd3rw="sudo mount -o remount,rw,force /MacOSX-Data3"
+alias osd3xro="sudo mount -o remount,ro,force /MacOSX-Data3"
+alias pcmsyu="sudo pacman -Syyu" # update only standard pkgs
+alias pcrsua="pacaur -Sua --noconfirm" # update only AUR pkgs
+alias pcrsyu="pacaur -Syu --noconfirm" # update standard and AUR pkgs
+alias prot="chmod og-rx"
+alias pycharm="/usr/local/bin/pycharm &"
+alias qutebrowser="~/bin/scripts/open_url_in_instance.sh"
+alias ralias=". $HOME/.zshenv ; . ${HOME}/.zshaliases ; . ${HOME}/.zshfunc"
+alias rm="rm -f"
+alias sr='sr -browser=$BROWSERCLI' # cli browser
+alias surfraw='surfraw -browser=$BROWSER' # gui browser
+alias sucl="ssh -XC zuserver1.star.ucl.ac.uk"
+alias tetris="ssh netris.rocketnine.space"
+alias tmx='TERM="screen-256color" tmux -2'
+alias sock5="ssh -f -N -D 8765 vgg@star.herts.ac.uk"
+alias tpb="${HOME}/bin/scripts/torrshellscripts-master/thepiratebay/tpb.sh"
+alias ukali="sudo umount /Kali"
+alias unlock="sudo rm /var/lib/pacman/db.lck" # remove pacman lock
+alias uosx="sudo umount /MacOSX"
+alias w3ml="$BROWSERCLI http://localhost:8000"
+alias wanip="dig +short myip.opendns.com @resolver1.opendns.com"
+alias wget='wget -c' # continues/resumes
+alias wosqi="java -jar $COMP/Palm/webos/Homebrew/Tools/01-newWebOSQuickInstall-4.6.0.jar &"
+alias yaysua="yay -Sua --noconfirm" # update only AUR pkgs
+alias yaysyu="yay -Syu --noconfirm" # update standard and AUR pkgs
+alias ytv="/usr/bin/youtube-viewer"
+#-------- Fasd {{{
+#------------------------------------------------------
+# DEMO: http://www.youtube.com/watch?v=ur81Y-mV5Us
+# URL: https://github.com/clvv/fasd
+# DESC: jump to path or open recent files quickly from cli, better than autojump
+
+if which fasd >/dev/null; then
+ eval "$(fasd --init auto)" # get fasd working, initialization code
+ alias m='f -e $PLAYER' # open with video player
+ alias o='a -e $OPENER' # open any file
+ alias v='f -e $EDITOR' # open with text editor
+fi
+#}}}
+###############################################################################
+#
+# General --- }}}
+#
+###############################################################################
+###############################################################################
+#
+# ANALYSES SOFTWARE --- {{{
+#
+###############################################################################
+
+alias heainit=". $HEADAS/headas-init.sh"
+alias ciao="heainit;. $Astro/sw/CIAO/ciao-4.5/bin/ciao.bash"
+alias goaips=". ${ASTRO}/Radio/AIPS/LOGIN.SH"
+alias mendeley="${HOME}/bin/mendeleydesktop-1.17.6-linux-x86_64/bin/mendeleydesktop &"
+alias sasinit="heainit; . $SASDIR/setsas.sh"
+alias setodf="export SAS_ODF=${PWD}"
+alias updateccf="rsync -v -a --delete --delete-after --force --include='*.CCF' --exclude='*/' xmm.esac.esa.int::XMM_VALID_CCF $HOME/Astro/X-Ray/CCF/"
+###############################################################################
+#
+# ANALYSES SOFTWARE --- }}}
+#
+###############################################################################
+###############################################################################
+#
+# LINUX COMMANDS AND ALIASES --- }}}
+#
+###############################################################################
diff --git a/.zshenv b/.zshenv
new file mode 100644
index 0000000..5b08d4e
--- /dev/null
+++ b/.zshenv
@@ -0,0 +1,186 @@
+##########################################################
+#
+# Environment Variables -------- {{{
+#
+###########################################################
+
+###########################################################
+#
+#-------- General {{{
+#
+###########################################################
+
+export VMD1="/MacOSX-Data1"
+export VMD2="/MacOSX-Data2"
+export VMD3="/MacOSX-Data3"
+export VMD4="/MacOSX-Data4"
+
+export XDG_CONFIG_HOME="${HOME}/.config"
+export EDITOR="nvim"
+#export TERM="xterm-256color"
+# set display
+export DISPLAY=:0
+
+# find alternative apps if it is installed on your system
+#find_alt() { for i;do which "$i" >/dev/null && { echo "$i"; return 0;};done;return 1; }
+
+# set the default program
+# the first program in the array will be chosen as the default
+export OPENER=xdg-open
+export BROWSER=qutebrowser
+export BROWSERCLI=w3m
+export EBOOKER=ebook-viewer
+export EDITOR=nvim
+export FILEMANAGER=ranger
+export MUSICER=mpv
+export PAGER=less
+export PLAYER=mpv
+export READER=zathura
+export RTV_BROWSER=~/bin/scripts/urlportal.sh
+export IMAGEVIEWER=sxiv
+export CUPS_SERVER="star-server.herts.ac.uk"
+
+###########################################################
+#
+# General -------- }}}
+#
+###########################################################
+###########################################################
+#
+# PATH -------- {{{
+#
+###########################################################
+export BASE_DIR="$HOME"
+export U4_DIR="/user4"
+export ASTRO="${U4_DIR}/Astro"
+export ASTROM="${VMD1}/Astro"
+export ASTROMSW="${ASTROM}/sw"
+export ASTROPY="${ASTROMSW}/AstroPy"
+export ASTROX="${ASTRO}/X-Ray"
+export ASTROMX="${ASTROM}/X-Ray"
+
+export PATH="${HOME}/bin:${HOME}/.local/bin:${HOME}/.i3/scripts:${HOME}/bin/scripts:${HOME}/Sandbox/UoH/code-review.sh:${HOME}/.cargo/bin:${HOME}/go/bin\${HOME}/.emacs.d/bin:${HOME}/Astro/pluto/MyPython_Modules/bin:${HOME}/.symlinks:${ASTRO}:${ASTROX}:${ASTROX}/ds9:${ASTROX}/XPA:${ASTROX}/wcstools-3.9.2/bin:${ASTROX}/nxsa-cl-aioclient-8.4:/bin:/usr/local/bin:/usr/local/sbin/:/opt/local/bin:/opt/Palm/novacom/:/opt/PalmPDK/bin/:/opt/PalmSDK/Current/bin:/usr/bin/:/usr/bin/core_perl:/usr/bin/vendor_perl:"
+
+###########################################################
+#
+# }}} -------- PATH
+#
+###########################################################
+###########################################################
+#
+# FZF-Bibtex variables ------ {{{
+#
+###########################################################
+
+export FZF_BIBTEX_CACHEDIR="${HOME}/.cache/bibtex_cache"
+#export FZF_BIBTEX_SOURCES=""
+
+###########################################################
+#
+# Calibre variables ------ {{{
+#
+###########################################################
+
+export CMX_CALIBRE="${VMD2}/Calibre"
+export CMX_MAGS="${VMD2}/Magazines"
+export CMX_COMICS="${VMD2}/Comix"
+
+###########################################################
+#
+# }}} ------ Calibre variables
+#
+###########################################################
+###########################################################
+#
+# Astro -------- {{{
+#
+###########################################################
+
+export ADS_DEV_KEY="5vfbxrogMaC3CAXAqTW5W7GmSKxro6GGniTqHN1Y"
+export PLUTO_DIR="/home/archlinux/vgg/Astro/PLUTO"
+
+export HEADAS_VRSN="heasoft-6.20"
+export HEADAS_ARCH="x86_64-unknown-linux-gnu-libc2.22"
+export SAS_VRSN="xmmsas_20170112_1337"
+
+export AWD="${ASTROX}/WorkingDir"
+export HEADAS="${ASTROX}/${HEADAS_VRSN}/${HEADAS_ARCH}"
+export SASDIR="${ASTROX}/XMM-SAS/SAS/${SAS_VRSN}"
+export SAS_IMAGEVIEWER="$ASTROX/ds9/ds9"
+
+#export SAS_ODF="$HOME/Astro/X-Ray/ODF"
+# After odfingest has been run SAS_ODF needs to be set to the
+# /full/path/to/ODF/file*SUM.SAS file that has been created.
+
+export SAS_ODF="${AWD}/CU_Vir/2125_0677980501_SCX00000SUM.SAS"
+export SAS_CCF="${AWD}/ccf.cif"
+export SAS_CCFPATH="${ASTROSW}/ccf"
+export SAS_VERBOSITY=3
+export SAS_SUPPRESS_WARNING=3
+
+###########################################################
+#
+# }}} -------- Astro
+#
+###########################################################
+###########################################################
+#
+# Comp -------- {{{
+#
+###########################################################
+
+export COMP="${BASE_DIR}/Computing"
+export COMPD="${COMP}/Development"
+export COMPB="${COMPD}/BASH"
+export COMPC="${COMPD}/C++"
+export COMPL="${COMPD}/LinuxProgramming"
+export COMPP="${COMPD}/Perl"
+export COMPY="${COMPD}/Python"
+export PalmOS="${COMPD}/PalmOS"
+export ECLIPSE_HOME="/opt/eclipse44/eclipse"
+export webOS="${COMPD}/Palm/webOS"
+export IPKDIR="${COMP}/Palm/webos/BACKUPS/ipk-backups"
+
+export WEBOS_TOOLS="${COMP}/Palm/webos/Homebrew/Tools"
+
+export PYTUT_MASTER="${VMD2}/media/Youtube/PythonDataAnalysisTutorial"
+export PYTUT="${ASTRO}/SciPyNumpyTuts"
+
+###########################################################
+#
+# Comp -------- }}}
+#
+###########################################################
+###########################################################
+#
+#-------- Colours {{{
+#
+###########################################################
+
+export CHEATCOLOR=true
+export CLICOLOR=true
+export LSCOLORS='cxfxcxdxbxegedabagacad'
+
+###########################################################
+#
+# Colours -------- }}}
+#
+###########################################################
+###########################################################
+#
+#-------- SSH / ftp / rdesktop {{{
+#
+###########################################################
+
+export GPUServer="128.243.70.77"
+
+###########################################################
+#
+# SSH / ftp / rdesktop -------- }}}
+#
+##########################################################
+##########################################################
+#
+# #-------- Environment Variables #-------- }}}
+#
+###########################################################
diff --git a/.zshfunc b/.zshfunc
new file mode 100644
index 0000000..b9a888e
--- /dev/null
+++ b/.zshfunc
@@ -0,0 +1,5970 @@
+###########################################################
+#
+# #-------- Functions #-------- {{{
+#
+###########################################################
+###########################################################
+#------------Network {{{
+#
+# Identify ethernet device, typically eth0, but when the interface
+# is defined by udev this will be different (eg. enp2s0f0). The interfaces
+# can be found in /proc/net/dev
+#
+
+ip_geteif(){
+ export ETHERNET_IF=`{cat /proc/net/dev | awk 'NR>2' | awk '/e/' | awk -F: '{gsub(/ /,"",$1);print $1}' ; }`
+}
+# Identify wireless device, typically wlan0, but when the interface
+# is defined by udev this will be different (eg. wlp3s0b1). The interfaces
+# can be found in /proc/net/dev
+#
+
+ip_getwif(){
+ export WIRELESS_IF=`{cat /proc/net/dev | awk 'NR>2' | awk '/w/' | awk -F: '{gsub(/ /,"",$1);print $1}' ; }`
+}
+
+# Check to see if you have external connection and if so get the ip address.
+#
+ip_chkextnw(){
+ if ping -q -c 1 -W 1 8.8.8.8 > /dev/null ; then
+ echo -e "$1 : External:\t `wget -qO - http://icanhazip.com`" ;
+ else
+ echo -e "$1 : No External Network...\n";
+ fi
+}
+
+# Check to see if the interface is up and if so obtain the internal ip address
+ip_ifup(){
+ unset operstateFile ;
+ operstateFile="/sys/class/net/$1/operstate" ;
+ if [[ $(cat $operstateFile ) == "up" ]] ;
+ then
+ # check to see if external network is available
+ ip_chkextnw $1 ;
+ echo -e "$1 : Internal:\t `ip addr show $1 | grep inet\ | awk '{print $2}' | awk -F/ '{print $1}'`" ;
+ else
+ echo -e "$1 : No Network...\n";
+ fi
+}
+
+# Display the network information
+#
+ip_show(){
+ ip_geteif ;
+ ip_getwif ;
+
+ ip_ifup $ETHERNET_IF ;
+ ip_ifup $WIRELESS_IF ;
+}
+#
+# --- }}}
+###########################################################
+#------------Start up Message - Disk Size {{{
+# Print out a table of disk usage at start up
+startup_diskUsage(){
+
+df -hl | grep /dev/sda | sort -k6 | awk '!/efi/' | awk '{printf("%-12s\t:%5s /%5s free (%4s used)\n",$6,$4,$2,$5)}' ;
+
+}
+#
+# --- }}}
+###########################################################
+# ----------- VPNs {{{
+#
+
+mlvn-up(){
+ nmcli radio wifi on &&
+ nmcli con up id VM1835498 &&
+ vpn-up 80 ;
+}
+
+mlvn-dn(){
+ vpn-dn 80 &&
+ nmcli con down id VM1835498 &&
+ nmcli radio wifi off ;
+}
+
+car-wlan-up(){
+ nmcli con up id car-wlan ;
+}
+
+car-wlan-dn(){
+ nmcli con down id car-wlan ;
+}
+
+eduroam-up(){
+ nmcli con up id eduroam ;
+}
+
+eduroam-dn(){
+ nmcli con down id eduroam ;
+}
+
+#
+#
+vpn-import(){
+# create a new vpn connection and import an .ovpn file
+#for FILE1 in ~/AirVPN-OVPN/*.ovpn ; do FILE2=`basename -s .ovpn $FILE1` ; nm-import-openvpn $FILE1 $FILE2; done
+ FILE1="$1"
+ FILE2=`basename -s .ovpn $FILE1` ;
+ nm-import-openvpn $FILE1 $FILE2 ;
+ sudo cp $FILE2 /etc/NetworkManager/system-connections/ ;
+ sudo chmod 600 /etc/NetworkManager/system-connections/$FILE2 ;
+ sudo nmcli con load /etc/NetworkManager/system-connections/$FILE2 ;
+}
+#
+#
+
+vpn_list_avail(){
+ nmcli con show | awk '/vpn/ {print NR, $1}' ; }
+vpn_list_AT(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_AT|_Austria/ {print NR, $1}' ; }
+vpn_list_BE(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_BE|_Belgium/ {print NR, $1}' ; }
+vpn_list_BG(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_BG|_Bulgaria/ {print NR, $1}' ; }
+vpn_list_CA(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_CA|_Canada/ {print NR, $1}' ; }
+vpn_list_CH(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_CH|_Switzerland/ {print NR, $1}' ; }
+vpn_list_CZ(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_CZ|_Czech-Republic/ {print NR, $1}' ; }
+vpn_list_DE(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_DE|_Germany/ {print NR, $1}' ; }
+vpn_list_ES(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_ES|_Spain/ {print NR, $1}' ; }
+vpn_list_FR(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_FR/ {print NR, $1}' ; }
+vpn_list_GB(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_GB|_United-Kingdom/ {print NR, $1}' ; }
+vpn_list_HK(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_HK|_Hong-Kong/ {print NR, $1}' ; }
+vpn_list_LT(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_LT|_Lithuania/ {print NR, $1}' ; }
+vpn_list_LV(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_LV|_Latvia/ {print NR, $1}' ; }
+vpn_list_NL(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_NL|_Netherlands/ {print NR, $1}' ; }
+vpn_list_RO(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_RO|_Romania/ {print NR, $1}' ; }
+vpn_list_SE(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_SE|_Sweden/ {print NR, $1}' ; }
+vpn_list_SG(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_SG|_Singapore/ {print NR, $1}' ; }
+vpn_list_UA(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_UA|_Ukraine/ {print NR, $1}' ; }
+vpn_list_US(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk '/_US|_United-States/ {print NR, $1}' ; }
+
+vpn_select(){
+ nmcli con show | awk '/vpn/ {print $1}' | awk -v var1=$1 'NR==var1 {print $1}' ; }
+
+vpn-up(){
+ if [ $# -lt 1 ]; then
+ echo -e "Before you can connect to the required vpn location, use vpn_list_avail to list all available vpns."
+ echo -e "Alternatively you can use one of the country specific vpn lists, eg: vpn_list_GB or vpn_list_US, etc."
+ echo -e "Note the index number for the required vpn."
+ echo -e "vpn-up will then connect to the selected location"
+ echo -e "\n\nUsage:\n$0 <IndexNumber>"
+ echo -e "\nExample:\n$0 76\n"
+ return 1
+ fi
+
+ vpn_select $1 | awk '{system("nmcli con up id " $1)}' ; }
+
+vpn-dn(){
+ nmcli con show --active | awk '/vpn/ {print $1}' | awk '{system("nmcli con down id " $1)}' ; }
+
+vpn_am-up(){
+ nmcli con up id AirVPN_America_UDP-443 }
+vpn_am-dn(){
+ nmcli con down id AirVPN_America_UDP-443 }
+vpn_as-up(){
+ nmcli con up id AirVPN_Asia_UDP-443 }
+vpn_as-dn(){
+ nmcli con down id AirVPN_Asia_UDP-443 }
+vpn_cato-up(){
+ nmcli con up id AirVPN_CA-Toronto-Ontario_Agena_UDP-443 }
+vpn_cato-dn(){
+ nmcli con down id AirVPN_CA-Toronto-Ontario_Agena_UDP-443 }
+vpn_eu-up(){
+ nmcli con up id AirVPN_Europe_UDP-443 }
+vpn_eu-dn(){
+ nmcli con down id AirVPN_Europe_UDP-443 }
+vpn_gblon1-up(){
+ nmcli con up id AirVPN_GB-London_Bellatrix_UDP-443 }
+vpn_gblon1-dn(){
+ nmcli con down id AirVPN_GB-London_Bellatrix_UDP-443 }
+vpn_gblon2-up(){
+ nmcli con up id AirVPN_GB-London_Algedi_UDP-443 }
+vpn_gblon2-dn(){
+ nmcli con down id AirVPN_GB-London_Algedi_UDP-443 }
+vpn_gblon3-up(){
+ nmcli con up id AirVPN_GB-London_Alshain_UDP-443 }
+vpn_gblon3-dn(){
+ nmcli con down id AirVPN_GB-London_Alshain_UDP-443 }
+vpn_gblon4-up(){
+ nmcli con up id AirVPN_GB-London_Asterion_UDP-443 }
+vpn_gblon4-dn(){
+ nmcli con down id AirVPN_GB-London_Asterion_UDP-443 }
+vpn_gbmdh-up(){
+ nmcli con up id AirVPN_GB-Maidenhead_Carinae_UDP-443 }
+vpn_gbmdh-dn(){
+ nmcli con down id AirVPN_GB-Maidenhead_Carinae_UDP-443 }
+vpn_gbman-up(){
+ nmcli con up id AirVPN_GB-Manchester_Nashira_UDP-443 }
+vpn_gbman-dn(){
+ nmcli con down id AirVPN_GB-Manchester_Nashira_UDP-443 }
+vpn_hk-up(){
+ nmcli con up id AirVPN_HK-HongKong_Yed_UDP-443 }
+vpn_hk-dn(){
+ nmcli con down id AirVPN_HK-HongKong_Yed_UDP-443 }
+vpn_us-up(){
+ nmcli con up id AirVPN_United-States_UDP-443 }
+vpn_us-dn(){
+ nmcli con down id AirVPN_United-States_UDP-443 }
+vpn_usla-up(){
+ nmcli con up id AirVPN_US-LosAngeles_Sabik_UDP-443 }
+vpn_usla-dn(){
+ nmcli con down id AirVPN_US-LosAngeles_Sabik_UDP-443 }
+
+# --- }}}
+############################################################
+#------------ Login / Shell {{{
+prompt_bash() {
+ export PS1="${Color_off}\
+ [${Cyan}\u${Color_off}@${Yellow}\h${Color_off}] \
+ ${BBlue}\w${Color_off}\\$ " }
+# --- }}}
+############################################################
+#--- macfanctld--- {{{
+#
+macf(){
+ sudo /usr/sbin/macfanctld;
+ sudo /usr/sbin/thermald;
+ sudo systemctl start tlp;
+ sudo tlp start ; }
+# --- }}}
+############################################################
+#--- compile neomutt--- {{{
+# shell function to compile neomutt:
+
+ compile_neomutt () {
+ #./configure prefix=/usr/local/bin -enable-pop -enable-imap -enable-smtp -with-curses \
+ ./configure prefix=/usr/local/bin -enable-pop -enable-imap -enable-smtp -with-slang \
+ -enable-sidebar -enable-notmuch -enable-nntp -enable-compressed \
+ -enable-hcache -with-tokyocabinet -with-ssl -with-gnutls -with-idn -with-included-gettext \
+ -with-regex -enable-locales-fix -disable-dependency-tracking }
+
+# --- }}}
+############################################################
+#--- zsh history fix--- {{{
+#
+zsh_hist_fix(){
+ cd $HOME; mv -f .zsh_history .zsh_history_bad;
+ strings .zsh_history_bad > .zsh_history;
+ fc -R .zsh_history; rm -f .zsh_history_bad
+ }
+
+# --- }}}
+############################################################
+#--- simple note taking function --- {{{
+#
+notes(){
+ if [ ! -z "$1" ]; then
+ echo $(date +"%Y%m%d-%H%M%S") $@ >> "$HOME/vimwiki/TempNotes.md"
+ else
+ cat - >> "$HOME/vimwiki/TempNotes.md"
+ fi
+ }
+
+# --- }}}
+############################################################
+#--- KeepassX command line interface --- {{{
+#
+kpcli(){
+ /bin/kpcli --kdb $HOME/Documents/20151120.kdbx
+ }
+
+# --- }}}
+###########################################################
+#-------- Transmission CLI {{{
+# this is notes for video: http://www.youtube.com/watch?v=ee4XzWuapsE
+#------------------------------------------------------
+# lightweight torrent daemon, has option for cli, webui, ncurses, and gui frontend
+# demo video: http://www.youtube.com/watch?v=ee4XzWuapsE
+# WebUI: http://localhost:9091/transmission/web/
+# http://192.168.1.xxx:9091/transmission/web/
+tsm-clearcompleted() {
+ transmission-remote -l | grep 100% | grep Done | \
+ awk '{print $1}' | xargs -n 1 -I % transmission-remote -t % -r ;}
+tsm() { transmission-remote --list ;}
+ # numbers of ip being blocked by the blocklist
+# credit: smw from irc #transmission
+tsm-count() { echo "Blocklist rules:" $(curl -s --data \
+'{"method": "session-get"}' localhost:9091/transmission/rpc -H \
+"$(curl -s -D - localhost:9091/transmission/rpc | grep X-Transmission-Session-Id)" \
+| cut -d: -f 11 | cut -d, -f1) ;}
+# demo video: http://www.youtube.com/watch?v=TyDX50_dC0M
+tsm-blocklist() { $PATH_SCRIPTS/blocklist.sh ;} # update blocklist
+tsm-daemon() { transmission-daemon ;}
+tsm-quit() { killall transmission-daemon ;}
+tsm-altspeedenable() { transmission-remote --alt-speed ;} # limit bandwidth
+tsm-altspeeddisable() { transmission-remote --no-alt-speed ;} # dont limit bandwidth
+tsm-add() { transmission-remote --add "$1" ;}
+tsm-askmorepeers() { transmission-remote -t"$1" --reannounce ;}
+tsm-pause() { transmission-remote -t"$1" --stop ;} # <id> or all
+tsm-start() { transmission-remote -t"$1" --start ;} # <id> or all
+tsm-purge() { transmission-remote -t"$1" --remove-and-delete ;} # delete data also
+tsm-remove() { transmission-remote -t"$1" --remove ;} # leaves data alone
+tsm-info() { transmission-remote -t"$1" --info ;}
+tsm-speed() { while true;do clear; transmission-remote -t"$1" -i | grep Speed;sleep 1;done ;}
+tsm-verify() { transmission-remote -t"$1" --verify ;} # verify a torrent
+
+# https://github.com/fagga/transmission-remote-cli
+# demo video: http://www.youtube.com/watch?v=hLz7ditUwY8
+tsm-ncurse() { tremc ;}
+#extract torrent files from magnet link
+tsm-m2t(){ aria2c --bt-metadata-only=true --bt-save-metadata=true "$1"}
+
+# --- }}}
+############################################################
+#-------- Firefox profile{{{
+firefox_J() { /usr/bin/firefox -no-remote -P Jupyter > /dev/null 2>&1 & }
+firefox_Y() { /usr/bin/firefox -no-remote -P Youtube & }
+firefox_T() { /usr/bin/firefox -no-remote -P Torrent & }
+# --- }}}
+############################################################
+#-------- DVD playback{{{
+dvd_play() { mplayer dvdnav:// -mouse-movements \
+ -dvd-device /dev/dvd ;}
+# --- }}}
+############################################################
+#-------- DVD rip{{{
+dvd_rip() {
+ rawout=$(HandBrakeCLI -i /dev/dvd -t 0 2>&1 >/dev/null);
+ count=$(echo $rawout | grep -Eao "\\+ title [0-9]+:" | wc -l);
+ for i in $(seq $count); do HandBrakeCLI -i /dev/dvd -t $i -Z "Very Fast 720p30" -a 2 -o ${1}.mp4 ; done
+ }
+# --- }}}
+############################################################
+#-------- Configurations {{{
+#------------------------------------------------------
+cfg-afewrc() { $EDITOR ~/.config/afew/config ;}
+cfg-alacritty() { $EDITOR ~/.config/alacritty/alacritty.yml;}
+cfg-bashrc() { $EDITOR $HOME/.bashrc ;}
+cfg-castero() { $EDITOR ~/.config/castero/castero.conf ;}
+cfg-conkyrc() { $EDITOR $HOME/.conkyrc ;}
+cfg-dotalias() { $EDITOR $HOME/.bashrc.d/02aliases.bash.linux ;}
+cfg-dotenvs() { $EDITOR $HOME/.bashrc.d/01environ.bash.linux ;}
+cfg-dotfuncs() { $EDITOR $HOME/.bashrc.d/03functions.bash.linux ;}
+cfg-dotopts() { $EDITOR $HOME/.bashrc.d/04options.bash.linux ;}
+cfg-dunstrc() { $EDITOR $XDG_CONFIG_HOME/dunst/dunstrc ;}
+cfg-fstab() { sudo $EDITOR /etc/fstab ;}
+cfg-group() { sudo $EDITOR /etc/group ;}
+cfg-grub() { sudo $EDITOR /etc/default/grub ;}
+cfg-hosts() { sudo $EDITOR /etc/hosts ;}
+cfg-i3wm() { $EDITOR ~/.i3/config ;}
+cfg-i3blocks() { $EDITOR ~/.i3/i3blocks.conf ;}
+cfg-inputrc() { $EDITOR ~/.inputrc ;}
+cfg-livestreamer() { $EDITOR ~/.livestreamerrc ;}
+cfg-mbsyncrc() { $EDITOR ~/.mbsyncrc ;}
+cfg-mc() { $EDITOR ~/.config/mc/ini ;}
+cfg-mcomix() { $EDITOR ~/.config/mcomix/keybindings.conf ;}
+cfg-mpds() { sudo $EDITOR /etc/mpd.conf ;}
+cfg-mpd() { $EDITOR ~/.config/mpd/mpd.conf ;}
+cfg-mplayer() { $EDITOR ~/.config/mplayer/config ;}
+cfg-mpv() { $EDITOR ~/.config/mpv/input.conf ;}
+cfg-msmtprc() { $EDITOR ~/.config/msmtp/config ;}
+cfg-muttrc() { $EDITOR ~/.config/mutt/muttrc ;}
+cfg-muttrc-h() { $EDITOR ~/.config/mutt/accounts/1-herts.muttrc ;}
+cfg-muttrc-b() { $EDITOR ~/.config/mutt/accounts/2-bt.muttrc ;}
+cfg-muttrc-bo() { $EDITOR ~/.config/mutt/accounts/3-bt-offline.muttrc ;}
+#cfg-mutt-g1() { $EDITOR ~/.mutt/account.com.gmail.gfgm ;}
+#cfg-mutt-g2() { $EDITOR ~/.mutt/account.com.gmail.vggm ;}
+cfg-nanorc() { $EDITOR ~/.nanorc;}
+cfg-ncmpcpp() { $EDITOR ~/.config/ncmpcpp/config ;}
+cfg-ncmpcpp-bindings() { $EDITOR ~/.config/ncmpcpp/bindings ;}
+cfg-newsboat() { $EDITOR ~/.newsboat/config ;}
+cfg-newsboat-queue() { $EDITOR ~/.newsboat/queue ;}
+cfg-newsboat-urls() { $EDITOR ~/.newsboat/urls ;}
+cfg-notmuchrc() { $EDITOR ~/.notmuch-config ;}
+cfg-nvim() { $EDITOR ~/.config/nvim/init.vim ;}
+cfg-offlineimap() { $EDITOR $XDG_CONFIG_HOME/offlineimap/config ;}
+cfg-profile() { $EDITOR ~/.profile ;}
+cfg-pulseaudio() { sudo $EDITOR /etc/pulse/default.pa ;}
+cfg-pyload() { $EDITOR ~/.pyload/pyload.conf ;}
+cfg-pyradio() { $EDITOR ~/.pyradio.csv ;}
+cfg-qutebrowser() { $EDITOR ~/.config/qutebrowser/config.py ;}
+#cfg-qutebrowser() { $EDITOR ~/.config/qutebrowser/qutebrowser.conf ;}
+cfg-qutebrowser-keys() { $EDITOR ~/.config/qutebrowser/keys.conf ;}
+cfg-ranger() { $EDITOR ~/.config/ranger/rc.conf ;}
+cfg-ranger-rifle() { $EDITOR ~/.config/ranger/rifle.conf ;}
+cfg-ranger-scope() { $EDITOR ~/.config/ranger/scope.sh ;}
+cfg-rofi() { $EDITOR ~/bin/scripts/rofi-scripts-collection/rofi-bangs.sh ;}
+cfg-ssh-client() { sudo $EDITOR /etc/ssh/ssh_config ;}
+cfg-ssh-daemon() { sudo $EDITOR /etc/ssh/sshd_config ;}
+cfg-sudoers() { sudo $EDITOR /etc/sudoers ;}
+cfg-termite() { $EDITOR ~/.config/termite/config ;}
+cfg-tmuxrc() { $EDITOR ~/.tmux.conf ;}
+cfg-torrc() { sudo $EDITOR /etc/tor/torrc ;}
+cfg-tpb() { $EDITOR $HOME/bin/scripts/torrshellscripts-master/thepiratebay_se/tpb.sh ;}
+cfg-transmission-daemon() { $EDITOR ~/.config/transmission-daemon/settings.json ;}
+cfg-transmission-ncurse() { $EDITOR ~/.config/transmission-remote-cli/settings.cfg ;}
+cfg-trz() { $EDITOR $HOME/bin/scripts/torrshellscripts-master/torrentz_eu/torrentz_eu.sh ;}
+cfg-tridactyl() { $EDITOR $HOME/.config/tridactyl/tridactylrc ;}
+cfg-urlview() { $EDITOR ~/.urlview ;}
+cfg-updatedb() { sudo $EDITOR /etc/updatedb.conf ;}
+cfg-vifmrc() { $EDITOR ~/.vifmrc ;}
+cfg-vimrc() { $EDITOR ~/.vimrc ;}
+cfg-w3m() { $EDITOR ~/.w3m/config ;}
+cfg-weechat() { $EDITOR ~/.weechat/weechat.conf ;}
+cfg-w3m-keymap() { $EDITOR ~/.w3m/keymap ;}
+cfg-xdefaults() { $EDITOR ~/.Xdefaults ;}
+cfg-xresources() { $EDITOR ~/.Xresources ;}
+cfg-ytdl() { $EDITOR $XDG_CONFIG_HOME/youtube-dl/config ;}
+cfg-zshrc() { $EDITOR ~/.zshrc ;}
+cfg-zurlrc() { $EDITOR ~/.zurlrc ;}
+cfg-i3keylist(){
+echo " \$mod+{}"
+echo " ======="
+echo " \$mod+a focus parent"
+echo " \$mod+b split h"
+echo " \$mod+d exec --no-startup-id dmenu_run"
+echo " \$mod+e exec --no-startup-id $term -e \"mutt -F ~/.muttrc\""
+echo " \$mod+f fullscreen toggle"
+echo " \$mod+h focus left"
+echo " \$mod+j focus down"
+echo " \$mod+k focus up"
+echo " \$mod+l focus right"
+echo " \$mod+m exec --no-startup-id /usr/bin/mplayer "
+echo " \$mod+n border normal"
+echo " \$mod+r exec --no-startup-id $term -e ranger"
+echo " \$mod+t layout toggle split"
+echo " \$mod+u border none"
+echo " \$mod+v split v"
+echo " \$mod+w exec --no-startup-id $browser"
+echo " \$mod+y border pixel 2"
+echo " \$mod+z split v, layout stacking"
+echo " \$mod+space focus mode_toggle"
+echo " \$mod+Return exec --no-startup-id "
+echo " \$mod+grave exec --no-startup-id $HOME/bin/scripts/any_term_dropdown.sh"
+echo " \$mod+F11 exec --no-startup-id amixer set Master 5%-"
+echo " \$mod+F12 exec --no-startup-id amixer set Master 5%+"
+echo " \$mod+F1 exec --no-startup-id xbacklight -dec 5 "
+echo " \$mod+F2 exec --no-startup-id xbacklight -inc 5 "
+echo " \$mod+F4 mode \"$mode_system\""
+echo ""
+echo " ======="
+echo " \$mod+Shift+{}"
+echo " ======="
+echo " \$mod+Shift+c reload"
+echo " \$mod+Shift+d exec --no-startup-id rofi -show run -lines 10 -eh 2 -width 80 "
+echo " -padding \$(($(xwininfo -root | awk '/Height/ {print $2}')/4)) "
+echo " -opacity \"75\" -bw 0 -bc \"\$base02\" -bg \"$base02\" -fg \"$base03\" "
+echo " -hlbg \"\$base02\" -hlfg \"#9575cd\" -font \"System San Francisco Display 12\""
+echo " \$mod+Shift+e exec --no-startup-id \"i3-nagbar -t warning -m 'You pressed the exit shortcut.\""
+echo " Do you really want to exit i3? This will end your X session.' -b \ "
+echo " 'Yes, exit i3' 'i3-msg exit'"
+echo " \$mod+Shift+f exec --no-startup-id /usr/bin/firefox -no-remote -P default"
+echo " \$mod+Shift+h move left"
+echo " \$mod+Shift+i exec --no-startup-id /usr/bin/firefox -no-remote -P Jupyter"
+echo " \$mod+Shift+j move down"
+echo " \$mod+Shift+k move up"
+echo " \$mod+Shift+l move right"
+echo " \$mod+Shift+m exec --no-startup-id /usr/bin/mpv"
+echo " \$mod+Shift+n exec --no-startup-id /usr/bin/nm-applet"
+echo " \$mod+Shift+q kill"
+echo " \$mod+Shift+r restart"
+echo " \$mod+Shift+t exec --no-startup-id /usr/bin/firefox -private-window -no-remote -P Torrent "
+echo " \$mod+Shift+u resize shrink height 10 px or 10 ppt"
+echo " \$mod+Shift+w exec --no-startup-id /usr/local/bin/eclipse/eclipse "
+echo " \$mod+Shift+y exec --no-startup-id /usr/bin/firefox -no-remote -P Youtube"
+echo " \$mod+Shift+space floating toggle"
+echo " \$mod+Shift+Return exec --no-startup-id $term -e tmux"
+echo ""
+echo " ======="
+echo " \$mod+Ctrl+{}"
+echo " ======="
+echo " \$mod+Ctrl+r mode \"resize\" "
+echo " \$mod+Ctrl+d gaps inner current set 0; gaps outer current set 0"
+echo " \$mod+Ctrl+t gaps inner current set 15; gaps outer current set 15"
+echo ""
+echo " \$mod+Ctrl+i resize grow height 10 px or 10 ppt"
+echo " \$mod+Ctrl+o resize grow width 10 px or 10 ppt"
+echo " \$mod+Ctrl+u resize shrink height 10 px or 10 ppt"
+echo " \$mod+Ctrl+y resize shrink width 10 px or 10ppt"
+echo ""
+echo " \$mod+Ctrl+h gaps inner current plus 5"
+echo " \$mod+Ctrl+j gaps outer current minus 5"
+echo " \$mod+Ctrl+k gaps outer current plus 5"
+echo " \$mod+Ctrl+l gaps inner current minus 5"
+echo " \$mod+Ctrl+space exec --no-startup-id $HOME/bin/scripts/rofi-scripts-collection/rofi-bangs.sh \""
+echo " -font \"System San Francisco Display 12\" "
+echo " \$mod+Ctrl+Return exec --no-startup-id guake"
+echo ""
+echo " ======="
+
+
+#####################################################
+#
+# --- }}}
+}
+# --- }}}
+###########################################################
+#-------- Configurations Reload {{{
+#------------------------------------------------------
+rld-bashrc() { source ~/.bashrc ;}
+rld-font() { fc-cache -v -f ;}
+rld-grub() { sudo grub-mkconfig -o /boot/grub/grub.cfg ;}
+rld-updatedb() { sudo updatedb ;}
+rld-xdefaults() { xrdb ~/.Xdefaults ;}
+rld-xmodmap() { xmodmap ~/.Xmodmap ;}
+rld-xresources() { xrdb -load ~/.Xresources ;}
+rld-zshrc() { source ~/.zshrc ;}
+# }}}
+###########################################################
+#-------- IPlayer {{{
+
+get_iplayer-list(){ clear ; for FILE in `cat ToDownloadList`; do URI=$FILE; echo "Downloading $URI"; ${HOME}/bin/get_iplayer --modes=flashhigh,hlshigh --url $URI; done}
+tvlist(){ clear;
+
+echo "bbc1"
+echo "bbc2"
+echo "bbc3"
+echo "bbc4"
+echo "bbcn"
+echo "cbbc"
+echo "cbeebies"
+echo "itv"
+echo "itv2"
+echo "itv3"
+echo "itv4"
+echo "citv"
+echo "ch4"
+echo "e4"
+echo "more4"
+echo "film4"
+echo "film4+1"
+echo "ch5"
+echo "5star"
+echo "5star+1"
+echo "5usa"
+echo "5usa+1"
+echo "dave"
+echo "spike"
+echo "universal"
+echo "syfy"
+echo "sony"
+echo "discovery"
+echo "vice"
+echo "natgeo"
+echo "eurosport1"
+echo "eurosport2"
+echo "boxnation"
+echo "nickelodeon"
+echo "nickjr"
+echo "cartoonnetwork"
+echo "boomerang"
+
+echo "rai1"
+echo "rai2"
+echo "rai3"
+echo "rai4"
+echo "rai5"
+echo "raipremium"
+echo "raimovie"
+echo "raisport"
+echo "rainews24"
+echo "padrepio"
+
+echo "ewtn"
+}
+
+livemass(){ mpv http://34.232.8.78:1935/live/live/chunklist_w398967804.m3u8 }
+bbc1(){ streamlink https://tvplayer.com/watch/bbcone 2>&1 & }
+bbc2(){ streamlink https://tvplayer.com/watch/bbctwo 2>&1 & }
+bbc4(){ streamlink https://tvplayer.com/watch/bbcfour 2>&1 & }
+bbcn(){ streamlink https://tvplayer.com/watch/bbcone 2>&1 & }
+cbeebies(){ streamlink https://tvplayer.com/watch/cbeebies 2>&1 & }
+cbbc(){ streamlink https://tvplayer.com/watch/cbbc 2>&1 & }
+itv(){ streamlink https://tvplayer.com/watch/itv 2>&1 & }
+itv2(){ streamlink https://tvplayer.com/watch/itv2 2>&1 & }
+itv3(){ streamlink https://tvplayer.com/watch/itv3 2>&1 & }
+itv4(){ streamlink https://tvplayer.com/watch/itv4 2>&1 & }
+citv(){ streamlink https://tvplayer.com/watch/citv 2>&1 & }
+ch4(){ streamlink https://tvplayer.com/watch/channel4 2>&1 & }
+more4(){ streamlink https://tvplayer.com/watch/more4 2>&1 & }
+#e4(){mpv http://46.249.60.210:15099/play/a00h &> /dev/null & }
+film4(){mpv http://195.189.203.18:8080/play/a01c &> /dev/null & }
+film4_plus1(){mpv http://195.189.203.18:8080/play/a01d &> /dev/null & }
+ch5(){ streamlink https://tvplayer.com/watch/five 2>&1 & }
+5star(){ streamlink https://tvplayer.com/watch/5star 2>&1 & }
+5star_plus1(){mpv http://46.249.60.210:15099/play/a01s &> /dev/null & }
+5usa(){mpv http://46.249.60.210:15099/play/a01o &> /dev/null & }
+5usa_plus1(){mpv http://46.249.60.210:15099/play/a01p &> /dev/null & }
+dave(){ streamlink https://tvplayer.com/watch/dave 2>&1 & }
+spike(){ streamlink https://tvplayer.com/watch/spike 2>&1 & }
+universal(){ streamlink https://tvplayer.com/watch/universalchannel 2>&1 & }
+syfy(){ streamlink https://tvplayer.com/watch/syfy 2>&1 & }
+sony(){ streamlink https://tvplayer.com/watch/sonyentertainment 2>&1 & }
+discovery(){ streamlink https://tvplayer.com/watch/discovery 2>&1 & }
+vice(){ streamlink https://tvplayer.com/watch/viceland 2>&1 & }
+natgeo(){ streamlink https://tvplayer.com/watch/nationalgeographic 2>&1 & }
+eurosport1(){ streamlink https://tvplayer.com/watch/eurosport1 2>&1 & }
+eurosport2(){ streamlink https://tvplayer.com/watch/eurosport2 2>&1 & }
+boxnation(){ streamlink https://tvplayer.com/watch/boxnation 2>&1 & }
+nickelodeon(){ streamlink https://tvplayer.com/watch/nickelodeon 2>&1 & }
+nickjr(){ streamlink https://tvplayer.com/watch/nickjr 2>&1 & }
+cartoonnetwork(){ streamlink https://tvplayer.com/watch/cartoonnetwork 2>&1 & }
+boomerang(){ streamlink https://tvplayer.com/watch/boomerang 2>&1 & }
+
+rai1(){ streamlink http://www.raiplay.it/dirette/rai1 2>&1 & }
+rai2(){ streamlink http://www.raiplay.it/dirette/rai2 2>&1 & }
+rai3(){ streamlink http://www.raiplay.it/dirette/rai3 2>&1 & }
+rai4(){ streamlink http://www.raiplay.it/dirette/rai4 2>&1 & }
+rainews24(){ streamlink http://www.raiplay.it/dirette/rainews24 2>&1 & }
+raisport(){ streamlink http://www.raiplay.it/dirette/raisport 2>&1 & }
+raimovie(){ streamlink http://www.raiplay.it/dirette/raimovie 2>&1 & }
+raipremium(){ streamlink http://www.raiplay.it/dirette/raipremium 2>&1 & }
+
+padrepio(){mpv http://5.255.90.175:3000/play/a05l &> /dev/null & }
+
+ewtn(){mpv http://ewtnmmd.mmdlive.lldns.net/ewtnmmd/42a5a390e56f40d7a5ae90ccd36ce775/playlist.m3u8 &> /dev/null &}
+
+# }}}
+###########################################################
+#-------- Novacom {{{
+nova-up(){ echo "nova-up:...:"; sudo -E novacomd -d; }
+nova-down(){sudo -E kill -9 $(echo `ps aux | grep novacomd | awk '/root/{print $2}'`); echo "nova-down:...completed:"; }
+pre2(){ novacom -d roadrunner-linux -t open tty://; }
+pre3(){ novacom -d mantaray-linux -t open tty:// ;}
+touchpad(){ novacom -d topaz-linux -t open tty:// ;}
+tptoolbox() { sh /home/archlinux/vgg/Computing/Palm/webos/Homebrew/Tools/07-tptoolbox_v42/tptb_v42_nix.sh ;}
+veer(){ novacom -d broadway-linux -t open tty:// ;}
+preftp(){ ftp preanon@webosftp.qualitis.hu ;}
+preweb(){ w3m ftp://preanon@webosftp.qualitis.hu ;}
+# }}}
+###########################################################
+#-------- Racoon {{{
+racoon() {java -jar /home/archlinux/vgg/bin/raccoon-4.15.0.jar & >/dev/null }
+# }}}
+###########################################################
+#-------- VirtualBox {{{
+
+vbx-list(){ # List available vms
+
+vboxmanage list vms ; }
+
+vbx-info(){ # Display info about vm
+
+ if [ $# -lt 1 ]; then
+ echo -e "Display info for available VirtualBox vms."
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage showvminfo $1 ;
+}
+
+vbx-Start(){ # Start up the vm
+
+ if [ $# -lt 1 ]; then
+ echo -e "Start up the VirtualBox vm."
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage startvm $1 ;
+}
+
+vbx-start(){ # Start up the vm (headless)
+
+ if [ $# -lt 1 ]; then
+ echo -e "Start up the VirtualBox vm in headless mode."
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage startvm $1 --type headless ;
+}
+
+vbx-save(){ # Save the state of the vm and then close it down
+
+ if [ $# -lt 1 ]; then
+ echo -e "Save the state of the Virtual Box vm and then close it down"
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage controlvm $1 savestate ;
+}
+
+vbx-stop(){ # Stop/power down the vm
+
+ if [ $# -lt 1 ]; then
+ echo -e "Stop/Power down the VirtualBox vm."
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage controlvm $1 poweroff ;
+}
+
+vbx-del(){ # Delete and unregister the vm. Also removes all hard disk images, machine xml file, log files and machine directory.
+ # Machine should already be powered off.
+
+ if [ $# -lt 1 ]; then
+ echo -e "Delete and unregister the Virtual Box vm."
+ echo -e "Virtual Box vm should already be powered off."
+ echo -e "\nUsage:\n$0 <VM>"
+ echo -e "\nExample:\n$0 UbuntuVM\n"
+ return 1
+ fi
+
+ vboxmanage unregistervm --delete $1 ;
+}
+
+vbx-sl7(){ ssh -p 3022 vgg@127.0.0.1 ; } # ssh into sl7 vm.
+vbx-sl7x(){ ssh -X -p 3022 vgg@127.0.0.1 ; } # ssh into sl7 vm.
+vbx-cr8sl7(){ sh ${HOME}/bin/VirtualBoxTest/createvm.sh ; } # Create SL7 vm
+vbx-edt-cr8sl7(){ $EDITOR ${HOME}/bin/VirtualBoxTest/createvm.sh ; } # Edit the creation script for SL7 vm
+
+# }}}
+###########################################################
+#-------- VMWare {{{
+
+#vmw-list(){ # List available vms
+
+#vboxmanage list vms ; }
+
+#vmw-info(){ # Display info about vm
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Display info for available VirtualBox vms."
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage showvminfo $1 ;
+#}
+
+#vmw-Start(){ # Start up the vm
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Start up the VirtualBox vm."
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage startvm $1 ;
+#}
+
+#vmw-start(){ # Start up the vm (headless)
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Start up the VirtualBox vm in headless mode."
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage startvm $1 --type headless ;
+#}
+
+#vmw-save(){ # Save the state of the vm and then close it down
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Save the state of the Virtual Box vm and then close it down"
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage controlvm $1 savestate ;
+#}
+
+#vmw-stop(){ # Stop/power down the vm
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Stop/Power down the VirtualBox vm."
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage controlvm $1 poweroff ;
+#}
+
+#vmw-del(){ # Delete and unregister the vm. Also removes all hard disk images, machine xml file, log files and machine directory.
+ ## Machine should already be powered off.
+
+ #if [ $# -lt 1 ]; then
+ #echo -e "Delete and unregister the Virtual Box vm."
+ #echo -e "Virtual Box vm should already be powered off."
+ #echo -e "\nUsage:\n$0 <VM>"
+ #echo -e "\nExample:\n$0 UbuntuVM\n"
+ #return 1
+ #fi
+
+ #vboxmanage unregistervm --delete $1 ;
+#}
+
+#vmw-sl7(){ ssh -p 3022 vgg@127.0.0.1 ; } # ssh into sl7 vm.
+#vmw-sl7x(){ ssh -X -p 3022 vgg@127.0.0.1 ; } # ssh into sl7 vm.
+#vmw-cr8sl7(){ sh ${HOME}/bin/VirtualBoxTest/createvm.sh ; } # Create SL7 vm
+#vmw-edt-cr8sl7(){ $EDITOR ${HOME}/bin/VirtualBoxTest/createvm.sh ; } # Edit the creation script for SL7 vm
+
+# }}}
+###########################################################
+#-------- Tmux Sessions {{{
+#------------------------------------------------------
+# tmux helps preventing crashes
+# when running vim/nvim from within tmux.
+# (https://github.com/tmux/tmux/issues/1593)
+#------------------------------------------------------
+#
+tmx-main() {
+ TERM="screen-256color" tmux new-session -s 'WongFeiHong' -d ;
+ TERM="screen-256color" tmux new-window -n 'Ranger' -c $HOME ;
+ TERM="screen-256color" tmux send-keys 'ranger' 'Enter' ;
+ TERM="screen-256color" tmux new-window -n 'Email' -c $HOME ;
+ TERM="screen-256color" tmux send-keys 'mutt' 'Enter' ;
+ TERM="screen-256color" tmux new-window -n 'RSS' -c $HOME ;
+ TERM="screen-256color" tmux send-keys 'newsboat' 'Enter' ;
+ TERM="screen-256color" tmux new-window -n 'www' -c $HOME;
+ TERM="screen-256color" tmux send-keys 'w3m -B' 'Enter' ;
+ TERM="screen-256color" tmux new-window -n 'Torr' -c $HOME ;
+# TERM="screen-256color" tmux send-keys 'source activate transmission-py27' 'Enter' ;
+ TERM="screen-256color" tmux send-keys 'tsm-daemon' 'Enter' ;
+ TERM="screen-256color" tmux send-keys 'tsm-ncurse' 'Enter' ;
+ TERM="screen-256color" tmux split-window -v -p 40 ;
+ #TERM="screen-256color" tmux send-keys 'clear' 'Enter' ;
+ TERM="screen-256color" tmux select-pane -t 1 ;
+ #TERM="screen-256color" tmux send-keys 'clear' 'Enter' ;
+ TERM="screen-256color" tmux split-window -h -p 50 -t 1 ;
+ TERM="screen-256color" tmux send-keys 'mpsyt user gotbletu' 'Enter';
+ TERM="screen-256color" tmux select-pane -t 3 ;
+ TERM="screen-256color" tmux select-window -t 1 ;
+ TERM="screen-256color" tmux -2 attach-session -d ;
+
+}
+tmx-ipy() {
+ TERM="screen-256color" tmux new-session -n 'IPython' -d 'nvim';
+ TERM="screen-256color" tmux split-window -h 'ipython';
+ TERM="screen-256color" tmux -2 attach-session -d ;
+}
+
+# }}}
+###########################################################
+#-------- System Information {{{
+#------------------------------------------------------
+m-sound() { arecord -L && arecord -l && cat /proc/asound/pcm ;} #List audio capture card/mic
+m-distro() { uname -a && lsb_release -a ;}
+m-connectip() {
+ echo "--------------- Connected Devices -----------------"
+ nmap -sn $(netstat -rn | awk 'FNR == 3 {print $2}')/24
+ echo "---------------------------------------------------"
+
+}
+
+# uses ip or ifconfig, good on older or newer system
+m-ip() {
+ echo "--------------- Network Information ---------------"
+ # show router ip
+echo "router ip:" $(netstat -rn | awk 'FNR == 3 {print $2}')
+## newer system like archlinux
+#ip addr | awk '/global/ {print $1,$2}' | cut -d\/ -f1
+#ip addr | awk '/global/ {print $3,$4}'
+#ip addr | awk '/ether/ {print $1,$2}'
+#ip addr | awk '/scope link/ {print $1,$2}' | cut -d\/ -f1
+## older system like debian
+# #ifconfig | awk '/inet addr/ {print $1,$2}' | awk -F: '{print $1,$2}'
+# #ifconfig | awk '/Bcast/ {print $3}' | awk -F: '{print $1,$2}'
+# #ifconfig | awk '/inet addr/ {print $4}' | awk -F: '{print $1,$2}'
+# #ifconfig | awk '/HWaddr/ {print $4,$5}'
+# #ifconfig | awk '/Scope:Link/ {print $1,$3}' | cut -d\/ -f1
+## echo External IP $(curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+")
+echo External IP: $(curl -s http://ipecho.net/plain)
+ echo "---------------------------------------------------"
+}
+#
+#}}}
+###########################################################
+#-------- PulseAudio Switcher CLI v2 {{{
+#------------------------------------------------------
+# DEMO: https://www.youtube.com/watch?v=jhv-2pNWfr4
+# DESC: switch audio stream to different output (HDMI, Headphone, Speakers ...etc)
+# REF: http://askubuntu.com/a/18210
+
+pa-global() {
+ if [ $# -lt 1 ]; then
+ echo -e "pulseaudio redirect audio of all running app to another device"
+ echo -e "\nUsage:\n$0 <device_index_number>"
+ echo -e "\nExample:\n$0 0 \n"
+ echo "==============="
+ echo "Sound Devices"
+ pacmd list-sinks | awk '/index/ || /name:/'
+ return 1
+ fi
+
+ # list all apps in playback tab (ex: cmus, mplayer, vlc)
+ inputs=($(pacmd list-sink-inputs | awk '/index/ {print $2}'))
+# set the default output device
+ pacmd set-default-sink $1 &> /dev/null
+# apply the changes to all running apps to use the new output device
+ for i in ${inputs[*]}; do pacmd move-sink-input $i $1 &> /dev/null; done
+
+}
+pa-solo() {
+ if [ $# -lt 2 ]; then
+ echo -e "pulseaudio redirect audio of one running app to another device"
+ echo -e "\nUsage:\n$0 <app_index_number> <device_index_number>"
+ echo -e "\nExample:\n$0 2302 0 \n"
+ echo "==============="
+ echo "Running Apps"
+ pacmd list-sink-inputs | awk '/index/ || /application.name /'
+ echo "==============="
+ echo "Sound Devices"
+ pacmd list-sinks | awk '/index/ || /name:/'
+ return 1
+ fi
+
+ # set the default output device
+ pacmd set-default-sink "$2" &> /dev/null
+# apply changes to one running app to use the new output device
+ pacmd move-sink-input "$1" "$2" &> /dev/null
+#
+}
+pa-c(){
+ pulseaudio -vv --check
+}
+pa-s(){
+ pulseaudio -vv --start
+}
+pa-k(){
+ pulseaudio -vv --kill
+}
+pa-ps(){
+ ps aux | grep -i pulseaudio
+}
+
+#}}}
+###########################################################
+#-------- Calibre CLI v3 {{{
+#------------------------------------------------------
+# DEMO: http://www.youtube.com/watch?v=FeoVsC4U_0A
+# DESC: ebook manager supports many formats and devices; interfaces with cli, webui, gui
+# URL: http://manual.calibre-ebook.com/cli/calibredb.html
+
+cmx-list() {
+ if [ $# -lt 1 ]; then
+ echo -e "calibredb list files of a library"
+ echo -e "\nUsage:\n$0 <library>"
+ echo -e "\nExample:\n$0 \$cbcomic\n"
+ return 1
+ fi
+
+ calibredb list -f authors,title,tags,rating --library-path "$1"
+#
+}
+
+cmx-search() {
+ if [ $# -lt 2 ]; then
+ echo -e "calibredb search files of a library"
+ echo -e "\nUsage:\n$0 <library> <keywords>"
+ echo -e "\nExample:\n$0 \$cbcomic marvel"
+ echo -e "$0 \$cbcomic 'the walking dead'\n"
+ return 1
+fi
+
+ calibredb list -s "${@:2}" -f authors,title,tags,rating --library-path "$1"
+#
+}
+
+cmx-add() {
+ if [ $# -lt 2 ]; then
+ echo -e "calibredb add new files to a library"
+ echo -e "\nUsage:\n$0 <library> <file>"
+ echo -e "\nExample:\n$0 \$cbcomic file.cbz"
+ echo -e "$0 \$cbcomic file1.cbz file2.cbz"
+ echo -e "$0 \$cbcomic file.epub file2.pdf file3.cbr\n"
+ return 1
+ fi
+
+ calibredb add "${@:2}" --library-path "$1"
+
+}
+
+cmx-remove() {
+ if [ $# -lt 2 ]; then
+ echo -e "calibredb remove files from a library"
+ echo -e "\nUsage:\n$0 <library> <id>"
+ echo -e "$0 <library> <range>"
+ echo -e "\nExample:\n$0 \$cbcomic 100"
+ echo -e "$0 \$cbcomic 50-55"
+ echo -e "$0 \$cbcomic 100,120-127"
+ return 1
+ fi
+
+ calibredb remove "${@:2}" --library-path "$1"
+#
+}
+
+cmx-show() {
+ if [ $# -lt 2 ]; then
+ echo -e "calibredb show file metadata from a library"
+ echo -e "\nUsage:\n$0 <library> <id>"
+ echo -e "\nExample:\n$0 \$cbcomic 16"
+ return 1
+ fi
+
+ calibredb show_metadata "${@:2}" --library-path "$1" | html2text
+#
+}
+
+
+cmx-recipes() { ebook-convert --list-recipes | less ;}
+
+# WebUI content server
+# http://manual.calibre-ebook.com/cli/calibre-server.html
+# http://192.168.1.xxx:port
+cmx-quit() { kill $(ps -ef | grep -i '[C]alibre-server' | awk '{print $2}') ;}
+cmx-server() {
+ # start all content server on different ports
+calibre-server -p 57770 --daemonize --with-library "$CMX_CALIBRE"
+calibre-server -p 57771 --daemonize --with-library "$CMX_COMICS"
+calibre-server -p 57772 --daemonize --with-library "$CMX_MAGS"
+
+}
+cmx-bkv(){
+ if [ $# -lt 2 ]; then
+ echo -e "launch ebook-viewer with a particular book from a library"
+ echo -e "\nUsage:\n$0 <library> <id>"
+ echo -e "\nExample:\n$0 \$cbcomic 16"
+ return 1
+ fi
+
+ BKDIR=`find ${CMX_CALIBRE} -name "*$2*"`
+ find $BKDIR -type f \( -name "*.epub" -o -name "*.mobi" -o -name "*.pdf" \) -exec /usr/bin/ebook-viewer {} \; &
+}
+
+calibre-update(){
+ sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | \
+ sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"
+}
+
+#}}}
+###########################################################
+#-------- YouTube download MP3 {{{
+
+ytdl-mp3(){
+ if [ $# -lt 1 ]; then
+ echo -e "This uses youtube-dl to download a music video from youtube"
+ echo -e "and then convert it to an mp3 file."
+ echo -e " "
+ echo -e "\n\nUsage:\n$0 <FILE NAME>"
+ echo -e "\nExample:\n$0 input.file\n"
+ return 1
+ fi
+
+ YTrequest $1 ;
+
+}
+# }}}
+###########################################################
+###########################################################
+#-------- Convert to Audio {{{
+#------------------------------------------------------
+# https://trac.ffmpeg.org/wiki/Encode/MP3
+# https://trac.ffmpeg.org/wiki/Encode/AAC
+# https://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide
+
+convert2audio_mp3() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.m4a"
+ echo -e "\nmultiple: $0 file1.m4a file2.m4a file3.m4a"
+ echo -e "\nwildcard: $0 *.m4a"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.mp3 ]
+ do
+ ffmpeg -i "$arg" -codec:a libmp3lame -qscale:a 2 "${arg%.*}"-audiotrack.mp3
+ done
+ done
+}
+
+convert2audio_m4a() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.m4a ]
+ do
+ ffmpeg -i "$arg" -codec:a aac -qscale:a 6 -strict experimental "${arg%.*}"-audiotrack.m4a
+ done
+ done
+}
+convert2audio_ogg() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.ogg ]
+ do
+ ffmpeg -i "$arg" -codec:a libvorbis -qscale:a 5 -vn "${arg%.*}"-audiotrack.ogg
+ done
+ done
+}
+
+convert2audio_wav() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.wav ]
+ do
+ ffmpeg -i "$arg" "${arg%.*}"-audiotrack.wav
+ done
+ done
+}
+
+convert2audio_webm() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.webm ]
+ do
+ ffmpeg -i "$arg" -codec:a libvorbis -qscale:a 5 -vn "${arg%.*}"-audiotrack.webm
+ done
+ done
+}
+
+convert2audio_wavmono() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-monoaudiotrack.wav ]
+ do
+ ffmpeg -i "$arg" -codec:a pcm_mulaw -ar 8000 -ac 1 "${arg%.*}"-monoaudiotrack.wav
+ done
+ done
+}
+
+convert2audio_wma() {
+if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.wma ]
+ do
+ ffmpeg -i "$arg" -codec:a wmav2 -b:a 128k "${arg%.*}"-audiotrack.wma
+ done
+ done
+}
+
+# }}}
+###########################################################
+#-------- Convert to Audio {{{
+#------------------------------------------------------
+# https://trac.ffmpeg.org/wiki/Encode/MP3
+# https://trac.ffmpeg.org/wiki/Encode/AAC
+# https://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide
+
+convert2audio_mp3() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.m4a"
+ echo -e "\nmultiple: $0 file1.m4a file2.m4a file3.m4a"
+ echo -e "\nwildcard: $0 *.m4a"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.mp3 ]
+ do
+ ffmpeg -i "$arg" -codec:a libmp3lame -qscale:a 2 "${arg%.*}"-audiotrack.mp3
+ done
+ done
+}
+
+convert2audio_m4a() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.m4a ]
+ do
+ ffmpeg -i "$arg" -codec:a aac -qscale:a 6 -strict experimental "${arg%.*}"-audiotrack.m4a
+ done
+ done
+}
+convert2audio_ogg() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.ogg ]
+ do
+ ffmpeg -i "$arg" -codec:a libvorbis -qscale:a 5 -vn "${arg%.*}"-audiotrack.ogg
+ done
+ done
+}
+
+convert2audio_wav() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.wav ]
+ do
+ ffmpeg -i "$arg" "${arg%.*}"-audiotrack.wav
+ done
+ done
+}
+
+convert2audio_webm() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.webm ]
+ do
+ ffmpeg -i "$arg" -codec:a libvorbis -qscale:a 5 -vn "${arg%.*}"-audiotrack.webm
+ done
+ done
+}
+
+convert2audio_wavmono() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-monoaudiotrack.wav ]
+ do
+ ffmpeg -i "$arg" -codec:a pcm_mulaw -ar 8000 -ac 1 "${arg%.*}"-monoaudiotrack.wav
+ done
+ done
+}
+
+convert2audio_wma() {
+if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.mp3"
+ echo -e "\nmultiple: $0 file1.mp3 file2.mp3 file3.mp3"
+ echo -e "\nwildcard: $0 *.mp3"
+ return 1
+fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-audiotrack.wma ]
+ do
+ ffmpeg -i "$arg" -codec:a wmav2 -b:a 128k "${arg%.*}"-audiotrack.wma
+ done
+ done
+}
+
+flac2mp3(){
+for a in ./*.flac; do
+ < /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}"
+done
+}
+# }}}
+###########################################################
+#-------- Simple HTTP Server {{{
+#------------------------------------------------------
+# DEMO: http://www.youtube.com/watch?v=FFIjMYzkHhc
+# DESC: python http server, host files and folders
+
+SimpleHTTPserver() {
+ if which python2 >/dev/null; then
+ python2 -m SimpleHTTPServer "${1:-8000}"
+ else
+ python3 -m http.server "${1:-8000}"
+ fi
+}
+#}}}
+###########################################################
+#-------- Kiwix Server {{{
+#------------------------------------------------------
+# DEMO: https://www.youtube.com/watch?v=267WxnPEckM&t=81s
+# DESC: kiwix-serve -- Offline Wiki Viewer - Linux WEBUI
+
+offlinewiki-daemon() { kiwix-serve --port 49849 --daemon /MacOSX-Data1/Computing/wiki/*.zim ; }
+offlinewiki-quit() { kill $(ps -ef | grep -i '[K]iwix-serve' | awk '{print $2}') ;}
+
+#}}}
+###########################################################
+#-------- Bluetooth Headset {{{
+bt-st() { systemctl status -l bluetooth; }
+bt-up() { sudo systemctl start bluetooth; }
+bt-re() { sudo systemctl restart bluetooth; }
+bt-dn() { sudo systemctl stop bluetooth; }
+betron-on() { ${HOME}/bin/scripts/expect/bt-on-Betron.exp ;}
+betron-off() { ${HOME}/bin/scripts/expect/bt-off-Betron.exp ;}
+jvc-on() { ${HOME}/bin/scripts/expect/bt-on-JVC.exp ;}
+jvc-off() { ${HOME}/bin/scripts/expect/bt-off-JVC.exp ;}
+qy7-on() { ${HOME}/bin/scripts/expect/bt-on-QY7.exp ;}
+qy7-off() { ${HOME}/bin/scripts/expect/bt-off-QY7.exp ;}
+pb-on() { ${HOME}/bin/scripts/expect/bt-on-PocketBoom.exp ;}
+pb-off() { ${HOME}/bin/scripts/expect/bt-off-PocketBoom.exp ;}
+ssx-on() { ${HOME}/bin/scripts/expect/bt-on-ssx.exp ;}
+ssx-off() { ${HOME}/bin/scripts/expect/bt-off-ssx.exp ;}
+xg5-on() { ${HOME}/bin/scripts/expect/bt-on-xg5.exp ;}
+xg5-off() { ${HOME}/bin/scripts/expect/bt-off-xg5.exp ;}
+# }}}
+###########################################################
+#-------- Wget Batch Retrieve Files From The Web {{{
+## http://stackoverflow.com/a/18709707
+#--------------------------------------
+wget-ext-url() {
+ if [ $# -lt 2 ]; then
+ echo -e "Download all extension on a webpage"
+ echo -e "\nUsage: $0 <file_extension> <url>"
+ echo -e "\nExample: $0 mp3 http://example.com/files/"
+ echo -e "\nGoogle: http://lmgtfy.com/?q=intitle%3Aindex.of+mp3+-html+-htm+-php+-asp+-txt+-pls+madonna"
+ return 1
+ fi
+
+ savepath=~/Downloads
+ outputdir_name=$(echo "$2" | rev | cut -d\/ -f2 | rev)
+
+ mkdir -pv "$savepath/$outputdir_name"
+ cd "$savepath/$outputdir_name" && wget -r -l1 -H -t1 -nd -N -np -A "$1" -erobots=off "$2"
+}
+# }}}
+###########################################################
+#-------- Fuzzy Finder {{{
+#------------------------------------------------------
+# DEMO: https://www.youtube.com/playlist?list=PLqv94xWU9zZ2fMsMMDF4PjtNHCeBFbggD
+# DESC: interactive fuzzy string matching
+# URL: https://github.com/junegunn/fzf
+#
+fzf-dmenu() {
+ # note: xdg-open has a bug with .desktop files, so we cant use that
+ selected="$(ls /usr/share/applications | fzf -e -i )"
+ nohup `grep '^Exec' "/usr/share/applications/$selected" | tail -1 | sed 's/^Exec=//' | sed 's/%.//'` >/dev/null 2>&1&
+ # disown if exit 0 successfully
+ if [[ $? = 0 ]] ; then disown; fi
+};
+zle -N fzf_dmenu; bindkey -s '^O' "fzf-dmenu\n"
+#
+fzf-surfraw() { sr "$(cat ~/.config/surfraw/bookmarks | sed '/^$/d' | sort -n | fzf -e -i )" ;}
+zle -N fzf-surfraw; bindkey -s '^B' "fzf-surfraw\n"
+
+#
+fzf-locate() {
+ xdg-open "$(locate "*" | fzf -e -i )"
+
+# # some programs require a longer time to load
+ sleep 1.5
+#
+# # if cancel or fail then exit
+ if [ $? -ne 0 ]
+ then
+ exit
+ fi
+}
+# ZSH keybinding example; ~/.zshrc
+
+fzf_history() { zle -I; eval $(history | fzf +s | sed 's/ *[0-9]* *//') ; }; zle -N fzf_history; bindkey '^F' fzf_history
+
+fzf_killps() { zle -I; ps -ef | sed 1d | fzf -m | awk '{print $2}' | xargs kill -${1:-9} ; }; zle -N fzf_killps; bindkey '^Q' fzf_killps
+
+fzf_cd() { zle -I; DIR=$(find ${1:-*} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf) && cd "$DIR" ; }; zle -N fzf_cd; bindkey '^E' fzf_cd
+
+
+#
+#fzf-playonlinux() { playonlinux --run '$(ls ~/.PlayOnLinux/shortcuts | fzf -e -i )' ;}
+#
+## http://www.reddit.com/r/commandline/comments/3abtup/fzfr_fzf_bash_function/
+#fzfr() { fzf -m -x | xargs -d'\n' -r "$@" ; }
+#
+## edit single line snippet
+cfg-snippetrc() { $EDITOR ~/.snippetrc ;}
+cfg-multisnippetrc() { $EDITOR ~/.multisnippet/"$(ls ~/.multisnippet | fzf -e -i)" ;}
+multisnippet() { $EDITOR ~/.multisnippet/"$1" ;}
+fzf-snippet() {
+ selected="$(cat ~/.snippetrc | sed '/^$/d' | sort -n | fzf -e -i )"
+ # remove tags, leading and trailing spaces, also no newline
+ echo "$selected" | sed -e s/\;\;\.\*\$// | sed 's/^[ \t]*//;s/[ \t]*$//' | tr -d '\n' | xclip -selection clipboard
+}
+fzf-multisnippet() {
+ # location of snippets
+ dir=~/.multisnippet
+
+ # merge filename and tags into single line
+ results=$(for FILE in $dir/*
+ do
+ getname=$(basename $FILE)
+ gettags=$(head -n 1 $FILE)
+ echo "$getname \t $gettags"
+ done)
+
+ # copy content into clipboard without tags
+ filename=$(echo "$(echo $results | fzf -e -i )" | cut -d' ' -f 1)
+ sed 1d $dir/$filename | xclip -selection clipboard
+}
+fzf_open() {
+ fd -t f -H -I | fzf -m --preview="xdg-mime query default {}" | xargs - ro -d "\n" xdg-open 2>&-
+ }
+cd_with_fzf() {
+ cd $HOME && cd "$(fd -t d -t l | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden)" && echo "$PWD" && tree -L 2 }
+
+##}}}
+###########################################################
+#-------- Task Spooler {{{
+# TestFunc TS queue
+tsp-output_header(){
+ echo "Running $0";
+ echo "$1 arguments...." ;
+}
+tsp-ytdl() {
+
+ case $# in
+ 0) TS_SOCKET=/tmp/youtube-dl ts ;;
+ 1) case $1 in
+ "-C") TS_SOCKET=/tmp/youtube-dl ts -C ;;
+ "-r") TS_SOCKET=/tmp/youtube-dl ts -r ;;
+ "-o") TS_SOCKET=/tmp/youtube-dl ts -o ;;
+ "-f") TS_SOCKET=/tmp/youtube-dl ts youtube-dl -f $1 $2 $3 ;;
+ *) TS_SOCKET=/tmp/youtube-dl ts youtube-dl $1 ;;
+ esac ;;
+ 2) TS_SOCKET=/tmp/youtube-dl ts $* ;;
+ esac
+}
+# Youtube-dl TS queue
+tsp-ytdl.orig() {
+ if [ $# -lt 1 ] ; then
+ echo "Running $0"
+ TS_SOCKET=/tmp/youtube-dl ts ;
+ else
+ if [[ "$1" == "-C" ]] ; then
+ TS_SOCKET=/tmp/youtube-dl ts -C ;
+ else
+ TS_SOCKET=/tmp/youtube-dl ts youtube-dl $1 ;
+ fi
+ fi
+}
+# MPV TS queue
+tsp-mpv() {
+ if [ $# -lt 1 ] ; then
+ TS_SOCKET=/tmp/mpv-q ts ;
+ else
+ if [ "$1" == "-C" ] ; then
+ TS_SOCKET=/tmp/mpv-q ts -C ;
+ else
+ TS_SOCKET=/tmp/mpv-q ts mpv $1 ;
+ fi
+ fi
+}
+# }}}
+###########################################################
+#-------- Sci-Hub {{{
+# Sci-Hub download
+
+shdl(){ curl -O $(curl -s http://sci-hub.tw/"$@" | grep location.href | grep -o http.*pdf); }
+
+# }}}
+###########################################################
+#-------- BibTex Functions {{{
+#doi2bib(){
+ #echo >> bib.bib;
+ #curl -s "http://api.crossref.org/works/$1/transform/application/x-bibtex" >> bib.bib;
+ #echo >> bib.bib;
+#}
+# }}}
+###########################################################
+#-------- fast-p {{{
+# Quickly find and open a pdf among a collection of thousands of unsorted pdfs through fzf
+# https://github.com/bellecp/fast-p
+
+p() {
+ open=xdg-open
+ ag -U -g ".pdf$" \
+ | fast-p \
+ | fzf --read0 --reverse -e -d $'\t' \
+ --preview-window down:80% --preview '
+ v=$(echo {q} | tr " " "|");
+ echo -e {1}"\n"{2} | grep -E "^|$v" -i --color=always;
+ ' \
+ | cut -z -f 1 -d $'\t' | tr -d '\n' | xargs -r --null $open > /dev/null 2> /dev/null
+ }
+
+# }}}
+###########################################################
+
+##############################
+####### B. WAITING LIST ######
+##############################
+
+###########################################################
+#-------- FFMPEG X11GRAB Screencasting {{{
+#------------------------------------------------------
+# record desktop using ffmpeg
+# tutorial video: http://www.youtube.com/watch?v=mNz5Lrc06_s
+# http://ubuntuforums.org/showthread.php?t=1392026
+# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
+# https://trac.ffmpeg.org/wiki/Capture/ALSA
+# https://trac.ffmpeg.org/wiki/Capture/Desktop
+# http://nowardev.wordpress.com/2011/05/23/how-to-screencast/
+# https://dl.dropboxusercontent.com/u/28788188/cast.sh (Xpander69)
+# https://www.youtube.com/watch?v=mEV2O8C272g
+# https://github.com/gotbletu/wikimd/blob/master/ffmpeg-compile.md
+
+# ffmpeg location
+# FF_RECORDER=/usr/bin/ffmpeg
+#FF_RECORDER=~/Compile/ffmpeg/bin/ffmpeg
+
+# use "arecord -l" or "arecord -L" to find mic
+# pavucontrol if using pulseaudio
+# FF_MIC=pulse
+# FF_MIC=hw:4,0
+#FF_MIC=front:CARD=Snowball
+
+# scale down resolution if needed
+# ${FF_SCALE[*]}
+# FF_SCALE=(-vf scale=1280:720)
+
+
+#FF_OUTPUT_MOVIE=~/Public/screencast/mm_movie_baking.mkv
+#FF_OUTPUT_VIDEO=~/Public/screencast/vv_video_baking.mkv
+#FF_OUTPUT_AUDIO=~/Public/screencast/aa_audio_baking.mp3
+
+# movie = video and audio
+# videotrack = video only
+# audiotrack = audio only
+#ffcast_fullscreen_movie() {
+# $FF_RECORDER -f alsa -ac 1 -i $FF_MIC -async 1 -f x11grab -r 30 \
+#-s $(xwininfo -root | grep 'geometry' |awk '{print $2;}' | cut -d\+ -f1) \
+#-i :0.0 -vcodec libx264 -pix_fmt yuv444p -preset ultrafast -crf 0 \
+#-acodec libmp3lame -ab 320k -threads 0 -y $FF_OUTPUT_MOVIE
+#
+
+#ffcast_fullscreen_videotrack() {
+# $FF_RECORDER -f x11grab -r 30 \
+#-s $(xwininfo -root | grep 'geometry' |awk '{print $2;}' | cut -d\+ -f1) \
+#-i :0.0 -vcodec libx264 -pix_fmt yuv444p -preset ultrafast -crf 0 \
+#-threads 0 -y $FF_OUTPUT_VIDEO
+#
+
+#ffcast_audiotrack() {
+# $FF_RECORDER -f alsa -ac 1 -i $FF_MIC \
+#-acodec libmp3lame -ab 320k \
+#-threads 0 -y $FF_OUTPUT_AUDIO
+#
+
+# single window: select a window with mouse cursor to record
+#ffcast_window_movie() {
+# INFO=$(xwininfo -frame)
+#WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')
+#WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' )
+
+# $FF_RECORDER -f alsa -ac 1 -i $FF_MIC -async 1 -f x11grab -r 30 \
+#-s $WIN_GEO -i :0.0+$WIN_XY -vcodec libx264 -pix_fmt yuv444p \
+#-preset ultrafast -crf 0 -acodec libmp3lame -ab 320k \
+#-threads 0 -y $FF_OUTPUT_MOVIE
+#
+
+#ffcast_window_videotrack() {
+# INFO=$(xwininfo -frame)
+#WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')
+#WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' )
+
+# $FF_RECORDER -f x11grab -r 30 \
+#-s $WIN_GEO -i :0.0+$WIN_XY -vcodec libx264 -pix_fmt yuv444p \
+#-preset ultrafast -crf 0 \
+#-threads 0 -y $FF_OUTPUT_VIDEO
+#
+
+
+# example references
+# worked well on ffmpeg 0.11.1
+# ffmpeg -f pulse -ac 1 -i hw:3,0 -async 1 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' |awk '{print $2;}' | cut -d\+ -f1) -i :0.0 -vcodec libx264 -pix_fmt yuv444p -preset ultrafast -crf 0 -acodec libmp3lame -ab 128k -threads 0 -y ~/Public/screencast/aa_screencast_baking.mkv
+
+# --- }}}
+###########################################################
+#-------- FFMPEG X11GRAB Screencasting v2 (Multiple Inputs) {{{
+#------------------------------------------------------
+# DESC: record desktop using ffmpeg X11grab
+
+# REFF:
+# MrWhat record mic & speakers: https://www.youtube.com/watch?v=mEV2O8C272g
+# MrWhat keep audio sync: https://www.youtube.com/watch?v=Xbzh-T2kfJk
+# https://ask.fedoraproject.org/en/question/65662/recording-audio-from-mic-and-speakers-from-commandline/
+
+# list all audio sources
+pa-sources() { pactl list sources | awk '/Source #/ ||/Name:/ || /Description:/ || /Sample Specification:/' ;}
+
+# ffmpeg location
+# FFX_RECORDER=/usr/bin/ffmpeg
+#FFX_RECORDER=~/Compile/ffmpeg/bin/ffmpeg
+# FFX_RECORDER=/usr/bin/avconv
+
+# speakers audio source (PC speakers or Headphones)
+# note: using headphones since pc speakers will have audio feedback to mic
+# FFX_SPEAKER="alsa_output.pci-0000_00_14.2.analog-stereo.monitor"
+# FFX_SPEAKER_CH="2"
+# FFX_SPEAKER_FREQ="44100"
+#FFX_SPEAKER="alsa_output.usb-NA_Lenovo_Wireless_Headset_W770-00.analog-stereo.monitor"
+#FFX_SPEAKER_CH="2"
+#FFX_SPEAKER_FREQ="32000"
+
+# mic audio source
+# note: when routed to pulseaudio the mic is very low
+# so open pavucontrol > input device > [name of mic]
+# then slide volume all the way to the right
+# example: http://i.imgur.com/GFkifqB.png
+#FFX_MIC="alsa_input.usb-BLUE_MICROPHONES_Blue_Snowball-00.analog-mono"
+#FFX_MIC_CH="1"
+#FFX_MIC_FREQ="44100"
+
+# sound system
+#FFX_SOUNDSYS="pulse"
+# FFX_SOUNDSYS="alsa"
+
+# resolution
+#FFX_RESO_FULL=$(xwininfo -root | grep 'geometry' |awk '{print $2;}' | cut -d\+ -f1)
+
+# output location
+#FFX_OUTPUT_MOVIE=~/Public/screencast/mm_movie_baking.mkv
+#FFX_OUTPUT_VIDEO=~/Public/screencast/vv_video_baking.mkv
+#FFX_OUTPUT_AUDIO=~/Public/screencast/aa_audio_baking.mp3
+
+#ffxcast_fullscreen_movie() {
+# $FFX_RECORDER \
+#-f $FFX_SOUNDSYS -ac $FFX_SPEAKER_CH -ar $FFX_SPEAKER_FREQ -i $FFX_SPEAKER \
+#-f $FFX_SOUNDSYS -ac $FFX_MIC_CH -ar $FFX_MIC_FREQ -i $FFX_MIC \
+#-f x11grab -r 30 -s $FFX_RESO_FULL -i :0.0 \
+#-filter_complex \
+#"[0]asyncts[spkr], \
+#[1]asyncts[mic], \
+#[spkr][mic]amix=inputs=2" \
+#-c:v libx264 -pix_fmt yuv420p -preset ultrafast -crf 0 \
+#-c:a libmp3lame -ac 2 -ar 44100 -b:a 320k \
+#-y $FFX_OUTPUT_MOVIE
+#
+#
+## -vcodec libx264 -pix_fmt yuv444p -preset ultrafast -crf 0 \
+## -acodec libmp3lame -ab 128k -ar 44100 -threads 0 -y $FF_OUTPUT_MOVIE
+#
+## ffmpeg \
+## -f pulse -ac 2 -ar 44100 -i alsa_input.usb-BLUE_MICROPHONE_Blue_Snow­ball_201306-00-Snowball.analog-stereo \
+## -f pulse -ac 2 -ar 44100 -i alsa_output.pci-0000_00_1b.0.analog-ster­eo.monitor \
+## -f pulse -ac 2 -ar 44100 -i alsa_output.usb-Logitech_Inc_Logitech_US­B_Headset_H540_00000000-00-H540.iec958-s­tereo.monitor \
+## -f x11grab -framerate 30 -video_size 1920x1080 -i :0 \
+## -filter_complex \
+## "[0]asyncts[m], \
+## [1]asyncts[d], \
+## [2]asyncts[h], \
+## [m][d][h]amix=inputs=3" \
+## -c:v libx264 -preset veryfast -crf 18 -pix_fmt yuv420p \
+## -c:a libmp3lame -ac 2 -ar 44100 -b:a 320k \
+## /home/b/Videos/AudioSync/AsyncTS_20150206.mkv
+#
+## different PRESET
+## 1. -c:v libx264 -preset ultrafast -crf 18: Produced a 120.9 MB file at ~34-48% CPU load
+## 2. -c:v libx264 -preset superfast -crf 18: Produced a 40.4 MB file at ~48-53% CPU load
+## 3. -c:v libx264 -preset veryfast -crf 18: Produced a 26.1 MB file at ~62-78% CPU load
+#
+## different CRF
+## 1. -c:v libx264 -preset ultrafast -crf 0 (Lossless): Produced a 471.7 MB file at ~32-50% CPU load
+## 2. -c:v libx264 -preset ultrafast -crf 18: Produced a 120.9 MB file at ~34-48% CPU load
+## 3. -c:v libx264 -preset ultrafast -crf 23: Produced a 67.1 MB file at ~32-45% CPU load
+## 4. -c:v libx264 -preset ultrafast -crf 28: Produced a 31.1 MB file at ~30-40% CPU load
+#
+## image quality each setting produces (images are zoomed to in 285%)
+## https://imgur.com/XF6t2Cv
+#
+#
+## }}}
+###########################################################
+##-------- Alias Custom {{{
+##------------------------------------------------------
+## alias ps="ps aux | grep -v grep | grep "
+#alias t="todo.sh"
+#alias f="find . |grep "
+#alias p="ps aux |grep "
+## alias o="xdg-open "
+#
+## For emergencies
+#alias asdf='setxkbmap fr bepo'
+#
+alias xclipin='xclip -sel c -in <'
+alias xclipout='xclip -sel c -out >'
+alias ..="cd .."
+alias ...="cd ../.."
+alias ....="cd ../../.."
+alias .....="cd ../../../.."
+alias ......="cd ../../../../.."
+alias empty='gvfs-trash --empty' # empty trash globally (all partitions)
+alias garbage='gvfs-trash -f'
+alias garbage-list='gvfs-ls -h trash://'
+alias garbage-empty='gvfs-trash --empty' # empty trash globally (all partitions)
+alias psg='ps aux|grep -v grep|grep -i '
+psgrep() { ps axuf | grep -v grep | grep "$@" -i --color=auto; }
+alias sshxforwarding='ssh -XCc blowfish-cbc,arcfour'
+alias sshxtrusted='ssh -Y'
+alias stackexchange='lynx http://column80.com' # lookup information
+alias trash='trash-put -v'
+alias xev-keycode="xev | grep 'keycode\|button'"
+alias weechat='weechat-curses'
+alias lsd='ls -1d */' # ls folders only
+alias l='ls -l'
+alias lsf='ls --color=always -p | grep -v '/$'' # ls files only
+alias lsa='ls -GghA'
+alias lsx='ls -lX'
+## list and grep
+lsg() {
+ keyword=$(echo "$@" | sed 's/ /.*/g')
+ ls -GgthrA | grep -iE $keyword
+}
+#
+## ls recent items at bottom with green TODAY yellow YESTERDAY substituted
+## https://www.reddit.com/r/archlinux/comments/41s1w4/what_is_your_favorite_one_liner_to_use/cz50y1m
+lst() {
+ ls -vAFq --color=yes -got --si --time-style=long-iso "$@" \
+ | sed "s/$(date +%Y-%m-%d)/\x1b[32m TODAY\x1b[m/;s/$(date +'%Y-%m-%d' -d yesterday)/\x1b[33m YESTERDAY\x1b[m/" | tac
+}
+## alias lst='ls -Ggthrc' # ls by time/changes, newest at bottom
+#
+#
+#
+## }}}
+###########################################################
+##-------- Functions {{{
+##------------------------------------------------------
+#
+################################################################################
+## IPlayer
+##
+################################################################################
+#
+#gip-setplayer() { export PLAYER="$1" ;}
+#gip-cbbc() { get_iplayer --stream --type=livetv "CBBC" --player="$PLAYER -" ;}
+#gip-cbbs() { get_iplayer --stream --type=livetv "CBeebies" --player="$PLAYER -" ;}
+#gip-bbcn() { get_iplayer --stream --type=livetv "BBC News" --player="$PLAYER -" ;}
+#gip-bbc1() { get_iplayer --stream --type=livetv "BBC One" --player="$PLAYER -" ;}
+#gip-bbc2() { get_iplayer --stream --type=livetv "BBC Two" --player="$PLAYER -" ;}
+#gip-bbc3() { get_iplayer --stream --type=livetv "BBC Three" --player="$PLAYER -" ;}
+#gip-bbc4() { get_iplayer --stream --type=livetv "BBC Four" --player="$PLAYER -" ;}
+#gip-bbcr1x() { get_iplayer --stream --type=liveradio "BBC 1xtra" --player="$PLAYER -" ;}
+#gip-bbcr1() { get_iplayer --stream --type=liveradio "BBC Radio 1" --player="$PLAYER -" ;}
+#gip-bbcr2() { get_iplayer --stream --type=liveradio "BBC Radio 2" --player="$PLAYER -" ;}
+#gip-bbcr3() { get_iplayer --stream --type=liveradio "BBC Radio 3" --player="$PLAYER -" ;}
+#gip-bbcr4() { get_iplayer --stream --type=liveradio "BBC Radio 4 FM" --player="$PLAYER -" ;}
+#gip-bbcr4x() { get_iplayer --stream --type=liveradio "BBC Radio 4 Extra" --player="$PLAYER -" ;}
+#gip-bbcr5() { get_iplayer --stream --type=liveradio "BBC Radio 5 live" --player="$PLAYER -" ;}
+#gip-bbcr5x() { get_iplayer --stream --type=liveradio "BBC 5 live Sports Extra" --player="$PLAYER -" ;}
+#
+#unlock() { keepassc -d ~/.keepass/masterlock.kdb ;}
+#
+#mkdircd() { mkdir -p -v $1; cd $1 ;} # create folder then cd into it
+#cpbak() { cp $1{,.bak} ;} # create backup copy
+#open() { xdg-open "$@" > /dev/null 2>&1 ;} # open gui apps w/o error msg
+#nohup-command() { nohup "$@" >/dev/null 2>&1& } #background a process w/o error msg
+#update-grub() { sudo grub-mkconfig -o /boot/grub/grub.cfg ;}
+#grub-list() {
+# RED='\033[0;31m'
+# sudo grep "menuentry '" /boot/grub/grub.cfg | less -N
+# echo -e "${RED} REMINDER: GRUB number starts at zero not one"
+#}
+#
+#
+## color the manpages
+## tutorial video: http://www.youtube.com/watch?v=9BFaLAa428k
+## https://wiki.archlinux.org/index.php/Man_page#Colored_man_pages
+#man() {
+# env LESS_TERMCAP_mb=$'\E[01;31m' \
+# LESS_TERMCAP_md=$'\E[01;31m' \
+# LESS_TERMCAP_me=$'\E[0m' \
+# LESS_TERMCAP_se=$'\E[0m' \
+# LESS_TERMCAP_so=$'\E[01;44;33m' \
+# LESS_TERMCAP_ue=$'\E[0m' \
+# LESS_TERMCAP_us=$'\E[01;32m' \
+# man "$@"
+#}
+#
+## view markdown as manpages
+## http://blog.metamatt.com/blog/2013/01/09/previewing-markdown-files-from-the-terminal/
+mdless(){ pandoc -s -f markdown -t man "$*" | groff -T utf8 -man | less ;}
+## view markdown within lynx
+## https://tosbourn.com/view-markdown-files-terminal/
+#rmd(){ pandoc "$*" | lynx -stdin ;}
+## view markdown within w3m
+rmd(){ pandoc "$*" | w3m -T text/html ;}
+#
+## quickly cd out of directories using numbers, example: up 2
+up() { local x='';for i in $(seq ${1:-1});do x="$x../"; done;cd $x; }
+#
+## list all file access permission
+#lsp() { stat --format "%a %n" * ;}
+#
+## show file access permission
+## http://unix.stackexchange.com/a/46921
+#file-permission() { stat --format '%a %n' "$@" ;}
+#
+## display mime of file application/zip, application/x-tar
+#file-type() { file --mime-type -b "$@" ;}
+#
+# call vim help page from shell prompt
+function :h { vim +":h $1" +'wincmd o' +'nnoremap q :q!<CR>' ;}
+#
+# call vim Info page from shell prompt
+function viminfo () { vim -c "Info $1" -c "bdelete 1"; }
+alias info=viminfo
+#
+## searches for manual locally or online
+#manned() {
+# for arg in "$@"; do man $arg 2> /dev/null \
+# || $arg -H 2> /dev/null || $arg -h 2> /dev/null \
+# || $arg --help-all 2> /dev/null || $arg --help 2> /dev/null \
+# || help $arg 2> /dev/null \
+# || $BROWSERCLI "http://manned.org/browse/search?q=$@" 2> /dev/null \
+# || $BROWSER "http://manned.org/browse/search?q=$@" 2> /dev/null \
+# || open "http://manned.org/browse/search?q=$@" 2> /dev/null \
+# || xdg-open "http://manned.org/browse/search?q=$@"
+# done
+#}
+#
+## python calculator
+## press Ctrl+D to quit
+## http://docs.python.org/library/math.html
+## tutorial video: http://www.youtube.com/watch?v=JkyodHenTuc
+#calc() {
+# if which python2 >/dev/null; then
+# python2 -ic "from __future__ import division; from math import *; from random import *"
+# else
+# python3 -ic "from math import *; import cmath"
+# fi
+#}
+#
+## change font size (guake terminal)
+## tutorial video: http://www.youtube.com/watch?v=i9aKFgxOjwQ
+chfontsize() {
+ # guake
+ gconftool-2 --set '/apps/guake/style/font/style' --type string "Monospace ${1:-16}"
+#
+# #gnome-terminal
+# dconf write /org/gnome/terminal/legacy/profiles:/$(dconf list /org/gnome/terminal/legacy/profiles:/)font "'Monospace ${1:-16}'"
+}
+#
+## Use podboat as download manager
+
+#podqueue() {
+ #if [ $# -lt 1 ]
+ #then
+ #echo -e "Add links to Podboat, Use Podboat as a TUI Download Manager."
+ #echo -e "\nUsage: $0 <url>"
+ #echo -e "\n\nExample:\n$0 http://abcxyz.com/filename.mp3"
+ #return 1
+ #fi
+ #URL="$1"
+ #SAVE_PATH="${HOME}/Downloads"
+ #GET_FILENAME="($(echo $1)" | rev | cut -d\/ -f1 | rev | sed -e 's@\%20@\_@g' )"
+ #echo "$URL" "$SAVE_PATH/$GET_FILENAME" >> ${HOME}/.newsboat/queue
+#}
+## search commandlinefu.com
+
+cmdfu() { curl "http://www.commandlinefu.com/commands/matching/$(echo "$@" \
+ | sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" ;}
+#
+#
+## display one random command from commandlinefu.com
+#cmdfu-random() { echo -e "`curl -sL http://www.commandlinefu.com/commands/random/json|sed -re 's/.*,"command":"(.*)","summary":"([^"]+).*/\\x1b[1;32m\2\\n\\n\\x1b[1;33m\1\\x1b[0m/g'`\n" ;}
+#
+## check if a website is down
+## usage: down4me google.com
+#down4me() { curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g';}
+#
+## convert doc/docx to pdf (dont upload sensitive data)
+## tutorial video: http://www.youtube.com/watch?v=r90IdQwF-hs
+#doc2pdf() { curl -# -F inputDocument=@"$1" http://www.doc2pdf.net/convert/document.pdf > "${1%.*}.pdf" ;}
+#
+## w3m browser with inline images
+## https://plus.google.com/102499719144563443986/posts/Vja8W69iHoi
+## tutorial video: http://www.youtube.com/watch?v=R2bMUtCOGko
+
+w3mimg() { w3m -o imgdisplay=/usr/lib64/w3m/w3mimgdisplay $1 ;}
+
+#
+## mplayer to display webcam
+## hit 's' to take screenshot, will save in current folder
+## hit 'S' to take series of screenshot, will save in current folder
+## hit 'f' to toggle fullscreen
+## hit 'T' to toggle stay-on-top
+## hit 'q' or 'Esc' to quit
+## https://wiki.archlinux.org/index.php/Webcam_Setup#MPlayer
+#webcam-list() { v4l2-ctl --list-formats-ext && v4l2-ctl --list-devices ;}
+#
+#webcam-mplayer() { mplayer tv:// -tv driver=v4l2:width=640:height=360:device=/dev/video0 -fps 30 -vf screenshot -ontop -geometry "99%:95%" ;}
+#
+#webcam-mplayer-noborder() { mplayer tv:// -tv driver=v4l2:width=640:height=360:device=/dev/video0 -fps 30 -vf screenshot -geometry "98%:98%" -ontop -noborder ;}
+#
+#webcam-mplayer-screenshot() { mplayer tv:// -tv driver=v4l2:width=1920:height=1080:device=/dev/video0 -fps 30 -vf screenshot -ontop ;}
+#
+##}}}
+###########################################################
+##-------- Gotbletu Universal Package Manager {{{
+##------------------------------------------------------
+## DEMO: https://www.youtube.com/watch?v=N8CZhlIssdk
+## DESC: auto detect package manager and loads proper alias for it
+#
+## legends# {{{
+## https://wiki.archlinux.org/index.php/Pacman_Rosetta
+## http://old-en.opensuse.org/Software_Management_Command_Line_Comparison
+## https://bbs.archlinux.org/viewtopic.php?pid=1281605#p1281605
+## Arch -- pacman, yaourt
+## Debian/Ubuntu -- apt-get(apt), aptitude, dpkg
+## Gentoo -- eclean, emerge, equery, layman
+## OpenSuse -- zypper
+## Red Hat/Fedora -- package-cleanup, rpm, yum
+## Suse -- rug
+## Not finish, only tested on Debian, Arch, Fedora so far
+#
+## cleanold; removes certain packages that can no longer be downloaded
+## cleanall; remove all local cached packages
+## list; show the content of an installed package
+## localinstall; install package manually such as deb, rpm files downloaded
+## own; find a command a package belongs to; ex: pkm-own convert
+## purge; uninstall package and purge configuration files (not in /home)
+## query; search for an already installed package
+## refresh; update repository list
+## upgrade; install the newest version from the repositories
+## hold/unhold; stop/allow a package from being update
+##
+## missing
+## emerge: autoclean, purge, list, query
+## rug: pkm-info, clean, autoremove, autoclean, purge, list, query
+## zypper: pkm-info, autoremove, autoclean, purge, list, query
+## yum: autoclean, purge
+## }}}
+#
+find_pkm() { for i;do which "$i" >/dev/null && { echo "$i"; return 0;};done;return 1; }
+export PKMGR=$(find_pkm yaourt pacman apt-get yum zypper emerge aptitude )
+#export PKMGR=$(find_pkm zypper )
+
+# {{{ apt-get
+if [ "$PKMGR" = "apt-get" ]; then
+ pkm-cleanallall() { sudo apt-get clean ;}
+ pkm-cleanallold() { sudo apt-get autoclean ;}
+ pkm-dependsreverse() { apt-cache rdepends "$@" ;}
+ pkm-download() { wget $(apt-get --print-uris -y install "$@" | grep ^\'| cut -d\' -f2) ;}
+ pkm-extract() { ar vx "$@" | tar -zxvf data.tar.gz ;}
+ # same as; echo "pkgname hold" | dpkg --set-selections
+ pkm-hold() { sudo apt-mark hold "$@" ;}
+ pkm-hold-status() { dpkg --get-selections | awk "/${@:-hold}/" ;}
+ pkm-info() { apt-cache show "$@" ;}
+ pkm-install() { sudo apt-get install --no-install-recommends "$@" ;}
+ pkm-list() { dpkg -L "$@" ;}
+ pkm-listcache() { ls -1 /var/cache/apt/archives "$@" && \
+ echo "pwd: /var/cache/apt/archives" ;}
+ pkm-localinstall() { sudo dpkg -i "$@" ;}
+ pkm-own() { dpkg -S $(which "$@") ;}
+ pkm-pkgsearch() { apt-file search "$@" ;}
+ pkm-purge() { sudo apt-get purge "$@" ;}
+ pkm-query() { dpkg --get-selections | grep "$@" ;}
+ pkm-refresh() { sudo apt-get update ;}
+ pkm-remove() { sudo apt-get remove "$@" ;}
+ pkm-remove-orphans() { sudo apt-get autoclean ;}
+ pkm-search() { apt-cache search "$@" ;}
+ pkm-unhold() { sudo apt-mark unhold "$@" ;}
+ pkm-upgrade() { sudo apt-get update && sudo apt-get upgrade ;}
+ # PPA on ubuntu base distro (not compatible with debian)
+ ppa-add() { sudo add-apt-repository $@ ;}
+ ppa-del() { sudo add-apt-repository -r $@ ;}
+ ppa-key() { sudo apt-key add $@ ;}
+ ppa-list() { ls /etc/apt/sources.list.d ;}
+ ppa-purge() { sudo ppa-purge $@ ;}
+ # auto get missing gpg keys from launchpad
+ ppa-autokey() { sudo apt-get update 2> /tmp/keymissing; \
+ for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); \
+ do echo -e "\nProcessing key: $key"; gpg --keyserver pool.sks-keyservers.net \
+ --recv $key && gpg --export --armor $key | sudo apt-key add -; done ;}
+ # these are extra servers, just replace it if one is down
+ # keyserver.ubuntu.com
+ # pool.sks-keyservers.net
+ # subkeys.pgp.net
+ # pgp.mit.edu
+ # keys.nayr.net
+ # keys.gnupg.net
+ # wwwkeys.en.pgp.net #(replace with your country code fr, en, de,etc)
+ # }}}
+# {{{ aptitude
+elif [ "$PKMGR" = "aptitude" ]; then
+ pkm-cleanallall() { sudo aptitude clean ;}
+ pkm-cleanallold() { sudo aptitude autoclean ;}
+ pkm-dependsreverse() { aptitude why "$@" ;}
+ pkm-download() { aptitude download "$@" ;} # need a better 1; deb w/ depends
+ pkm-extract() { ar vx "$@" | tar -zxvf data.tar.gz ;}
+ pkm-hold() { echo "$1 hold" | sudo dpkg --set-selections && \
+ dpkg --get-selections | awk "/$1/ && /hold/" ;}
+ pkm-hold-status() { dpkg --get-selections | awk "/${@:-hold}/" ;}
+ pkm-info() { aptitude show "$@" ;}
+ pkm-install() { sudo aptitude install --without-recommends "$@" ;}
+ pkm-list() { dpkg -L "$@" ;}
+ pkm-listcache() { ls -1 /var/cache/apt/archives "$@" && \
+ echo "pwd: /var/cache/apt/archives" ;}
+ pkm-localinstall() { sudo dpkg -i "$@" ;}
+ pkm-own() { dpkg -S $(which "$@") ;}
+ pkm-pkgsearch() { apt-file search "$@" ;}
+ pkm-purge() { sudo aptitude purge "$@" ;}
+ pkm-query() { dpkg --get-selections | grep "$@" ;}
+ pkm-refresh() { sudo aptitude update ;}
+ pkm-remove() { sudo aptitude remove "$@" ;}
+ pkm-remove-orphans() { sudo aptitude autoclean ;}
+ pkm-search() { aptitude search "$*" ;}
+ # fix maybe with keyword $@ | sed / / ~d/
+ pkm-search-description() { aptitude search ~d"$1"~d"$2"~d"$3"~d"$4"~d"$5"~d"$6"~d"$7" ;}
+ pkm-unhold() { echo "$1 install" | sudo dpkg --set-selections && \
+ dpkg --get-selections | awk "/$1/ && /install/" ;}
+ pkm-upgrade() { sudo aptitude update && sudo aptitude upgrade ;}
+ # PPA on ubuntu base distro (not compatible with debian)
+ ppa-add() { sudo add-apt-repository $@ ;}
+ ppa-del() { sudo add-apt-repository -r $@ ;}
+ ppa-key() { sudo apt-key add $@ ;}
+ ppa-list() { ls /etc/apt/sources.list.d ;}
+ ppa-purge() { sudo ppa-purge $@ ;}
+ ppa-autokey() { sudo apt-get update 2> /tmp/keymissing; \
+ for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); \
+ do echo -e "\nProcessing key: $key"; gpg --keyserver pool.sks-keyservers.net \
+ --recv $key && gpg --export --armor $key | sudo apt-key add -; done ;}
+# }}}
+# {{{ emerge
+elif [ "$PKMGR" = "emerge" ]; then
+ pkm-remove-orphans() { sudo emerge --depclean ;}
+ pkm-cleanall() { sudo eclean distfiles ;}
+ pkm-info() { emerge -S "$@" ;}
+ pkm-install() { sudo emerge "$@" ;}
+ pkm-pkgsearch() { equery belongs "$@" ;}
+ pkm-refresh() { sudo layman -f ;}
+ pkm-remove() { sudo emerge -C "$@" ;}
+ pkm-search() { emerge -S "$@" ;}
+ pkm-upgrade() { sudo emerge -u world ;}
+# }}}
+# {{{ pacman
+elif [ "$PKMGR" = "pacman" ]; then
+ pkm-build() { tar xvzf "$1" && cd "${1%%.tar.gz}" && makepkg -csi ;}
+ pkm-cleanall() { sudo pacman -Sc ;}
+ pkm-cleanold() { sudo pacman -Scc ;}
+ if type -p downgrade > /dev/null; then
+ # require: https://aur.archlinux.org/packages/downgrade/
+ pkm-downgrade() { downgrade "$@" ;}
+ fi
+ pkm-download() { sudo pacman -Sw "$@" ;}
+ pkm-info() { for arg in "$@"; do
+ pacman -Qi $arg 2> /dev/null \
+ || pacman -Si $arg; done ;}
+ pkm-install() { sudo pacman -S "$@" ;}
+ pkm-key() { sudo pacman-key --init \
+ && sudo pacman-key --populate archlinux \
+ && sudo pacman-key --refresh-keys ;}
+ pkm-list() { pacman -Qql "$@" ;}
+ pkm-listinstalled() { pacman -Qe ;}
+ pkm-listcache() { ls -1 /var/cache/pacman/pkg "$@" && \
+ echo "pwd: /var/cache/pacman/pkg" ;}
+ pkm-localinstall() { sudo pacman --noconfirm -U "$@" ;}
+ pkm-own() { pacman -Qo "$@" ;}
+ pkm-pkgsearch() { pkgfile -s "$@" ;}
+ pkm-purge() { sudo pacman -R "$@" ;}
+ pkm-query() { pacman -Qqs "$@" ;}
+ pkm-query-detail() { pacman -Qs "$@" ;}
+ pkm-refresh() { sudo pacman -Syy ;}
+ pkm-remove() { sudo pacman -Rcs "$@" ;}
+ pkm-remove-nodepends() { sudo pacman -Rdd "$@" ;}
+ pkm-remove-orphans() { sudo pacman -Rs $(pacman -Qqtd) ;}
+ pkm-search() { pacman -Ss "$@" ;}
+ pkm-search-local() { pacman -Qs "$@" ;}
+ pkm-upgrade() { sudo pacman -Syu ;}
+# }}}
+# {{{ rug
+elif [ "$PKMGR" = "rug" ]; then
+ pkm-install() { sudo rug install "$@" ;}
+ pkm-refresh() { sudo rug refresh ;}
+ pkm-remove() { sudo rug remove "$@" ;}
+ pkm-search() { rug search "$@" ;}
+ pkm-upgrade() { sudo rug update ;}
+# }}}
+# {{{ yaourt
+elif [ "$PKMGR" = "yaourt" ]; then
+ pkm-build() { tar xvzf "$1" && cd "${1%%.tar.gz}" && makepkg -csi ;}
+ pkm-cleanall() { yaourt -Sc ;}
+ pkm-cleanold() { yaourt -Scc ;}
+ if type -p downgrade > /dev/null; then
+ # require: https://aur.archlinux.org/packages/downgrade/
+ pkm-downgrade() { downgrade "$@" ;}
+ fi
+ pkm-download() { sudo pacman -Sw "$@" ;} # need better shit to dl from aur also
+ pkm-info() { for arg in "$@"; do
+ yaourt -Qi $arg 2> /dev/null \
+ || yaourt -Si $arg; done ;}
+ pkm-install() { yaourt --noconfirm -S "$@" ;}
+ # https://wiki.archlinux.org/index.php/Pacman-key#Resetting_all_the_keys
+ pkm-key() { sudo pacman-key --init \
+ && sudo pacman-key --populate archlinux \
+ && sudo pacman-key --refresh-keys ;}
+ pkm-list() { yaourt -Qql "$@" ;}
+ pkm-listinstalled() { yaourt -Qe ;}
+ pkm-listcache() { ls -1 /var/cache/pacman/pkg "$@" && \
+ echo "pwd: /var/cache/pacman/pkg" ;}
+ pkm-localinstall() { sudo pacman --noconfirm -U "$@" ;}
+ pkm-own() { pacman -Qo "$@" ;}
+ pkm-pkgsearch() { pkgfile -s "$@" ;}
+ pkm-purge() { yaourt -R "$@" ;}
+ pkm-query() { pacman -Qqs "$@" ;}
+ pkm-query-detail() { yaourt -Qs "$@" ;}
+ pkm-refresh() { yaourt -Syy ;}
+ pkm-remove() { yaourt -Rcs "$@" ;}
+ pkm-remove-nodepends() { yaourt -Rdd "$@" ;}
+ pkm-remove-orphans() { yaourt -Rs $(pacman -Qqtd) ;}
+ pkm-search() { yaourt --noconfirm "$@" ;}
+ pkm-search-local() { yaourt -Qs "$@" ;}
+ pkm-upgrade() { yaourt -Syu ;} # upgrade everything except aur package
+ pkm-upgrade-aur() { yaourt --noconfirm -Sbua ;} # only upgrade aur package
+# }}}
+# {{{ yum
+elif [ "$PKMGR" = "yum" ]; then
+ pkm-cleanall() { sudo yum clean ;}
+ pkm-depends() { sudo yum deplist "$@" ;}
+ pkm-dependsreverse() { sudo yum resolvedep "$@" ;}
+ pkm-info() { for arg in "$@"; do
+ rpm -qi $arg 2> /dev/null || yum info $arg; done ;}
+ pkm-install() { sudo yum install "$@" ;}
+ pkm-list() { for arg in "$@"; do
+ rpm -ql $arg 2> /dev/null || repoquery -ql --plugins $arg; done ;}
+ pkm-localinstall() { sudo yum localinstall "$@" ;}
+ pkm-own() { rpm -qf $(which "$@") ;}
+ pkm-pkgsearch() { yum whatprovides "$@" ;}
+ pkm-query() { rpm -q "$@" ;}
+ pkm-refresh() { sudo yum clean expire-cache && sudo yum check-update ;}
+ pkm-remove() { sudo yum remove "$@" ;}
+ pkm-remove-orphans() { sudo package-cleanup --leaves ;}
+ pkm-search() { yum search "$@" ;}
+ pkm-upgrade() { sudo yum update ;}
+# }}}
+# {{{ zypper
+elif [ "$PKMGR" = "zypper" ]; then
+ pkm-cleanall() { sudo zypper clean ;}
+ pkm-install() { sudo zypper install "$@" ;}
+ pkm-pkgsearch() { zypper what-provides "$@" ;}
+ pkm-refresh() { sudo zypper refresh ;}
+ pkm-remove() { sudo zypper remove "$@" ;}
+ pkm-search() { zypper search "$@" ;}
+ pkm-upgrade() { sudo zypper update ;}
+fi
+# }}}
+#
+##}}}
+###########################################################
+##-------- Clipboard and Upload {{{
+##------------------------------------------------------
+## DEMO: http://www.youtube.com/watch?v=fKP0FLp3uW0 (xclip)
+## https://www.youtube.com/watch?v=Ww7Sl4d8F8A (pastebinit)
+## DESC: copy/paste for linux machines (Mac style)
+#
+alias pbcopy='xclip -selection clipboard' # copy to clipboard, ctrl+c, ctrl+shift+c
+alias pbpaste='xclip -selection clipboard -o' # paste from clipboard, ctrl+v, ctrl+shitt+v
+alias pbselect='xclip -selection primary -o' # paste from highlight, middle click, shift+insert
+alias pbnoformatting='xclip -selection clipboard -o | xclip -selection clipboard'
+#
+#
+## dump text from clipboard to pastebin server and copy link
+#alias pbdumpslexy='pbpaste | pastebinit -b "slexy.org" | pbcopy && echo "URL has been copied to clipboard" && pbpaste'
+#alias pbdumpsprungeus="pbpaste | curl -F 'sprunge=<-' http://sprunge.us | pbcopy && echo 'URL has been copied to clipboard' && pbpaste"
+#alias pbdumpixio="pbpaste | curl -F 'f:1=<-' ix.io | pbcopy && echo 'URL has been copied to clipboard' && pbpaste"
+#
+#
+#alias pbuploadslexy='pbpaste | pastebinit -b "slexy.org" | pbcopy && echo "URL has been copied to clipboard" && pbpaste'
+#
+#alias pbuploadsprungeus="cat "$@" | curl -F 'sprunge=<-' http://sprunge.us | pbcopy && echo 'URL has been copied to clipboard' && pbpaste"
+#alias pbuploadixio="cat "$1" | curl -F 'f:1=<-' ix.io | pbcopy && echo 'URL has been copied to clipboard' && pbpaste"
+#
+#
+#
+## }}}
+###########################################################
+##-------- Screenshot and Upload {{{
+##------------------------------------------------------
+## DEMO: http://www.youtube.com/watch?v=Hh8G1aBp8gc
+## DESC: take screenshot fullscreen, single window or draw a box
+#export PATH_SCREENSHOT=~/Pictures/screenshots
+#pix() { scrot -d 2 "$PATH_SCREENSHOT/fullscr_`date +'%F_%Hh%Ms%S'`.png" ;}
+#pix-area() { sleep 2 && scrot -s "$PATH_SCREENSHOT/windowed_`date +'%F_%Hh%Ms%S'`.png" ;}
+#
+#
+## DEMO: http://www.youtube.com/watch?v=7-9uYSGyvU0
+## DESC: upload to imgur.com
+## REFF: http://www.commandlinefu.com/commands/view/9341
+#upl-imgur() {
+# curl -\# -F image=@"$1" -F "key=1913b4ac473c692372d108209958fd15" \
+# http://api.imgur.com/2/upload.xml | grep -Eo "<original>(.)*</original>" \
+# | grep -Eo "http://i.imgur.com/[^<]*"
+#}
+#
+## }}}
+###########################################################
+##-------- Flexget (Torrent RSS) {{{
+##------------------------------------------------------
+## DEMO: http://www.youtube.com/playlist?list=PLqv94xWU9zZ0pVGrgKtMuhFHun8-MahSY
+## DESC: auto download torrent similar to how a DVR works
+## URL: http://flexget.com/
+#
+#alias flexget='$HOME/anaconda2/bin/flexget'
+#flexget-list() { flexget series list && flexget movie_list list waiting && flexget movie_list list downloaded ;}
+#flexget-check() { flexget check ;} # check if config file has any errors
+#flexget-test() { flexget --test execute ;} # dry run
+#flexget-execute() { flexget execute ;}
+#flexget-cron() { flexget execute --cron ;} # skip writing to logs
+#flexget-version() { flexget -V ;}
+#flexget-learnall() { flexget execute --learn ;} #bypass dling old torrents
+#flexget-add() { flexget movie_list add "$@" ;}
+#flexget-del() { flexget movie_list del "$@" ;}
+#flexget-forget() { flexget movie_list forget "$@" ;} # allow redownloading on waiting list
+#
+##}}}
+###########################################################
+##-------- Convert to Video {{{
+##------------------------------------------------------
+## http://linuxconfig.org/ffmpeg-audio-format-conversions
+convert2video_mp4() {
+ if [ $# -lt 1 ]; then
+ echo -e "Usage: $0 <file_name>"
+ echo -e "\nsingle: $0 file.avi"
+ echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+ echo -e "\nwildcard: $0 *.avi"
+ return 1
+ fi
+
+ myArray=( "$@" )
+ for arg in "${myArray[@]}"; do
+ while [ ! -f "${arg%.*}"-movie.mp4 ]
+ do
+ ffmpeg -i "$arg" -codec:v libx264 -preset medium -crf 22 -codec:a aac -qscale:a 6 -strict experimental "${arg%.*}"-movie.mp4
+ done
+ done
+}
+#
+#convert2video_avi() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.mp4"
+# echo -e "\nmultiple: $0 file1.mp4 file2.mp4 file3.mp4"
+# echo -e "\nwildcard: $0 *.mp4"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}"-movie.avi ]
+# do
+# ffmpeg -i "$arg" -codec:v mpeg4 -vtag xvid -qscale:v 3 -codec:a libmp3lame -qscale:a 4 "${arg%.*}"-movie.avi
+# done
+# done
+#}
+#
+#convert2video_ogv() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}"-movie.ogv ]
+# do
+# ffmpeg -i "$arg" -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 "${arg%.*}"-movie.ogv
+# done
+# done
+#}
+#
+#convert2video_mpg() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}"-movie.mpg ]
+# do
+# ffmpeg -i "$arg" -codec:v mpeg2video -qscale:v 2 -codec:a mp2 -b:a 192k "${arg%.*}"-movie.mpg
+# done
+# done
+#}
+#
+#convert2video_mkv() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}"-movie.mkv ]
+# do
+# ffmpeg -i "$arg" -codec:v libx264 -preset medium -crf 22 -codec:a libvorbis -qscale:a 5 "${arg%.*}"-movie.mkv
+# done
+# done
+#}
+#
+#convert2video_webm() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}"-movie.webm ]
+# do
+# ffmpeg -i "$arg" -codec:v libvpx -crf 10 -b:v 1M -codec:a libvorbis "${arg%.*}"-movie.webm
+# done
+# done
+#}
+#
+## convert video to gif animation
+## http://superuser.com/a/730389
+## http://superuser.com/a/841379
+#convert_to_gifv() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert video to animated gif"
+# echo -e "\nUsage:\n$0 <file> <resolution>"
+# echo -e "\nexample:\n$0 file.mkv \n"
+# echo -e "$0 file.mkv 320\n"
+# echo -e "$0 file.mkv 720\n"
+# echo -e "$0 file.mkv 1080\n"
+# echo -e "Note: animated gif size are usually x2 or x3 the size of the original video file"
+#
+# return 1
+# fi
+#
+# # get video resolution (height)
+# eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width "$1")
+# size=${streams_stream_0_height}
+#
+# ffmpeg -i "$1" -vf scale="${2:-$size}":-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - "${1%.*}"-gifvid"$2".gif
+#}
+#
+## }}}
+###########################################################
+##-------- Convert to iOS (iPod, Macs, iPhone, Apple TV) {{{
+##------------------------------------------------------
+## https://trac.handbrake.fr/wiki/BuiltInPresets
+#
+#convert2iOS_ipod() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's low resolution settings for the iPod (5G and up)"
+# echo -e "Optimized for great playback on the iPod screen, with smaller file size."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".ipod.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.ipod.mp4" --preset="iPod"
+# done
+# done
+#}
+#convert2iOS_universal() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs"
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".universal.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.universal.mp4" --preset="Universal"
+# done
+# done
+#}
+#
+#convert2iOS_iphone() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's settings for all iPhones and iPod Touches going back to the original iPhone 2G."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".iphone.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.iphone.mp4" --preset="iPhone & iPod touch"
+# done
+# done
+#}
+#
+#convert2iOS_ipodtouch() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's settings for all iPhones and iPod Touches going back to the original iPhone 2G."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".ipodtouch.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.ipodtouch.mp4" --preset="iPhone & iPod touch"
+# done
+# done
+#}
+#
+#convert2iOS_ipad() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".ipad.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.ipad.mp4" --preset="iPad"
+# done
+# done
+#}
+#
+#convert2iOS_appletv() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".appletv.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.appletv.mp4" --preset="AppleTV"
+# done
+# done
+#}
+#
+#convert2iOS_appletv2() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".appletv2.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.appletv2.mp4" --preset="AppleTV 2"
+# done
+# done
+#}
+#
+#convert2iOS_appletv3() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".appletv3.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.appletv3.mp4" --preset="AppleTV 3"
+# done
+# done
+#}
+#
+## }}}
+###########################################################
+##-------- Convert to Devices (Other, Gaming Device) {{{
+##------------------------------------------------------
+## http://develop.participatoryculture.org/index.php/ConversionMatrix
+#
+#convert2psp() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".psp.mp4 ]
+# do
+# ffmpeg -i "$arg" -s 320x240 -b:v 512000 -ar 24000 -ab 64000 -f psp -r 29.97 -strict experimental "${arg%.*}".psp.mp4
+# done
+# done
+#}
+#
+#convert2windowsphone8() {
+#if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+#fi
+#
+#myArray=( "$@" )
+#for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".windowsphone8.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.windowsphone8.mp4" --preset="Windows Phone 8"
+# done
+#done
+#}
+#
+## }}}
+###########################################################
+##-------- Convert to Archive {{{
+##------------------------------------------------------
+#
+## to see required install for different formats
+## $ patool formats
+#convert2archive_7z() { patool repack "$1" "${1%.*}".7z ;}
+#convert2archive_ace() { patool repack "$1" "${1%.*}".ace ;}
+#convert2archive_jar() { patool repack "$1" "${1%.*}".jar ;}
+#convert2archive_rar() { patool repack "$1" "${1%.*}".rar ;}
+#convert2archive_tar() { patool repack "$1" "${1%.*}".tar ;}
+#convert2archive_xz() { patool repack "$1" "${1%.*}".xz ;}
+#convert2archive_zip() { patool repack "$1" "${1%.*}".zip ;}
+#convert2archive_targz() { patool repack "$1" "${1%.*}".tar.gz ;}
+#convert2archive_tarbz2() { patool repack "$1" "${1%.*}".tar.bz2 ;}
+#convert2archive_tarlzma() { patool repack "$1" "${1%.*}".tar.lzma ;}
+#
+## https://en.wikipedia.org/wiki/Comic_book_archive
+#convert2archive_cbz() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.gz"
+# echo -e "\nmultiple: $0 file1.gz file2.gz file3.gz"
+# echo -e "\nwildcard: $0 *.gz"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# if [[ ! -f "${arg%.*}".zip && ! -f "${arg%.*}".cbz ]]; then
+# patool repack "$arg" "${arg%.*}".zip && mv "${arg%.*}".zip "${arg%.*}".cbz
+# else
+# if [[ -f "${arg%.*}".zip ]]; then
+# mv -v -- "${arg%.*}".zip "${arg%.*}".cbz
+# fi
+# fi
+# done
+#}
+#
+#convert2archive_cb7() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.gz"
+# echo -e "\nmultiple: $0 file1.gz file2.gz file3.gz"
+# echo -e "\nwildcard: $0 *.gz"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# if [[ ! -f "${arg%.*}".7z && ! -f "${arg%.*}".cb7 ]]; then
+# patool repack "$arg" "${arg%.*}".7z && mv "${arg%.*}".7z "${arg%.*}".cb7
+# else
+# if [[ -f "${arg%.*}".7z ]]; then
+# mv -v -- "${arg%.*}".7z "${arg%.*}".cb7
+# fi
+# fi
+# done
+#}
+#convert2archive_cba() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.gz"
+# echo -e "\nmultiple: $0 file1.gz file2.gz file3.gz"
+# echo -e "\nwildcard: $0 *.gz"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# if [[ ! -f "${arg%.*}".ace && ! -f "${arg%.*}".cba ]]; then
+# patool repack "$arg" "${arg%.*}".ace && mv "${arg%.*}".ace "${arg%.*}".cba
+# else
+# if [[ -f "${arg%.*}".ace ]]; then
+# mv -v -- "${arg%.*}".ace "${arg%.*}".cba
+# fi
+# fi
+# done
+#}
+#convert2archive_cbt() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.gz"
+# echo -e "\nmultiple: $0 file1.gz file2.gz file3.gz"
+# echo -e "\nwildcard: $0 *.gz"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# if [[ ! -f "${arg%.*}".tar && ! -f "${arg%.*}".cbt ]]; then
+# patool repack "$arg" "${arg%.*}".tar && mv "${arg%.*}".tar "${arg%.*}".cbt
+# else
+# if [[ -f "${arg%.*}".tar ]]; then
+# mv -v -- "${arg%.*}".tar "${arg%.*}".cbt
+# fi
+# fi
+# done
+#}
+#convert2archive_cbr() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.gz"
+# echo -e "\nmultiple: $0 file1.gz file2.gz file3.gz"
+# echo -e "\nwildcard: $0 *.gz"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# if [[ ! -f "${arg%.*}".rar && ! -f "${arg%.*}".cbr ]]; then
+# patool repack "$arg" "${arg%.*}".rar && mv "${arg%.*}".rar "${arg%.*}".cbr
+# else
+# if [[ -f "${arg%.*}".rar ]]; then
+# mv -v -- "${arg%.*}".rar "${arg%.*}".cbr
+# fi
+# fi
+# done
+#}
+#
+## }}}
+###########################################################
+##-------- VimWiki {{{
+##------------------------------------------------------
+wikimd() { $EDITOR ~/vimwiki/index.md ;}
+## }}}
+###########################################################
+##-------- Slice Videos {{{
+##------------------------------------------------------
+#
+## movie = both audio & video
+## audiotrack = audio only
+## videotrack = video only
+#
+## mplayer OSD in milliseconds
+#mplayer-milliseconds() { mplayer -osd-fractions 1 -osdlevel 3 "$1" -ss "${2:-00:00:00}" ;}
+#
+#slice_movie() {
+# if [ $# -lt 5 ]
+# then
+# echo -e "Use ffmpeg to slice movie (video & audio tracks) with beginning and endpoint with accurate milliseconds"
+# echo -e "\nUsage:\n$0 file hh:mm:ss ms hh:mm:ss ms"
+# echo -e "\nexample:\n$0 file.mp4 00:01:00 00 00:05:00 00 \n"
+#
+# return 1
+# fi
+#
+# # code
+# BEGINTIME=${2}
+# ENDTIME=${4}
+#
+# # Convert the times to seconds from the Epoch
+# SEC1=`date +%s -d ${BEGINTIME}`
+# SEC2=`date +%s -d ${ENDTIME}`
+#
+# # Use expr to do the math
+# DIFFSEC=`expr ${SEC2} - ${SEC1}`
+# DURATIONTIME=`date +%H:%M:%S -ud @${DIFFSEC}`
+#
+# ffmpeg -i "$1" -ss ${BEGINTIME}."$3" -t ${DURATIONTIME}."$5" -codec:v copy -codec:a copy "${1%.*}"-"$0"-`date +'%F_%Hh%Ms%S'`."${1##*.}"
+#
+#}
+#
+#slice_videotrack() {
+# if [ $# -lt 5 ]
+# then
+# echo -e "Use ffmpeg to slice videotrack (no audio) with beginning and endpoint with accurate milliseconds"
+# echo -e "\nUsage:\n$0 file hh:mm:ss ms hh:mm:ss ms"
+# echo -e "\nexample:\n$0 file.mp4 00:01:00 00 00:05:00 00 \n"
+#
+# return 1
+# fi
+#
+# BEGINTIME=${2}
+# ENDTIME=${3}
+#
+# SEC1=`date +%s -d ${BEGINTIME}`
+# SEC2=`date +%s -d ${ENDTIME}`
+#
+# DIFFSEC=`expr ${SEC2} - ${SEC1}`
+# DURATIONTIME=`date +%H:%M:%S -ud @${DIFFSEC}`
+#
+# ffmpeg -i "$1" -ss ${BEGINTIME}."$3" -t ${DURATIONTIME}."$5" -an -codec:v copy "${1%.*}"-"$0"-`date +'%F_%Hh%Ms%S'`."${1##*.}"
+#
+#}
+#
+#slice_audiotrack() {
+# if [ $# -lt 5 ]
+# then
+# echo -e "Use ffmpeg to slice audiotrack (no video) with beginning and endpoint with accurate milliseconds"
+# echo -e "\nUsage:\n$0 file hh:mm:ss ms hh:mm:ss ms"
+# echo -e "\nexample:\n$0 file.mp4 00:01:00 00 00:05:00 00 \n"
+#
+# return 1
+# fi
+#
+# BEGINTIME=${2}
+# ENDTIME=${3}
+#
+# SEC1=`date +%s -d ${BEGINTIME}`
+# SEC2=`date +%s -d ${ENDTIME}`
+#
+# DIFFSEC=`expr ${SEC2} - ${SEC1}`
+# DURATIONTIME=`date +%H:%M:%S -ud @${DIFFSEC}`
+#
+# ffmpeg -i "$1" -ss ${BEGINTIME}."$3" -t ${DURATIONTIME}."$5" -vn -codec:a copy "${1%.*}"-"$0"-`date +'%F_%Hh%Ms%S'`."${1##*.}"
+#}
+#
+## }}}
+###########################################################
+##-------- RipMe CLI (Bulk Image Downloader) {{{
+##------------------------------------------------------
+## image album downloader
+## https://github.com/4pr0n/ripme
+## CLI options: https://github.com/4pr0n/ripme/wiki/How-To-Run-RipMe
+#ripme-cli() { java -jar /usr/share/java/ripme-git-1.2.8.jar -l ~/Downloads -u "$@" ;}
+#
+## }}}
+###########################################################
+##-------- Mount Archive (ZIP|RAR|TAR) {{{
+##------------------------------------------------------
+## http://ubuntuforums.org/showthread.php?t=1207096
+#mount-archive() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "mount archive files (zip|rar|tar...etc)"
+# echo -e "\nUsage:\n$0 <archive>"
+# echo -e "\nexample:\n$0 file.zip"
+# return 1
+# fi
+#
+# # mount the archive
+# gvfs-mount "archive://$( ( echo -n 'file://' ; readlink -f "$1" ; ) | perl -MURI::Escape -lne 'print uri_escape($_)')"
+#
+# # if mount was sucessful then cd into gvfs dir and ls the mountpoint
+# if [ $? -eq 0 ]; then
+# cd "/run/user/$(id -u)/gvfs" && ls
+# else
+# return 1
+# fi
+#
+#}
+#unmount-archive() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "unmount archive files (zip|rar|tar)"
+# echo -e "\nUsage:\n$0 <mount_point"
+# echo -e "\nexample:\n$0 disc_image.iso"
+# echo -e "cd /run/user/${UID}/gvfs/ && $0 mount_point"
+# return 1
+# fi
+# gvfs-mount -u "/run/user/$(id -u)/gvfs/$1"
+#}
+#
+## }}}
+###########################################################
+##-------- Mount Disc Images (ISO|NRG|BIN|MDF|IMG) {{{
+##------------------------------------------------------
+#mount-discimage() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "mount ISO filesystem images (iso,nrg,bin,mdf,img)"
+# echo -e "\nUsage:\n$0 <disc_image>"
+# echo -e "\nexample:\n$0 disc_image.iso"
+# echo -e "$0 disc_image.iso disc_image2.bin disc_image3.mdf"
+# echo -e "$0 *.iso"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# fuseiso -n -p "$arg" "/tmp/$arg"
+# done
+#
+# # if mount was sucessful then cd and ls the mountpoint
+# if [ $? -eq 0 ]; then
+# cd "/tmp/$1" && ls
+# else
+# return 1
+# fi
+#
+#}
+#
+#unmount-discimage() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "unmount ISO filesystem images (iso,nrg,bin,mdf,img)"
+# echo -e "\nUsage:\n$0 <mount_point|disc_image>"
+# echo -e "\nexample:\n$0 disc_image.iso"
+# echo -e "$0 disc_image.iso disc_image2.bin"
+# echo -e "$0 mount_point1 mount_point2"
+# echo -e "cd /tmp && $0 mount_point"
+# echo -e "cd /tmp && $0 *.iso"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# fusermount -u "$arg"
+# done
+#}
+## }}}
+###########################################################
+##-------- Image Resizer (32|96|128|480|600|768|720|960|1080) {{{
+##------------------------------------------------------
+## Resizing Pictures to different resolutions
+#
+#image-resize-32x32() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 32x32 "${arg%.*}"_32x32_resized."${arg##*.}"
+# done
+#}
+#image-resize-96x96() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 96x96 "${arg%.*}"_96x96_resized."${arg##*.}"
+# done
+#}
+#image-resize-128x128() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 128x128 "${arg%.*}"_128x128_resized."${arg##*.}"
+# done
+#}
+#image-resize-640x480() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 640x480 "${arg%.*}"_640x480_resized."${arg##*.}"
+# done
+#}
+#
+#image-resize-800x600() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 800x600 "${arg%.*}"_800x600_resized."${arg##*.}"
+# done
+#}
+#
+#image-resize-1024x768() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 1024x768 "${arg%.*}"_1024x768_resized."${arg##*.}"
+# done
+#}
+#image-resize-1280x720() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 1280x720 "${arg%.*}"_1280x720_resized."${arg##*.}"
+# done
+#}
+#image-resize-1280x960() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 1280x960 "${arg%.*}"_1280x960_resized."${arg##*.}"
+# done
+#}
+#image-resize-1920x1080() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -resize 1920x1080 "${arg%.*}"_1920x1080_resized."${arg##*.}"
+# done
+#}
+#
+## }}}
+###########################################################
+#
+###############################
+######## C. STREAMING MEDIA ###
+###############################
+## Code that is still useful but I no longer use it, still here for references
+#
+###########################################################
+##-------- Peerflix (Popcorntime CLI) {{{
+##------------------------------------------------------
+## DEMO: https://www.youtube.com/watch?v=NG13yOTPgfY
+## URL: https://github.com/saironiq/shellscripts
+## DESC: popcorntime from terminal
+#PFLIX_PORT=55055
+#peerflix-vlc() { vlc http://localhost:$PFLIX_PORT ;}
+#peerflix-mplayer() { mplayer http://localhost:$PFLIX_PORT ;}
+#
+## }}}
+###########################################################
+##-------- Play Youtube videos in mplayer {{{
+#yt-mp() { export YTFILE=$1 ;mplayer -fs -cookies -cookies-file /tmp/cookies.txt $(`youtube-dl -g --cookies /tmp/cookies.txt $YTFILE` ) ; unset YTFILE;}
+## }}}
+###########################################################
+##-------- Sopcast CLI v2 (Streaming P2P Videos) {{{
+##------------------------------------------------------
+## DEMO: http://www.youtube.com/watch?v=Dm7cFjhzgHo
+## DESC: watch movies/tv shows over p2p
+#
+## REFF:
+## http://www.sopcast.com/chlist.xml
+## http://sopcast.ucoz.com
+## http://streams.magazinmixt.ro
+## google keyword: sop://broker.sopcast
+#
+## package:
+## Archlinux: sopcast ( x64 https://www.archlinux.org/packages/multilib/x86_64/sopcast/)
+## Archlinux: sopcast ( x32 https://www.archlinux.org/packages/community/i686/sopcast/)
+## Ubuntu/Debian: sp-auth (https://launchpad.net/~jason-scheunemann/+archive/ppa)
+#
+## choose a player (cvlc is default)
+## SP_VIDPLAYER=cvlc
+#SP_VIDPLAYER=(cvlc --file-caching=10000)
+## SP_VIDPLAYER=vlc
+## SP_VIDPLAYER=(vlc --control=lirc)
+## SP_VIDPLAYER=mplayer
+## SP_VIDPLAYER=(mplayer -cache 1000)
+#
+## wait X seconds to stabilize channel (make it longer if u got slower connection)
+#SP_SLEEP=15
+#
+## sopcast port and player port
+#SP_LOCAL_PORT=55050
+#SP_PLAYER_PORT=55051
+#
+## manually kill sopcast (sometimes it doesnt exit properly and still uses bandwidth in the background)
+#sppc-kill() { killall sp-sc ;}
+#
+## kills existing connection, starts a new connection, sleep X sec to stabilize the stream, waits to player to exit and kill itself
+#sppc() {
+# killall sp-sc &>/dev/null
+# (sp-sc "$1" $SP_LOCAL_PORT $SP_PLAYER_PORT &>/dev/null &)
+# sleep $SP_SLEEP
+# ($SP_VIDPLAYER http://localhost:$SP_PLAYER_PORT)
+# wait
+# killall sp-sc
+#}
+#
+##### eng = english, ro = romanian, esp = espanol/spanish
+## added on February 06, 2014
+#spp-doc-discovery.eng,ro() { sppc "sop://broker.sopcast.com:3912/256241" ;}
+#spp-doc-discoveryid.eng,ro() { sppc "sop://broker.sopcast.com:3912/256244" ;}
+#spp-doc-discoveryscience.eng,ro() { sppc "sop://broker.sopcast.com:3912/256243" ;}
+#spp-doc-discoveryworld.eng,ro() { sppc "sop://broker.sopcast.com:3912/256242" ;}
+#spp-doc-history.eng,ro() { sppc "sop://broker.sopcast.com:3912/253032" ;}
+#spp-doc-natgeo.eng,ro() { sppc "sop://broker.sopcast.com:3912/148248" ;}
+#spp-doc-natgeowild.eng,ro() { sppc "sop://broker.sopcast.com:3912/253037" ;}
+#spp-movie-hbo.eng,ro() { sppc "sop://broker.sopcast.com:3912/148985" ;}
+#spp-movie-hbocomedy.eng,ro() { sppc "sop://broker.sopcast.com:3912/149255" ;}
+#spp-tv-axn.eng,ro() { sppc "sop://broker.sopcast.com:3912/253035" ;}
+#spp-tv-comedycentral.eng,ro() { sppc "sop://151.80.76.190:3912/253470" ;}
+#spp-tv-foxsports2.eng,ro() { sppc "sop://124.232.150.188:3920/5730" ;}
+#
+##}}}
+###########################################################
+##-------- MPS-Youtube Channels {{{
+##------------------------------------------------------
+# tutorial video: https://www.youtube.com/watch?v=VE2iCBkIs8E
+mps-d() { mpsyt dlurl $1 ; }
+mps-p() { mpsyt dvpl $1 ; }
+
+mpsyt-collider-movietalk() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcmbuEa2cRW7Xe4_NrnVrxXn" ;}
+mpsyt-collider-jedicouncil() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcnqEWU6U0D8I95SUiqVU3DR" ;}
+mpsyt-collider-heroes() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcnaH7ltMEq0h8jBlfU79kwg" ;}
+mpsyt-collider-mailbag() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcnuYS9PZhp3jgOSlb9BzaKs" ;}
+mpsyt-collider-spoilers() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBclxpYg1JdmqUYQnKCCiPcPd" ;}
+mpsyt-collider-arrow() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcleKplDKkFuxLrcL9-7Gw8T" ;}
+mpsyt-collider-flash() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBcmOgOIwVNJV0G6YerPH_Fhp" ;}
+mpsyt-collider-starwarsrebels() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBckZWQgRqTXB2CYRdzNuhBJX" ;}
+mpsyt-collider-walkingdead() { mpsyt pl "https://www.youtube.com/playlist?list=PLayt6616lBckJSHjt2QlwJ91YmNb_oH7k" ;}
+mpsyt-amc-spoilers() { mpsyt pl "https://www.youtube.com/playlist?list=PLYNW0PN4_jrrILuvfws1zYComnO5n4nmJ" ;}
+mpsyt-afterbuzz-arrowaftershow() { mpsyt pl PL6THzna6gLceNeZoXKUOoDeO7cwI57rJn ;}
+mpsyt-afterbuzz-flash() { mpsyt pl "https://www.youtube.com/playlist?list=PL6THzna6gLcdfHMhXnGy-O0kS0q-muucC" ;}
+mpsyt-afterbuzz-gameofthrones() { mpsyt pl PL0404DAD1AD037666 ;}
+mpsyt-thestreamtv-arrow() { mpsyt pl "https://www.youtube.com/playlist?list=PLgh_e6sv2kpr40BXrvZ2qONoSlxFspXGK" ;}
+mpsyt-thestreamtv-flash() { mpsyt pl "https://www.youtube.com/playlist?list=PLgh_e6sv2kprr9KHr94poccrwkAILkCcU" ;}
+mpsyt-btt-beyondthetrailer() { mpsyt user beyondthetrailer ;}
+mpsyt-btt-thinkabouttheink() { mpsyt user thinkabouttheink ;}
+mpsyt-movie-watchmojo() { mpsyt user watchmojo ;}
+mpsyt-movie-robertjones() { mpsyt user owiseone1 ;}
+mpsyt-comic-variantcomics() { mpsyt user VariantComics ;}
+mpsyt-tv-emergencyawesome() { mpsyt user emergencyawesome ;}
+mpsyt-greatmilitarybattles() { mpsyt user greatmilitarybattles ;}
+mpsyt-greentvgreentv() { mpsyt user greentvgreentv ;}
+mpsyt-homeorganizing() { mpsyt user homeorganizing ;}
+mpsyt-hak5(){ mpsyt user hak5 ;}
+mpsyt-linux-linuxgamecast() { mpsyt user linuxgamecast ;}
+mpsyt-linux-jupiterbroadcasting() { mpsyt user jupiterbroadcasting ;}
+mpsyt-midwaysimplicity() { mpsyt user midwaysimplicity ;}
+mpsyt-midwaysimplicity-mtohami() { mpsyt user mtohami ;}
+mpsyt-minimalism-carriesimple() { mpsyt user UCtauuxrTG1yon8CNsgqhDkg ;}
+mpsyt-minimalism-discernmylife() { mpsyt user UCJPp8gkjxH4T3A8rYO1S52A ;}
+mpsyt-minimalism-poetskinny() { mpsyt user UC4O0Vd3UxFXGX-UQNelwTag ;}
+mpsyt-minimalism-ticoandtina() { mpsyt user ticoandtina ;}
+mpsyt-minimalism-unconventionalliving() { mpsyt user UC7uuFb0QztC-yC2CrcS-lJw ;}
+mpsyt-minimalism-zenminimalism() { mpsyt user UCpD5Hqe60AJ79fupvuA6F1Q ;}
+mpsyt-mma-arielhelwani() { mpsyt user arielhelwani ;}
+mpsyt-mma-fueltv() { mpsyt user fueltv ;}
+mpsyt-mma-gracieacademy() { mpsyt user gracieacademy ;}
+mpsyt-mma-graciebreakdown() { mpsyt user graciebreakdown ;}
+mpsyt-mma-karynbryant() { mpsyt user karynbryant ;}
+mpsyt-mma-mmaheat() { mpsyt user mmaheat ;}
+mpsyt-mma-mmafightingonsbn() { mpsyt user mmafightingonsbn ;}
+mpsyt-mma-thefightnetwork() { mpsyt user thefightnetwork ;}
+mpsyt-mma-themmanuts() { mpsyt user themmanuts ;}
+mpsyt-mma-ufc() { mpsyt user ufc ;}
+mpsyt-mma-uncutsports() { mpsyt user uncutsports ;}
+mpsyt-movie-cinefix() { mpsyt user CineFix ;}
+mpsyt-peakmoment() { mpsyt user peakmoment ;}
+mpsyt-poetskinny() { mpsyt user poetskinny ;}
+mpsyt-poetskinnyUnleashed() { mpsyt user PoetskinnyUnleashed ;}
+mpsyt-tinyhouse-kirstendirksen() { mpsyt user kirstendirksen ;}
+mpsyt-tinyhouse-livingbigtinyhouse() { mpsyt user livingbigtinyhouse ;}
+mpsyt-tinyhouse-relaxshacksDOTcom() { mpsyt user relaxshacksDOTcom ;}
+mpsyt-tinyhouse-tinyhousegj() { mpsyt user tinyhousegj ;}
+mpsyt-tmw-askhodgetwins() { mpsyt user askhodgetwins ;}
+mpsyt-tmw-fastingtwins() { mpsyt user fastingtwins ;}
+mpsyt-tmw-getfit4women() { mpsyt user getfit4women ;}
+mpsyt-tmw-hodgetwins() { mpsyt user hodgetwins ;}
+mpsyt-tmw-hodgetwinsonsports() { mpsyt user hodgetwinsonsports ;}
+mpsyt-tmw-twinmuscleworkout() { mpsyt user twinmuscleworkout ;}
+mpsyt-vanlife-christravels() { mpsyt user tylerdurdeno9 ;}
+mpsyt-vanlife-exploringalternatives() { mpsyt user explorealternatives ;}
+mpsyt-vanlife-noellemarie() { mpsyt user noellemarie42 ;}
+mpsyt-vanlife-happilyhouseless() { mpsyt user TheNomadicvanman ;}
+mpsyt-vanlife-justincredible() { mpsyt user JustinCredibleTV ;}
+mpsyt-vanlife-nomadicfanatic() { mpsyt user nomadicfanatic ;}
+mpsyt-walkingdead() { mpsyt pl "http://www.youtube.com/playlist?list=PLC7EC9FB2E211A261" ;}
+mpsyt-walkingdead-talkingdead() { mpsyt pl "http://www.youtube.com/playlist?list=PLP63B9XPsQt3H_5xGXifFxFJE7-RsKFb6" ;}
+mpsyt-walkingdead-webisodes() { mpsyt pl "http://www.youtube.com/playlist?list=PLC09448134D906619" ;}
+mpsyt-wwefannation() { mpsyt user wwefannation ;}
+#
+## }}}
+###########################################################
+##-------- Youtube Viewer Channels {{{
+##------------------------------------------------------
+## tutorial video: http://www.youtube.com/watch?v=FnJ67oAxVQ4
+## watch/login/comment/search/download...etc video on youtube, all from cli
+## https://github.com/trizen/youtube-viewer
+#yt-listen() { youtube-viewer -n $@ ;} # no video, music/audio only
+#yt-music() { youtube-viewer -n --category=Music --top ;} # show top music list
+#yts-movie-movieclipstrailer() { youtube-viewer -u UCi8e0iOVk1fEOogdfu4YgfA ;}
+#yts-amcmovietalk() { youtube-viewer -p PLBFB97E5B9494EEBD ;}
+#yts-amcmovietalk-mailbag() { youtube-viewer -p PLYNW0PN4_jrqlBqzAVRv3rfpo6nhzJnKp ;}
+#yts-amctheatres() { youtube-viewer -u amctheatres ;}
+#yts-afterbuzz-arrowaftershow() { youtube-viewer -p PL6THzna6gLceNeZoXKUOoDeO7cwI57rJn ;}
+#yts-afterbuzz-gameofthrones() { youtube-viewer -p PL0404DAD1AD037666 ;}
+#yts-afterbuzz-revolution() { youtube-viewer -p PL6THzna6gLccSY_0Cmoy6DvfH0iC8fyLR ;}
+#yts-btt-beyondthetrailer() { youtube-viewer -u beyondthetrailer ;}
+#yts-btt-thinkabouttheink() { youtube-viewer -u thinkabouttheink ;}
+#yts-comic-watchmojo() { youtube-viewer -u watchmojo ;}
+#yts-game-cinemassacre() { youtube-viewer -u cinemassacre ;}
+#yts-game-craigslistgamefinds() { youtube-viewer -u craigslistgamefinds ;}
+#yts-game-happyconsolegamer() { youtube-viewer -u happyconsolegamer ;}
+#yts-game-jamesnintendonerd() { youtube-viewer -u jamesnintendonerd ;}
+#yts-game-metaljesusrocks() { youtube-viewer -u metaljesusrocks ;}
+#yts-game-mcfrosticles() { youtube-viewer -u mcfrosticles ;}
+#yts-game-seejayare() { youtube-viewer -u SeeJayAre ;}
+#yts-game-retroliberty() { youtube-viewer -u retroliberty ;}
+#yts-greatmilitarybattles() { youtube-viewer -u greatmilitarybattles ;}
+#yts-greentvgreentv() { youtube-viewer -u greentvgreentv ;}
+#yts-homeorganizing() { youtube-viewer -u homeorganizing ;}
+#yts-linuxgamecast() { youtube-viewer -u linuxgamecast ;}
+#yts-jupiterbroadcasting() { youtube-viewer -u jupiterbroadcasting ;}
+#yts-minimalism-carriesimple() { youtube-viewer -u UCtauuxrTG1yon8CNsgqhDkg ;}
+#yts-minimalism-poetskinny() { youtube-viewer -u UC4O0Vd3UxFXGX-UQNelwTag ;}
+#yts-minimalism-ticoandtina() { youtube-viewer -u ticoandtina ;}
+#yts-minimalism-unconventionalliving() { youtube-viewer -u UC7uuFb0QztC-yC2CrcS-lJw ;}
+#yts-minimalism-zenminimalism() { youtube-viewer -u UCpD5Hqe60AJ79fupvuA6F1Q ;}
+#yts-midwaysimplicity() { youtube-viewer -u midwaysimplicity ;}
+#yts-midwaysimplicity-mtohami() { youtube-viewer -u mtohami ;}
+#yts-mma-arielhelwani() { youtube-viewer -u arielhelwani ;}
+#yts-mma-fueltv() { youtube-viewer -u fueltv ;}
+#yts-mma-gracieacademy() { youtube-viewer -u gracieacademy ;}
+#yts-mma-graciebreakdown() { youtube-viewer -u graciebreakdown ;}
+#yts-mma-karynbryant() { youtube-viewer -u karynbryant ;}
+#yts-mma-mmaheat() { youtube-viewer -u mmaheat ;}
+#yts-mma-mmafightingonsbn() { youtube-viewer -u mmafightingonsbn ;}
+#yts-mma-thefightnetwork() { youtube-viewer -u thefightnetwork ;}
+#yts-mma-themmanuts() { youtube-viewer -u themmanuts ;}
+#yts-mma-ufc() { youtube-viewer -u ufc ;}
+#yts-mma-uncutsports() { youtube-viewer -u uncutsports ;}
+#yts-peakmoment() { youtube-viewer -u peakmoment ;}
+#yts-poetskinny() { youtube-viewer -u poetskinny ;}
+#yts-poetskinnyunleashed() { youtube-viewer -u PoetskinnyUnleashed ;}
+#yts-tinyhouse-kirstendirksen() { youtube-viewer -u kirstendirksen ;}
+#yts-tinyhouse-livingbigtinyhouse() { youtube-viewer -u livingbigtinyhouse ;}
+#yts-tinyhouse-relaxshacksDOTcom() { youtube-viewer -u relaxshacksDOTcom ;}
+#yts-tinyhouse-tinyhousegj() { youtube-viewer -u tinyhousegj ;}
+#yts-tmw-askhodgetwins() { youtube-viewer -u askhodgetwins ;}
+#yts-tmw-fastingtwins() { youtube-viewer -u fastingtwins ;}
+#yts-tmw-getfit4women() { youtube-viewer -u getfit4women ;}
+#yts-tmw-hodgetwins() { youtube-viewer -u hodgetwins ;}
+#yts-tmw-hodgetwinsonsports() { youtube-viewer -u hodgetwinsonsports ;}
+#yts-tmw-twinmuscleworkout() { youtube-viewer -u twinmuscleworkout ;}
+#yts-vanlife-christravels() { youtube-viewer -u tylerdurdeno9 ;}
+#yts-vanlife-happilyhouseless() { youtube-viewer -u TheNomadicvanman ;}
+#yts-vanlife-justincredible() { youtube-viewer -u JustinCredibleTV ;}
+#yts-walkingdead() { youtube-viewer -p PLC7EC9FB2E211A261 ;}
+#yts-walkingdead-talkingdead() { youtube-viewer -p PLP63B9XPsQt3H_5xGXifFxFJE7-RsKFb6 ;}
+#yts-walkingdead-webisodes() { youtube-viewer -p PLC09448134D906619 ;}
+#yts-wwefannation() { youtube-viewer -u wwefannation ;}
+### }}}
+###########################################################
+##-------- NVLC Podcast RSS {{{
+##------------------------------------------------------
+## DEMO: https://www.youtube.com/watch?v=7y_58wpHuFE
+## DESC: play local and internet media using ncurses VLC
+#
+#nvlc-player() { nvlc ${1:-cdda://} ;} # other cdrom; cdda:///dev/cdrom ; cdda:///dev/sr0 ; cdda:///dev/sr1
+#nvlc-podcast() { nvlc -S podcast --podcast-urls "$@" ;}
+#podcast-nba-shaq() { nvlc-podcast "http://www.podcastone.com/podcast?categoryID2=779" ;}
+#podcast-mma-mmahour() { nvlc-podcast "http://feeds.feedburner.com/aol/fanhouse/mmahour/audio?format=xml" ;}
+#podcast-mma-mmabeat() { nvlc-podcast "http://feeds.podtrac.com/ZGWlPI2WWyVk" ;}
+#podcast-mma-mmajunkie() { nvlc-podcast "http://feeds.feedburner.com/MMAjunkieRadio?format=xml" ;}
+#podcast-mma-mmaproradio() { nvlc-podcast "http://feeds.feedburner.com/ProMmaRadio" ;}
+#podcast-mma-chaelsonnen() { nvlc-podcast "http://feeds.feedburner.com/YoureWelcomeWithChaelSonnen?format=xml" ;}
+#podcast-mma-mmareport() { nvlc-podcast "http://staticv3.fightnetwork.com/xml/itunes_mma.rss" ;}
+#podcast-mma-joerogan() { nvlc-podcast "http://joeroganexp.joerogan.libsynpro.com/rss" ;}
+#podcast-wwf-stonecold() { nvlc-podcast "http://www.podcastone.com/podcast?categoryID2=436" ;}
+#podcast-wwf-chrisjericho() { nvlc-podcast "http://www.podcastone.com/podcast?categoryID2=593" ;}
+#podcast-wwf-liveaudiowrestling() { nvlc-podcast "http://staticv3.fightnetwork.com/xml/itunes_law.rss" ;}
+#podcast-wwf-solomonster() { nvlc-podcast "http://solomonster.podbean.com/feed/" ;}
+#podcast-wwf-bookert() { nvlc-podcast "https://api.radio.com/v2/podcast/rss/1240?format=MP3_128K" ;}
+#podcast-movie-schmoesknow() { nvlc-podcast "http://feeds.feedburner.com/SchmoesKnowMoviesPodcast" ;}
+#podcast-movie-dcmovienews() { nvlc-podcast "http://popcorntalknetwork.com/category/shows/dc-movie-news-podcast/feed/" ;}
+#podcast-fitness-jillianmichaels() { nvlc-podcast "http://feeds.sideshownetwork.tv/JillianMichaels" ;}
+#podcast-talk-jessahinton() { nvlc-podcast "http://www.podcastone.com/podcast?categoryID2=797" ;}
+#podcast-talk-emilymorse() { nvlc-podcast "http://feeds.feedburner.com/SexWithEmily" ;}
+#podcast-talk-lorasomoza() { nvlc-podcast "https://s3.amazonaws.com/betweenthesheetswithlora/feeds/betweenthesheetsrss.xml" ;}
+#podcast-starwars-farfaraway() { nvlc-podcast "http://geeknation.com/podcast-feed/far-far-away/" ;}
+#podcast-linux-thirdworldlinux() { nvlc-podcast "http://feeds.feedburner.com/thirdworldlinuxogg" ;}
+#podcast-linux-linuxactionshow() { nvlc-podcast "http://feeds.feedburner.com/TheLinuxActionShowOGG" ;}
+#podcast-linux-linuxunplugged() { nvlc-podcast "http://feeds.feedburner.com/linuxunogg" ;}
+#podcast-linux-techtalktoday() { nvlc-podcast "http://feedpress.me/t3ogg" ;}
+#podcast-linux-everydaylinux() { nvlc-podcast "http://elementopie.com/feeds/everydaylinux/feed.xml" ;}
+#podcast-linux-goinglinux() { nvlc-podcast "http://goinglinux.com/oggpodcast.xml" ;}
+#podcast-linux-hackerpublicradio() { nvlc-podcast "http://hackerpublicradio.org/hpr_total_ogg_rss.php" ;}
+#podcast-science-nprradiolab() { nvlc-podcast "http://feeds.wnyc.org/radiolab" ;}
+#podcast-science-startalk() { nvlc-podcast "http://feeds.soundcloud.com/users/soundcloud:users:38128127/sounds.rss" ;}
+#podcast-science-thisweekinscience() { nvlc-podcast "http://feeds.feedburner.com/twis/science/" ;}
+#
+##}}}
+###########################################################
+##-------- Internet Music {{{
+## URL: http://whatnotlinux.blogspot.com/2013/02/somafm-and-digitally-imported-bash.html
+#somafm() {
+#while true; do local station;echo "Select a station to listen to:";select station in "Doomed" "Groove Salad" "Lush" "Suburbs of Goa" "Secret Agent" "Drone Zone" "Space Station" "cliqhop idm" "Digitalis" "Sonic Universe" "Boot Liquor" "Covers" "Illinois Street Lounge" "indie pop rocks" "PopTron" "Tags Trip" "Beat Bender" "Mission Control";do station=$(echo -n "$station"|tr '[:upper:]' '[:lower:]'|sed 's/ //g');break;done; mplayer -playlist http://somafm.com/startstream=${station}.pls; done;
+#}
+#
+#difm() {
+#while true; do local station;echo "Select a station to listen to:";select station in "trance" "vocaltrance" "electro" "chillout" "eurodance" "house" "soulfulhouse" "funkyhouse" "tribalhouse" "harddance" "minimal" "techno" "progressive" "goapsy" "hardstyle" "hardcore" "djmixes" "lounge" "drumandbass" "classictechno" "ambient" "breaks" "futuresynthpop";do station=$(echo -n "$station"|tr '[:upper:]' '[:lower:]'|sed 's/ //g');break;done; mplayer -playlist http://www.di.fm/mp3/${station}.pls; done;
+#}
+#
+##}}}
+###########################################################
+#
+###############################
+######## D. OBSOLETE LIST #####
+###############################
+## Code that is still useful but I no longer use it, still here for references
+#
+###########################################################
+##-------- Recordmydesktop CLI {{{
+##------------------------------------------------------
+## http://www.pclinuxos.com/forum/index.php/topic,97181.msg822796.html#msg822796
+## Screen capture software
+## Ctrl+C Stop
+## Ctrl+C x2 Cancle rendering
+## BUG: RMD Adjusted recording window, which cuts 10 pixel from the height, thus we have to use offset -x -y
+## https://wiki.archlinux.org/index.php/RecordMyDesktop
+## http://sourceforge.net/p/recordmydesktop/discussion/590957/thread/cf788e96/
+## https://groups.google.com/forum/#!topic/linux.debian.bugs.dist/reE8_9fqqAw
+## native reso 1680x1050 -- > rmd reso 1080x1040, offset y axis -y 6
+## SOUND LAG? lower the freq; 45000, 44100, 22050
+## http://www.kkoncepts.net/blog/fixing-out-sync-audio-and-video-ffmpeg
+#RMD_OUTPUT=~/Public/screencast/rr_movie_baking.ogv
+#
+## Frequency; lower to fix sound lag; 45000, 44100, 22050
+#RMD_FREQ=22050
+#
+## Frames per second
+#RMD_FPS=30
+#
+## Channel (mono = 1 ; dual = 2)
+#RMD_CHANNELS=1
+#
+## SoundCard (pulse for pulseaudio; install pavucontrol to change pulse settings)
+## hw:0,1 for directly communicating with your soundcard
+## to get a list of sound device:
+## arecord -l
+## aplay -l
+## cat /proc/asound/pcm
+## alsamixer and hit F6
+## FF_SOUNDCARD=pulse
+## FF_SOUNDCARD=hw:0,1
+#RMD_SOUNDCARD=hw:3,0
+#
+#rmd-all() { recordmydesktop --no-wm-check --no-frame --full-shots --fps $RMD_FPS --channels $RMD_CHANNELS --device $RMD_SOUNDCARD --freq $RMD_FREQ --overwrite -o $RMD_OUTPUT ;}
+#
+## Benq Monitor; 1680x1050 (make sure 2nd monitor is higher res)
+## Initial recording window is set to:
+## X:0 Y:0 Width:1680 Height:1050
+## Adjusted recording window is set to:
+## X:0 Y:0 Width:1680 Height:1056
+#rmd-benq() { recordmydesktop --no-wm-check --no-frame --full-shots --width 1680 --height 1050 --fps $RMD_FPS --channels $RMD_CHANNELS --device $RMD_SOUNDCARD --freq $RMD_FREQ --overwrite -o $RMD_OUTPUT ;}
+#
+#
+## ProscanTV; 1920x1080 --> 1920x1072 ; X offset by 1680
+## Initial recording window is set to:
+## X:0 Y:0 Width:1920 Height:1080
+## Adjusted recording window is set to:
+## X:0 Y:4 Width:1920 Height:1072
+#rmd-proscantv() { recordmydesktop --no-wm-check --no-frame --full-shots -x 1680 --width 1920 --height 1072 --fps $RMD_FPS --channels $RMD_CHAN --device $RMD_DEV --freq $RMD_FREQ --overwrite -o $RMD_OUTPUT ;}
+#
+## Examples
+## select window
+## E1: (select window); recordmydesktop --no-frame --full-shots --fps 30 --channels 2 --freq 44100 --windowid $(xwininfo | awk '/Window id:/ {print $4}') --overwrite -o out.ogv ;}
+## E2: recordmydesktop --no-wm-check --no-frame --width 1680 --height 1050 --fps 30 --channels 1 --device hw:3,0 --freq 44100 --overwrite -o out.ogv ;}
+##E3: (fullscreen); recordmydesktop --no-frame --full-shots --fps 30 --channels 2 --freq 44100 --overwrite -o out.ogv ;}
+#
+##}}}
+###########################################################
+##-------- Air Comic Server # {{{
+##------------------------------------------------------
+## tutorial Video: http://www.youtube.com/watch?v=YceW_VcGA4A
+## http://gnomewarrior32.blogspot.kr/2013/03/air-comic-server-english.html
+#ACSJar=~/.scripts/aircomic/AirComicServer.jar
+#ACSConf=~/.scripts/aircomic/AirComicServer.xml
+#
+#cfg-aircomicserver() { $EDITOR $ACSConf ;}
+#aircomicserver() { nohup java -jar $ACSJar -c $ACSConf -n >/dev/null 2>&1& }
+#aircomicserver-lite() { nohup java -XX:+UseSerialGC -Xms32M -Xminf=5 -Xmaxf=10 -jar $ACSJar -c $ACSConf -n >/dev/null 2>&1& }
+#aircomicserver-gui() { nohup java -XX:+UseSerialGC -Xms32M -Xminf=5 -Xmaxf=10 -jar $ACSJar -c $ACSConf >/dev/null 2>&1& }
+#aircomicserver-quit() { kill $(ps -ef | grep '[A]irComicServer.jar' | awk '{print $2}') ;}
+## }}}
+###########################################################
+##-------- Cherry Music Server # {{{
+##------------------------------------------------------
+## tutorial Video: https://www.youtube.com/watch?v=X2goFerMJDY
+#
+#BIN_CHERRYMUSIC=~/.scripts/cherrymusic/cherrymusic
+#cherrymusic() { nohup python $BIN_CHERRYMUSIC --port 8442 >/dev/null 2>&1& }
+#cherrymusic-setup() { python $BIN_CHERRYMUSIC --setup --port 8442 ;}
+#cherrymusic-quit() { kill $(ps -ef | grep -i '[C]herrymusic' | awk '{print $2}') ;}
+#cfg-cherrymusic() { $EDITOR ~/.config/cherrymusic/cherrymusic.conf ;}
+#
+## }}}
+###########################################################
+##-------- Sharelin (Gnutella2 P2P Downloader) {{{
+##------------------------------------------------------
+#
+## tutorial video: https://www.youtube.com/watch?v=Yi3JKyL-hxk
+#sharelin-daemon() { sharelin -d ;}
+#sharelin-quit() { killall sharelin ;}
+#
+## }}}
+###########################################################
+##-------- Aria2c WebUI {{{
+##------------------------------------------------------
+## downloader for torrents, magnet links, http, ftp, metalinks
+## tutorial video: https://www.youtube.com/watch?v=LCr_0zFcbaM
+#alias magnet-to-torrent="aria2c -q --bt-metadata-only --bt-save-metadata"
+#aria2c-quit() {
+# killall aria2c
+# kill $(ps -ef | grep '[h]ttp.server' | awk '{print $2}')
+# #kill $(ps -ef | grep '[S]impleHTTPServer' | awk '{print $2}')
+#}
+#
+#aria2c-webui() {
+# # download location
+# DIR_DL=~/Downloads
+#
+# # run as daemon
+# aria2c --enable-rpc --rpc-listen-all -D -d "$DIR_DL"
+#
+#
+# # use python simplehttpserver to host the webui
+# # this avoids download the index.html file on each computer
+# # https://github.com/ziahamza/webui-aria2
+#
+# # path to the webui index.html
+# DIR_WEBUI=~/.scripts/webui-aria2/
+#
+# # webui-aria2c uses port 6800 so we use 6801 for python_simple_http_server
+# PORT=6801
+# cd "$DIR_WEBUI"
+# nohup python3 -m http.server "$PORT" >/dev/null 2>&1&
+#
+# # for older distro
+# # nohup python2 -m SimpleHTTPServer "$PORT" >/dev/null 2>&1&
+#
+# echo "connect via http://localhost:$PORT or http://ip_address_of_server:$PORT"
+#}
+#
+## }}}
+###########################################################
+##-------- iPod 5G Device {{{
+##------------------------------------------------------
+## convert to ipod 5g compatible video format
+## tutorial video: http://www.youtube.com/watch?v=gVVeR9KizBk
+#
+#ipod5g() { HandBrakeCLI -i "$1" -o "${1%.*}.ipod5g.mp4" --preset="iPod" ;}
+#ipod5g-tsp() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.ipod5g.mp4" --preset="iPod" ;}
+#ipod5g-rsync() {
+## https://gist.github.com/nekobato/5998548
+## including trailing slashes on $SRC
+## rsync $SRC/Music/ $DEST/media/Ipod
+#rsync -avrm --delete-excluded --modify-window=2 --include '*/' --include '*.mp3' --exclude '*' "$1" "$2"
+#}
+#
+#tsp-handbrake-normal() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.normal.mp4" --preset="Normal" ;}
+#tsp-handbrake-high() { tsp HandBrakeCLI -i "$1" -o "${1%.*}.high.mp4" --preset="High Profile" ;}
+#
+## }}}
+###########################################################
+##-------- Spell Checking / Translation Related {{{
+##------------------------------------------------------
+## spell checking
+## tutorial video: http://www.youtube.com/watch?v=UEwz5eeaZzc
+#check-word() { echo "$1" | aspell -a ;}
+#check-list() { cat "$1" | aspell list ;}
+#check-file() { aspell check "$1" ;}
+#
+##}}}
+###########################################################
+##-------- i3 / Openbox {{{
+##------------------------------------------------------
+## wallpaper path
+#
+#
+#setwallpaper() {
+#ConnectedMonitor="$(xrandr | awk '/ connected/ {print $1}' | head -n 1)"
+#PATH_WALLPAPER=~/Pictures/Wallpapers
+#
+# # find current running windows manager
+# CURRENT_WM="$(wmctrl -m | grep "Name:" | awk '{print $2}')"
+#
+# # mate
+# if [ $CURRENT_WM = Marco ]; then
+# gsettings set org.mate.background picture-filename "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # xfce
+# # tutorial video: http://www.youtube.com/watch?v=tL9uVT8D6k4
+# if [[ $DESKTOP_SESSION = Xfwm4 ]] || [[ $DESKTOP_SESSION = "Xfce Session" ]]; then
+# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor"$ConnectedMonitor"/workspace0/last-image -s "$PWD"/"$1"
+# fi
+#
+# # i3
+# if [ $DESKTOP_SESSION = i3 ]; then
+# # feh --randomize --bg-fill "$PATH_WALLPAPER"/*
+# feh --randomize --bg-fill "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # gnome shell
+# # tutorial video: http://www.youtube.com/watch?v=B_VnPXy3VCw
+# if [ $DESKTOP_SESSION = GNOME ]; then
+# gsettings set org.gnome.desktop.background picture-uri file://"$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+#
+# # gnome2
+# if [ $DESKTOP_SESSION = GNOME ]; then
+# gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # lxde
+# # tutorial video: http://www.youtube.com/watch?v=5xzfBiHuknk
+# if [ $DESKTOP_SESSION = LXDE ]; then
+# pcmanfm -w "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+# }
+#
+#
+#chwallpaper() {
+#ConnectedMonitor="$(xrandr | awk '/ connected/ {print $1}' | head -n 1)"
+#PATH_WALLPAPER=~/Pictures/Wallpapers
+#
+# # find current running windows manager
+# CURRENT_WM="$(wmctrl -m | grep "Name:" | awk '{print $2}')"
+#
+# # mate
+# if [ $CURRENT_WM = Marco ]; then
+# gsettings set org.mate.background picture-filename "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # xfce
+# # tutorial video: http://www.youtube.com/watch?v=tL9uVT8D6k4
+# if [[ $DESKTOP_SESSION = Xfwm4 ]] || [[ $DESKTOP_SESSION = "Xfce Session" ]]; then
+# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor"$ConnectedMonitor"/workspace0/last-image -s "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # i3
+# if [ $DESKTOP_SESSION = i3 ]; then
+# # feh --randomize --bg-fill "$PATH_WALLPAPER"/*
+# feh --randomize --bg-fill "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # gnome shell
+# # tutorial video: http://www.youtube.com/watch?v=B_VnPXy3VCw
+# if [ $DESKTOP_SESSION = GNOME ]; then
+# gsettings set org.gnome.desktop.background picture-uri file://"$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+#
+# # gnome2
+# if [ $DESKTOP_SESSION = GNOME ]; then
+# gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+#
+# # lxde
+# # tutorial video: http://www.youtube.com/watch?v=5xzfBiHuknk
+# if [ $DESKTOP_SESSION = LXDE ]; then
+# pcmanfm -w "$(find $PATH_WALLPAPER -type f -iregex '.*\.\(bmp\|gif\|jpg\|png\)$' | shuf -n1)"
+# fi
+# }
+#
+#
+##}}}
+###########################################################
+##-------- Capture RTMP Streams (URL Sniffing) {{{
+##------------------------------------------------------
+## tutorial video: http://www.youtube.com/watch?v=u1dQ81HT4AU
+## https://github.com/gotbletu/shownotes/blob/master/rtmpdump_sniff_your_own_tutorial.txt
+## http://pclosmag.com/html/Issues/201104/page19.html
+sniff-begin() { sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner \! --uid-owner root -j REDIRECT ;}
+sniff-capture-rtmpsrv() { rtmpsrv ;}
+sniff-capture-rtmpsuck() { rtmpsuck ;}
+sniff-end() { sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -m owner \! --uid-owner root -j REDIRECT ;}
+tsniff-begin() { sudo tcpdump -ieth0 -nn -A | grep -e"rtmp" -e"connect" -e"play" > /tmp/tcpoutput.txt ;}
+tsniff-less() { less /tmp/tcpoutput.txt ;}
+##}}}
+###########################################################
+#
+###############################
+######## E. TESTING LIST ######
+###############################
+## New code dump, stuff I am creating or copy from others
+#
+#
+###########################################################
+##-------- Weechat XDCC {{{
+##------------------------------------------------------
+## http://nibl.co.uk/bots.php?search=
+#
+#xdcc-nibl() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "Download XDCC files from using weechat from (#nibl @ irc.rizon.net)"
+# echo -e "Search using http://nibl.co.uk/bots.php?search="
+# echo -e "\nUsage:\n$0 </msg>"
+# echo -e "\nexample:\n$0 '/msg AHQ[Turtle] xdcc send #1721'"
+#
+# return 1
+# fi
+#
+# echo "irc.rizon.#nibl *$1" > "$(ls ~/.weechat/weechat_fifo*)"
+#}
+#
+#
+#
+#
+## }}}
+###########################################################
+#-------- Empty Template {{{
+##------------------------------------------------------
+#
+## }}}
+###########################################################
+## https://www.reddit.com/r/archlinux/comments/42784v/what_are_your_bash_aliasesfunctions_for_ffmpeg/cz88h5f
+#ffmpeg-stereo () {
+# ffmpeg -i "$1" -i "$2" -filter_complex "[0:a][1:a]amerge=inputs=2[aout]" -map "[aout]" -c:a flac "$3"
+#}
+#
+## https://www.reddit.com/r/archlinux/comments/423wr9/is_anyone_having_trouble_with_reflector/
+## alias updatemirrors='sudo reflector --verbose --country 'United States' -l 200 -p http --sort rate --save /etc/pacman.d/mirrorlist'
+#
+## Shortcut to generate an updated Arch Linux mirrorlist - requires reflector
+#reflector-generate() {
+# reflector --country "United States" -l 200 -p http --sort rate --save "$1"
+#}
+#
+#mpd-kill() { kill -9 $(cat ~/.mpd/mpd.pid) ;}
+#mpd-restart() { kill -9 $(cat ~/.mpd/mpd.pid) && mpd ;}
+#
+###########################################################
+#-------- Battery Status {{{
+##------------------------------------------------------
+## https://www.reddit.com/r/debian/comments/41sw7g/checking_battery_status_in_terminal/cz68iwq
+#alias batterystatus="upower -i /org/freedesktop/UPower/devices/........ | grep time"
+#alias batteryshow='cat /sys/class/power_supply/BAT1/status'
+# }}}
+###########################################################
+##-------- Binary / Shell Scripts {{{
+##------------------------------------------------------
+#
+#
+## lightweight image viewer
+## tutorial video: https://www.youtube.com/watch?v=OMOIZlOEfb8
+## https://wiki.archlinux.org/index.php/Feh#File_Browser_Image_Launcher
+#feh-browser() { ~/.scripts/feh_browser.sh $@ -B white -g 1280x800 & }
+#feh-slideshow() { ~/.scripts/feh_browser.sh $@ -B white -g 1280x800 -D 3 & }
+#
+## http://code.google.com/p/imgur-cli
+## imgur image uploader http://imgur.com
+#imgur() { python2 ~/.scripts/imgur-cli/imgur.py $@ ;}
+#
+## manual tiling (similar compiz grid plugin)
+## tutorial video: https://www.youtube.com/watch?v=ZF76DELEpjM
+## http://ssokolow.com/quicktile
+#quicktile() { python2.7 ~/.config/quicktile/quicktile.py $@ ;}
+#quicktile-daemonize() { nohup python2.7 ~/.config/quicktile/quicktile.py -d >/dev/null 2>&1& }
+#quicktile-kill () { kill $(ps -ef | grep '[q]uicktile.py' | awk '{print $2}') ;}
+#
+## http://bash.cyberciti.biz/multimedia/linux-rip-audio-cd/
+#rip-audio-cd() { ~/.scripts/rip_audio_cd.sh ;}
+#
+## screenshot gallery generator
+## tutorial video: https://www.youtube.com/watch?v=_4G4nMUTzX8
+## http://cli-apps.org/content/show.php/Movie+Thumbnailer?content=74676
+#shot() { ~/.scripts/shot.sh -n 30 -r 80% -s $@ ;}
+#
+## take screenshot fullscreen, window, area selection using import command
+## http://en.gentoo-wiki.com/wiki/Screenshot
+#sshot() { ~/.scripts/screenshot.sh area ;}
+#
+## Vim as a pager ( similar to the less command )
+## tutorial video: https://www.youtube.com/watch?v=RefWl8I3nBg
+# # issue: gg hotkey does not jump to exact line
+# vlessold() { /usr/share/vim/vim73/macros/less.sh "$1" ;}
+#
+# # http://technotales.wordpress.com/2009/05/24/using-vim-as-a-pager/
+# # vim readonly; to force write use :w!
+# vless() { vim -R "$@" ;}
+#
+## https://bitbucket.org/antocuni/tty2gif
+## convert ttyrec to gif files
+#tty2gif() { python3 ~/.scripts/tty2gif/tty2gif.py $@ ;}
+#
+## https://github.com/saironiq/shellscripts/blob/master/wolframalpha_com/wa.sh
+## http://www.wolframalpha.com
+#wolframalpha() { ~/.scripts/shellscripts/wolframalpha_com/was.sh ;}
+#
+##}}}
+###########################################################
+##-------- Copy Move {{{
+##------------------------------------------------------
+#cpr() {
+# if [ $# -lt 1 ]; then
+# echo -e "rsync copying files using task spooler queue"
+# echo -e "\nUsage:\n$0 [-h help] [-t task-spooler] <source> <destination>"
+# echo -e "\nInclude Parent Folder:\n$0 <source> <destination>"
+# echo -e "\nExclude Parent Folder:\n$0 <source>/ <destination>"
+# echo -e "\nRequirements: rsync task-spooler"
+# return 1
+# else
+# case "$1" in
+# -t) tsp rsync -a "$@" ;;
+# -h) $0 ;;
+# -*) $0 ;;
+# *) rsync -av --progress "$@" ;;
+# esac
+# fi
+#}
+#mvr() {
+# if [ $# -lt 1 ]; then
+# echo -e "rsync moving files using task spooler queue"
+# echo -e "\nUsage:\n$0 [-h help] [-t task-spooler] <source> <destination>"
+# echo -e "\nInclude Parent Folder:\n$0 <source> <destination>"
+# echo -e "\nExclude Parent Folder:\n$0 <source>/ <destination>"
+# echo -e "\nRequirements: rsync task-spooler"
+# return 1
+# else
+# case "$1" in
+# -t) tsp rsync -a --remove-source-files "$@" ;;
+# -h) $0 ;;
+# -*) $0 ;;
+# *) rsync -av --progress --remove-source-files "$@" ;;
+# esac
+# fi
+#}
+## }}}
+###########################################################
+##-------- VirtualEnv (Python Isolated Environment) {{{
+##------------------------------------------------------
+#
+## tutorial video: https://www.youtube.com/watch?v=n8ZzqsFeHOI
+#virtwrap-create() {
+# mkdir -p ~/.virtualenv
+# cd ~/.virtualenv
+# virtualenv "$1" -p "${2:-python}"
+# source "$1"/bin/activate
+#}
+#virtwrap-activate() {
+# cd ~/.virtualenv
+# source "$1"/bin/activate
+#}
+#
+## }}}
+###########################################################
+##-------- Convert to Image {{{
+##------------------------------------------------------
+## pdftoppm convert pdf to images
+## http://askubuntu.com/a/50180
+#convert_pdf_to_png() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert PDF document to PNG image (default dpi is 150)"
+# echo -e "\nUsage:\n$0 <pdf> <dpi> <startingpage> <endingpage>"
+# echo -e "\nall pages to images:\n$0 file.pdf"
+# echo -e "\nchange dpi (common dpi are 150, 300, 600):\n$0 file.pdf 300"
+# echo -e "\nsingle page to image:\n$0 file.pdf 300 5"
+# echo -e "\nmultiple pages to images:\n$0 file.pdf 300 5 12"
+#
+# return 1
+# fi
+# pdftoppm -png "$1" "${1%.*}"-"${2:-150}"DPI -r "${2:-150}" -f "$3" -l "${4:-$3}"
+#}
+#
+#convert_pdf_to_jpg() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert PDF document to JPEG image (default dpi is 150)"
+# echo -e "\nUsage:\n$0 <pdf> <dpi> <startingpage> <endingpage>"
+# echo -e "\nall pages to images:\n$0 file.pdf"
+# echo -e "\nchange dpi (common dpi are 150, 300, 600):\n$0 file.pdf 300"
+# echo -e "\nsingle page to image:\n$0 file.pdf 300 5"
+# echo -e "\nmultiple pages to images:\n$0 file.pdf 300 5 12"
+#
+# return 1
+# fi
+# pdftoppm -jpeg "$1" "${1%.*}"-"${2:-150}"DPI -r "${2:-150}" -f "$3" -l "${4:-$3}"
+#}
+#
+#convert_pdf_to_tiff() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert PDF document to TIFF image (default dpi is 150)"
+# echo -e "\nUsage:\n$0 <pdf> <dpi> <startingpage> <endingpage>"
+# echo -e "\nall pages to images:\n$0 file.pdf"
+# echo -e "\nchange dpi (common dpi are 150, 300, 600):\n$0 file.pdf 300"
+# echo -e "\nsingle page to image:\n$0 file.pdf 300 5"
+# echo -e "\nmultiple pages to images:\n$0 file.pdf 300 5 12"
+#
+# return 1
+# fi
+# pdftoppm -tiff "$1" "${1%.*}"-"${2:-150}"DPI -r "${2:-150}" -f "$3" -l "${4:-$3}"
+#}
+#
+#convert_pdf_to_pgm-grayscale() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert PDF document to PGM Grayscale image (default dpi is 150)"
+# echo -e "\nUsage:\n$0 <pdf> <dpi> <startingpage> <endingpage>"
+# echo -e "\nall pages to images:\n$0 file.pdf"
+# echo -e "\nchange dpi (common dpi are 150, 300, 600):\n$0 file.pdf 300"
+# echo -e "\nsingle page to image:\n$0 file.pdf 300 5"
+# echo -e "\nmultiple pages to images:\n$0 file.pdf 300 5 12"
+#
+# return 1
+# fi
+# pdftoppm -gray "$1" "${1%.*}"-"${2:-150}"DPI -r "${2:-150}" -f "$3" -l "${4:-$3}"
+#}
+#
+#convert_pdf_to_pbm-monochrome() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert PDF document to PBM Monochrome image (default dpi is 150)"
+# echo -e "\nUsage:\n$0 <pdf> <dpi> <startingpage> <endingpage>"
+# echo -e "\nall pages to images:\n$0 file.pdf"
+# echo -e "\nchange dpi (common dpi are 150, 300, 600):\n$0 file.pdf 300"
+# echo -e "\nsingle page to image:\n$0 file.pdf 300 5"
+# echo -e "\nmultiple pages to images:\n$0 file.pdf 300 5 12"
+#
+# return 1
+# fi
+# pdftoppm -mono "$1" "${1%.*}"-"${2:-150}"DPI -r "${2:-150}" -f "$3" -l "${4:-$3}"
+#}
+#
+## }}}
+###########################################################
+##-------- Disk Image to ISO {{{
+##------------------------------------------------------
+#
+## https://github.com/helmuthdu/dotfiles/blob/master/.bashrc
+#convert2discimage_iso () {
+# if [[ $# == 0 || $1 == "--help" || $1 == "-h" ]]; then
+# echo -e "Converts raw|bin|cue|ccd|img|mdf|nrg disc image to ISO"
+# echo -e "Usage: $0 <disc_image>"
+# fi
+# for i in $*; do
+# if [[ ! -f "$i" ]]; then
+# echo "'$i' is not a valid file; jumping it"
+# else
+# echo -n "converting $i..."
+# # OUT=`echo $i | cut -d '.' -f 1`
+# case $i in
+# *.raw ) bchunk "$i" "${i%.*}.iso" ;; #raw=bin
+# *.bin|*.cue ) bchunk "${i%.*}.bin" "${i%.*}.cue" "${i%.*}.iso" ;; # bin,cue
+# *.ccd|*.img ) ccd2iso "${i%.*}.img" "${i%.*}.iso" ;; # Clone CD images
+# *.mdf ) mdf2iso "$i" "${i%.*}.iso" ;; # Alcohol images
+# *.nrg ) nrg2iso "$i" "${i%.*}.iso" ;; # Nero images
+# * ) echo "$0 don't know de extension of '$i'";;
+# esac
+# if [[ $? != 0 ]]; then
+# echo -e "${R}ERROR!${W}"
+# else
+# echo -e "${G}done!${W}"
+# fi
+# fi
+# done
+#}
+#
+## https://help.ubuntu.com/community/ManageDiscImages#CloneCD.2FIMG_Images
+#convert_to_iso() {
+# if [ -z "$1" ]; then
+# # display usage if no parameters given
+# echo "Usage: extract <path/file_name>.<bin|cue|img|nrg|mdf|mds>"
+# else
+# if [ -f "$1" ] ; then
+# NAME=${1%.*}
+# #mkdir $NAME && cd $NAME
+# case "$1" in
+# *.bin) bchunk "$1" "${1%.*}".cue "${1%.*}".iso ;; # bin/cue
+# *.cue) bchunk "${1%.*}".bin "$1" "${1%.*}".iso ;; # bin/cue
+# *.img) ccd2iso "$1" "${1%.*}".iso ;; # CloneCD/IMG
+# *.nrg) nrg2iso "$1" "${1%.*}".iso ;;
+# *.mdf) mdf2iso "$1" "${1%.*}".iso ;;
+# *.mds) mdf2iso "${1%.*}".mdf "${1%.*}".iso ;;
+# *) echo "$0: '$1' - unsupported format" ;;
+# esac
+# else
+# echo "'$1' - file does not exist"
+# fi
+#fi
+#}
+#
+## ex() -- Extract compressed files (tarballs, zip, etc)
+#ex() {
+# for file in "$@"; do
+# if [ -f "$file" ]; then
+# local file_type=$(file -bizL "$file")
+# case "$file_type" in
+# *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
+# bsdtar -x -f "$file" ;;
+# *application/x-gzip*)
+# gunzip -d -f "$file" ;;
+# *application/x-bzip*)
+# bunzip2 -f "$file" ;;
+# *application/x-rar*)
+# 7z x "$file" ;;
+# *application/octet-stream*)
+# local file_type=$(file -bzL "$file")
+# case "$file_type" in
+# 7-zip*) 7z x "$file" ;;
+# *) echo -e "Unknown filetype for '$file'\n$file_type" ;;
+# esac ;;
+# *)
+# echo -e "Unknown filetype for '$file'\n$file_type" ;;
+# esac
+# else
+# echo "'$file' is not a valid file"
+# fi
+# done
+#}
+#
+#
+## }}}
+###########################################################
+##-------- Convert to Documents {{{
+##------------------------------------------------------
+#convert_images_to_pdf() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert images into one single pdf"
+# echo -e "\nUsage:\n$0 <images>"
+# echo -e "\nexample:\n$0 image1.jpg image2.jpg image3.jpg"
+# echo -e "\n$0 *.jpg"
+# echo -e "\n$0 *.png"
+#
+# return 1
+# fi
+# convert "$@" "${1%.*}"-`date +'%F_%Hh%Ms%S'`.pdf
+#}
+#
+#
+## Using libreoffice
+#convert_to_html() { soffice --headless --convert-to "html:XHTML Writer File:UTF8" "$1" ;}
+#convert_to_txt() { soffice --headless --convert-to "txt:Text (encoded):UTF8" "$1" ;}
+#
+#
+## convert_to_pdfo() {
+## if [ -z "$1" ]; then
+## # display usage if no parameters given
+## echo "Usage: extract <path/file_name>.<bin|cue|img|nrg|mdf|mds>"
+## else
+## if [ ! -f "${1%.*}".pdf ] ; then
+## NAME=${1%.*}
+## case "$1" in
+## *.doc|*.docx) soffice --headless --convert-to pdf "$@" ;;
+## *.ppt|*.pptx) soffice --headless --convert-to pdf "$@" ;;
+## *.xls|*.xlsx) soffice --headless --convert-to pdf "$@" ;;
+## *.txt|*.rtf) soffice --headless --convert-to pdf "$@" ;;
+## *.html) soffice --headless --convert-to pdf "$@" ;;
+## *.epub) soffice --headless --convert-to pdf "$@" ;;
+## *.cbr|*.cbz|*.cb7|*.cbt|*.cba) ebook-convert "$1" .pdf ;;
+## *.jpg|*.jpeg) convert "$@" "${1%.*}"-`date +'%F_%Hh%Ms%S'`.pdf ;;
+## *.pbm|*.pgm) convert "$@" "${1%.*}"-`date +'%F_%Hh%Ms%S'`.pdf ;;
+## *.png) convert "$@" "${1%.*}"-`date +'%F_%Hh%Ms%S'`.pdf ;;
+## *) echo "'$1' - unsupported format or file does not exist" ;;
+## esac
+## else
+## echo "'${1%.*}.pdf' - file exist, skipping to prevent overwrite"
+## fi
+## fi
+## }
+#
+## http://duff-johnson.com/2014/02/17/the-8-most-popular-document-formats-on-the-web/
+#convert_to_pdf() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>.<doc|docx|ppt|pptx|xls|xlsx|txt|rtf|html|epub|cbr|cbz|cbt|cb7|cba|jpg|jpeg|pbm|pgm|png>"
+# echo -e "\nsingle: $0 file.doc"
+# echo -e "\nmultiple: $0 file1.jpg file2.jpg file3.jpg"
+# echo -e "\nwildcard: $0 *.png"
+# echo -e "\nRequirement: calibre imagemagick libreoffice"
+# return 1
+# else
+# if [ ! -f "${1%.*}".pdf ] ; then
+# NAME=${1%.*}
+# case "$1" in
+# *.doc|*.docx) soffice --headless --convert-to pdf "$@" ;;
+# *.ppt|*.pptx) soffice --headless --convert-to pdf "$@" ;;
+# *.xls|*.xlsx) soffice --headless --convert-to pdf "$@" ;;
+# *.txt|*.rtf) soffice --headless --convert-to pdf "$@" ;;
+# *.html) soffice --headless --convert-to pdf "$@" ;;
+# *.epub) soffice --headless --convert-to pdf "$@" ;;
+# *.cbr|*.cbz|*.cb7|*.cbt|*.cba) ebook-convert "$1" .pdf ;;
+# *.jpg|*.jpeg|*.pbm|*.pgm|*.png) convert "$@" "${1%.*}"-`date +'%F_%Hh%Ms%S'`.pdf ;;
+# *) echo "'$1' - unsupported format or file does not exist" ;;
+# esac
+# else
+# echo "'${1%.*}.pdf' - file exist, skipping to prevent overwrite"
+# fi
+# fi
+#}
+#
+## }}}
+###########################################################
+##-------- Convert to Android (Smartphone, Tablet) {{{
+##------------------------------------------------------
+## http://develop.participatoryculture.org/index.php/ConversionMatrix
+## https://trac.handbrake.fr/wiki/BuiltInPresets
+#
+#ANDROID_DEVICE=(-acodec aac -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -f mp4 -threads 0 -strict experimental)
+#convert2devices_android_720pnd() { ffmpeg -i "$1" -s 1280x720 ${ANDROID_DEVICE[*]} "${1%.*}".android720p.mp4 ;}
+#convert2devices_android_1080p() { ffmpeg -i "$1" -s 1920x1080 ${ANDROID_DEVICE[*]} "${1%.*}".android1080p.mp4 ;}
+#
+#convert2droid_kindlefire() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".kindlefire.mp4 ]
+# do
+# ffmpeg -i "$arg" -s 1024x600 -acodec aac -ab 96k -vcodec libx264 -preset slow -f mp4 -crf 22 -strict experimental "${arg%.*}".kindlefire.mp4
+# done
+# done
+#}
+#
+#convert2droid_androidtablet() {
+# if [ $# -lt 1 ]; then
+# echo -e "A preset for Midrange Andriud Tablet devices."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".androidtablet.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.androidtablet.mp4" --preset="Android Tablet"
+# done
+# done
+#}
+#
+#convert2droid_android() {
+# if [ $# -lt 1 ]; then
+# echo -e "A preset for Midrange android devices."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".android.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.android.mp4" --preset="Android"
+# done
+# done
+#}
+#convert2droid_high() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".high.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.high.mp4" --preset="High Profile"
+# done
+# done
+#}
+#
+#convert2droid_normal() {
+# if [ $# -lt 1 ]; then
+# echo -e "HandBrake's normal, default settings."
+# echo -e "\nUsage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.avi"
+# echo -e "\nmultiple: $0 file1.avi file2.avi file3.avi"
+# echo -e "\nwildcard: $0 *.avi"
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# while [ ! -f "${arg%.*}".normal.mp4 ]
+# do
+# HandBrakeCLI -i "$arg" -o "${arg%.*}.normal.mp4" --preset="Normal"
+# done
+# done
+#}
+#
+## }}}
+###########################################################
+##-------- Youtube to Audio (Vice Versa) {{{
+##------------------------------------------------------
+#
+## -f 171 = webm audio (vorbis)
+## -f 140 = m4a (aac)
+#yt2ogg() { youtube-dl -c --restrict-filenames --extract-audio --audio-format vorbis -o "%(title)s.%(ext)s" -f 171 "$@" ;}
+#yt2wav() { youtube-dl -c --restrict-filenames --extract-audio --audio-format wav -o "%(title)s.%(ext)s" -f 171 "$@" ;}
+yt2mp3() { youtube-dl -c --restrict-filenames --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" -f 140 "$@" ;}
+#yt2webmaudio() { youtube-dl -c --restrict-filenames -o "%(title)s.%(ext)s" -f 171 "$@" ;}
+#yt2m4a() { youtube-dl -c --restrict-filenames -o "%(title)s.%(ext)s" -f 140 "$@" ;}
+#
+## http://www.tecmint.com/ffmpeg-commands-for-video-audio-and-image-conversion-in-linux/
+#yt2banneraudio() {
+# if [ $# -lt 2 ]
+# then
+# echo -e "Use ffmpeg to create a banner audio (audio + image to video)"
+# echo -e "\nUsage:\n$0 <image file> <audio file>"
+# echo -e "\nExample:\n$0 cover.png file.mp3 \n"
+#
+# return 1
+# fi
+# ffmpeg -loop 1 -i "$1" -i "$2" -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest "${2%.*}".mp4
+#}
+#
+## }}}
+###########################################################
+##-------- Demuxing {{{
+##------------------------------------------------------
+#
+#demux_videotrack() { ffmpeg -i "$1" -an -codec:v copy "${1%.*}"."$0"."${1##*.}" ;}
+#demux_audiotrack() { ffmpeg -i "$1" -vn -codec:a copy "${1%.*}"."$0"."${1##*.}" ;}
+#
+## demux_subs
+## demux_fonts/attachments
+#
+## }}}
+###########################################################
+##-------- Extraction / Archive Related {{{
+##------------------------------------------------------
+##Compression (cd into dir, will compress every single folder)
+#alias tardir='for i in *; do if [ -d "$i" ]; then tar czf "$i".tar.gz "$i"; fi; done'
+#alias rardir='find * -maxdepth 0 -type d -exec rar a {}.rar {} \;'
+#alias zipdir='find * -maxdepth 0 -type d -exec zip -r {}.zip {} \;'
+# #Warning: removes dir after compression (below)
+#alias rarkill='find * -maxdepth 0 -type d -exec rar a -df {}.rar {} \;'
+##http://www.commandlinefu.com/commands/view/5198
+## $ ls | while read filename; do tar -czvf "$filename".tar.gz "$filename"; rm "$filename"; done
+## compress folder into cbr/cbz
+#cbrit() { rar a -r "${1%/}.cbr" "$1" ;}
+#cbzit() { zip -r "${1%/}.cbz" "$1" ;}
+#
+#atool-extract() { atool -x $@ ;}
+#atool-tsp() { tsp apack "${1%.*}.zip" "$@" ;}
+#atool-add() { apack "${1%.*}.zip" "$@" ;}
+#atool-append() { apack "$@" ;} # apack foo.zip my_additional_file.jpg
+#atool-list() { atool -l "$1" | less -N ;}
+#atool-delete() {
+# local zipfilename="$1"
+# local deletefile="$(atool -l "$zipfilename" | tail -n +4 | head -n -2 | cut -d':' -f2 | cut -d' ' -f4- | sed 's/\ /\\ /g' | sed -n "${2}p")"
+#
+# zip -d "$zipfilename" "$deletefile"
+#
+#
+# }
+#
+#atool-zip-delete() { zip -d "$@" \*.txt ;}
+#
+#
+#imguralbum_cbz() {
+# # usage: imguralbum [link] [filename]
+#
+# local IMGUR_SAVE_PATH=/tmp
+#
+# # make a temp folder
+# # mkdir -p "$IMGUR_SAVE_PATH"/"$2"
+#
+# #download album
+# imguralbum.py "$1" "$IMGUR_SAVE_PATH"/"$2"
+#
+# #create zip archive using .cbz extension for comics
+# zip -r "${2%/}.cbz" "$IMGUR_SAVE_PATH"/"$2"
+#
+# #delete temp folder
+# rm -rf "$IMGUR_SAVE_PATH"/"$2"
+#}
+#
+#
+#
+#
+#
+#
+#
+##}}}
+###########################################################
+##-------- Music Tagging CLI {{{
+##------------------------------------------------------
+#lltag-artist() { lltag --yes -a "$1" "$2" ;}
+#lltag-album() { lltag --yes -A "$1" "$2" ;}
+#lltag-date() { lltag --yes -d "$1" "$2" ;}
+#lltag-genre() { lltag --yes -g "$1" "$2" ;}
+#lltag-comment() { lltag --yes -c "$1" "$2" ;}
+#lltag-number() { lltag --yes -n "$1" "$2" ;}
+#lltag-show() { lltag -S "$1" ;}
+#lltag-rename() { lltag --yes --rename '%n - %t' "$1" ;}
+#
+#
+##Mp3 id3 tagger
+#
+#tag-encoding-v2.3() { eyeD3 --encoding=utf8 --to-v2.3 "$@" ;}
+#tag-encoding-v2.4() { eyeD3 --encoding=utf8 --to-v2.4 "$@" ;}
+#tag-show() { eyeD3 "$@" ;}
+#tag-artist() { eyeD3 -a "$1" "${@:2}" ;}
+#tag-album() { eyeD3 -A "$1" "${@:2}" ;}
+#tag-title() { eyeD3 -t "$1" "${@:2}" ;}
+#tag-number() { eyeD3 -n "$1" "${@:2}" ;}
+#tag-genre() { eyeD3 -G "$1" "${@:2}" ;}
+#tag-listgenre() { eyeD3 --plugin=genres ;}
+#tag-year() { eyeD3 -Y "$1" "${@:2}" ;}
+#tag-comment() { eyeD3 -c "$1" "${@:2}" ;}
+#tag-image-remove() { eyeD3 --remove-all-images "$@" ;} # remove embedded album art
+#tag-image-add() { eyeD3 --add-image "$1":FRONT_COVER "${@:2}" ;} # add album art
+#tag-image-extract() { eyeD3 --write-images=. "$@" ;} # extract album art to current dir
+#tag-renamebytags_num_title() { eyeD3 --rename '$track:num - $title' "$@" ;}
+#tag-renamebytags_artist_album_num_title() { eyeD3 --rename '$artist - $album - $track:num - $title' "$@" ;}
+#tag-renamebytags_artist_title() { eyeD3 --rename '$artist - $title' "$@" ;}
+#tag-full() {
+# tempfile=/tmp/eyed3tag.txt
+# echo "eyeD3 --artist --album --title --track --genre --release-year "$@"" > "$tempfile"; $EDITOR "$tempfile"; source "$tempfile" ;}
+#
+#
+#
+## }}}
+###########################################################
+##-------- Plowshare {{{
+##------------------------------------------------------
+## d/l cyberlocker files like rapidshare, mediafire ..etc
+## tutorial video: http://www.youtube.com/watch?v=5AzFdX-EyeI
+## http://code.google.com/p/plowshare/
+## PPA: https://launchpad.net/~plowsharepackagers
+#plowdown-depositfiles() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/depositfiles.txt ;}
+#plowdown-uploaded() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/uploaded.txt ;}
+#plowdown-netloadin() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/netloadin.txt ;}
+#plowdown-rapidgator() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/rapidgator.txt ;}
+#plowdown-rapidshare() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/rapidshare.txt ;}
+#plowdown-random() { plowdown -r 3 --max-rate 900K -m ~/.config/plowshare/random.txt ;}
+#
+##}}}
+###########################################################
+##-------- Sound Effects {{{
+##------------------------------------------------------
+## http://whatnotlinux.blogspot.com/2011/12/enterprise-ambiance.html
+#ambiance-whitenoise() { play -n -c1 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1 ;}
+#ambiance-whitenoisewider() { play -n -c2 synth whitenoise band -n 100 24 band -n 300 100 gain +20 ;}
+#ambiance-pinknoise() { play -c2 -n synth pinknoise band -n 280 80 band -n 60 25 gain +20 treble +40 500 bass -3 20 flanger 4 2 95 50 .3 sine 50 lin ;}
+#
+##}}}
+###########################################################
+## concat = joinning files in a series (like a train)
+## convert = change one format to another
+## slice = cut files into peices (video, sound, both)
+## mux = flatting files such as video and audio track in parallel
+## demux = extraction of video or sound tracks
+## split = split into peiceses (archive into peices like zip, rar)
+## combine = join files together again (usually for splited archive files like 001, zip ..etc)
+###########################################################
+##-------- Rip Disc to Files {{{
+##------------------------------------------------------
+#
+##http://www.reddit.com/r/commandline/comments/19ept5/open_discussion_cool_trick_thursday_what_are_your/c8neljz
+#convert_audiocd_to_mp3() { cdparanoia -B ; for f in *.wav ; do sox -S $f "${f%.wav}.mp3" ; rm $f ; done ;}
+#convert_audiocd_to_flac() { cdparanoia -B ; for f in *.wav ; do sox -S $f "${f%.wav}.flac" ; rm $f ; done ;}
+#convert_audiocd_to_ogg() { cdparanoia -B ; for f in *.wav ; do sox -S $f "${f%.wav}.ogg" ; rm $f ; done ;}
+#convert_audiocd_to_iso() { use dd or ddrescure or readom ;}
+#
+#
+## has CDDB tags?
+#ripit-mydefault() {
+# ripit -o ~/Downloads -p 0 -c 0 --nointeraction "$@"
+# # -p ; playlist (m3u file) 0=disable
+# # --nointeraction; use 1st CDDB it finds
+# # -c ; 0 - Lame (for mp3), 1 - Oggenc, 2 - Flac, 3 - Faac,
+# # 4 - mp4als, 5 - Musepack, 6 - Wavpack, 7 - ffmpeg
+# # $@ ; specfic tracks like 1-4,5,8
+#}
+#
+#rip_to_mp3() { mkdir -p ~/Downloads/audiocd ; ripit -o ~/Downloads/audiocd -p 0 -c 0 --nointeraction "$@" ;}
+#rip_to_ogg() { mkdir -p ~/Downloads/audiocd ; ripit -o ~/Downloads/audiocd -p 0 -c 1 --nointeraction "$@" ;}
+#rip_to_flac() { mkdir -p ~/Downloads/audiocd ; ripit -o ~/Downloads/audiocd -p 0 -c 2 --nointeraction "$@" ;}
+#rip_to_aac() { mkdir -p ~/Downloads/audiocd ; ripit -o ~/Downloads/audiocd -p 0 -c 3 --nointeraction "$@" ;}
+#
+## }}}
+###########################################################
+##-------- Hardcoded Subtitles to Videos {{{
+##------------------------------------------------------
+## https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
+## https://www.bunkus.org/videotools/mkvtoolnix/samples/
+## install ttf-ms-fonts
+## ffmpeg with --enable-libass
+#
+#convert_to_ass() { ffmpeg -i "$1" "${1%.*}".ass ;} # srt --> ass
+#convert_to_srt() { ffmpeg -i "$1" "${1%.*}".srt ;} # ass --> srt
+#
+## The first 2 are alpha
+## AABBGGRR = &HAABBGGRR
+#
+## usage: aliasname filename subtitles(srt/ass)
+## convert_to_hardsubs() { ffmpeg -y -i "$1" -vf subtitles="$2":force_style="'Fontsize=35;FontName=DejaVu Serif,PrimaryColour=&H5014F0FF'" -codec:v libx264 -preset medium -crf 22 -codec:a aac -qscale:a 6 -strict experimental "${1%.*}"-hardsubs.mp4 ;}
+#
+#convert_to_hardsubs() {
+#if [ $# -lt 2 ]
+#then
+# echo -e "Use ffmpeg to hardcode subtitles into one movietrack"
+# echo -e "\nUsage:\n$0 [file] [subtitle (srt/ass)] [fontsize (25)] [color code (yellow)] [fontname (dejavu sans mono)]"
+# echo -e "\nexample:\n$0 file.mp4 file.srt"
+# echo -e "$0 file.mp4 file.srt 30 5000FF14 Arial \n"
+# echo -e "kml color code: http://www.zonums.com/gmaps/kml_color/"
+#
+#
+# exit 1
+#fi
+#
+#ffmpeg -y -i "$1" -vf subtitles="$2":force_style="'Fontsize=${3:-25},PrimaryColour=&H${4:-5014F0FF},FontName=${5:-DejaVu Sans Mono}'" -codec:v libx264 -preset medium -crf 22 -codec:a aac -qscale:a 6 -strict experimental "${1%.*}"-hardsubs.mp4
+#}
+#
+## 1min video testing
+#convert_to_testing() { ffmpeg -y -i "$1" -ss 00:05:00 -t 00:01:00 -vf subtitles="$2":force_style="'Fontsize=35;FontName=DejaVu Serif,PrimaryColour=&H5014F0FF'" -codec:v libx264 -preset medium -crf 22 -codec:a aac -qscale:a 6 -strict experimental "${1%.*}"-testing.mp4 ;}
+#
+#
+## }}}
+###########################################################
+##-------- Concatenate Files {{{
+##------------------------------------------------------
+#
+## tutorial video: http://www.youtube.com/watch?v=eQoOk5Xbt3M
+#concat_pdf() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "concatenate multiple pdf files into one single pdf"
+# echo -e "\nUsage:\n$0 <pdfs>"
+# echo -e "\nexample:\n$0 file1.pdf file2.pdf file3.pdf"
+# echo -e "\n$0 *.pdf"
+#
+# return 1
+# fi
+# gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="${1%.*}"-`date +'%F_%Hh%Ms%S'`_concat.pdf -f "$@"
+#}
+#
+#concat_png() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "concatenate multiple images into one single png"
+# echo -e "\nUsage:\n$0 <images>"
+# echo -e "\nexample:\n$0 file1.jpg file2.png file3.jpeg"
+# echo -e "\n$0 *.jpg"
+# echo -e "\n$0 *.png"
+#
+# return 1
+# fi
+# convert -append "$@" concatoutput.png
+#}
+#concat_jpg() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "concatenate multiple images into one single jpg"
+# echo -e "\nUsage:\n$0 <images>"
+# echo -e "\nexample:\n$0 file1.jpg file2.png file3.jpeg"
+# echo -e "\n$0 *.jpg"
+# echo -e "\n$0 *.png"
+#
+# return 1
+# fi
+# convert -append "$@" concatoutput.jpg
+#}
+#
+#
+## tutorial video: https://www.youtube.com/watch?v=EAWGFJoZXAU
+#concat_avi() { avimerge -o "${1%.*}".concat.avi -i "$@" ;}
+#
+## concat_movie() {
+## appendfile=$(echo "$@" | sed 's: : --append :g')
+## avidemux2_cli --nogui --audio-codec copy --video-codec copy --output-format "${1##*.}" --load $(echo $appendfile) --save "${1%.*}"-appended."${1##*.}"
+## }
+##
+#concat_movie() {
+# avidemux2_cli --nogui --force-alt-h264 \
+# --audio-codec copy --video-codec copy --output-format "${1##*.}" \
+# --load "$1" --append "$2" --append "$3" --append "$4" \
+# --append "$5" --append "$6" --append "$7" --append "$8" \
+# --save "${1%.*}"-appended."${1##*.}"
+#}
+#
+#concat_mp4() {
+# avidemux2_cli --nogui --force-alt-h264 \
+# --audio-codec copy --video-codec copy --output-format "${1##*.}" \
+# --load "$1" --append "$2" --append "$3" --append "$4" \
+# --append "$5" --append "$6" --append "$7" --append "$8" \
+# --save "${1%.*}"-appended."${1##*.}"
+#}
+#
+#
+#
+#
+## }}}
+###########################################################
+##-------- Extract Files {{{
+##------------------------------------------------------
+#
+## http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf
+#extract_pdf() {
+# if [ $# -lt 2 ]
+# then
+# echo -e "convert images into one single pdf"
+# echo -e "\nUsage:\n$0 <input file> <startingpage> <endingpage>"
+# echo -e "\nexample:\n$0 file.pdf 6"
+# echo -e "\n$0 file.pdf 13 26"
+#
+# return 1
+# fi
+#
+# gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage="${2}" -dLastPage="${3:-$2}" -sOutputFile="${1%.pdf}"_p"${2}"-p"${3:-$2}".pdf "${1}"
+#}
+#
+## }}}
+###########################################################
+##-------- Muxing {{{
+##------------------------------------------------------
+#mux_to_mkv() {
+# # mkvmerge -o newfile.mkv part1.mkv +part2.mkv
+# # appendfile=$echo ${@} | sed 's: : +:g')
+# appendfile=$(echo "$@" | sed 's: : +:g')
+# # appendfile=$(echo "$@" | sed 's/ /\ +/g')
+#
+# mkvmerge -o "${1%.*}".mux.mkv $(echo $appendfile)
+# echo $appendfile
+#
+# }
+#
+## }}}
+###########################################################
+##-------- Web Search Prefix {{{
+##------------------------------------------------------
+## Custom seaches
+#gg-comic() { sitelist=$(echo "avaxhome.ws h33t.com mycomicpost.com bdcomics.bdgamers.net" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-cyberlocker() { sitelist=$(echo "hotfile.com rapidshare.com mediafire.com
+# uploading.com depositfiles.com zshare.net filepost.com filefactory.com
+# 2shared.com zippyshare.com slingfile.com wuala.com filetram.com
+# 4shared.com rabidfiles.com" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-dojin() { sitelist=$(echo "hentairules.net fakku.net hentaifromhell.net" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-icons() { sitelist=$(echo "iconseeker.com iconarchive.com iconfinder.com
+# deviantart.com veryicon.com iconspedia.com" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-keygen() { sitelist=$(echo "crack.ms/cracks/crack.ms?id" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-music() { url=$(echo "https://encrypted.google.com/search?hl=en&q=
+# intitle:index.of+mp3+"$@"+-html+-htm+-txt"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-packages() { sitelist=$(echo "sourceforge.net github.com archlinux.org/packages
+# freecode.com/projects gnome.org/extension python.org/pypi gentoo.org/package" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-pastebin() { sitelist=$(echo "pastebin.com paste2.org pastie.org snipt.net
+# heypasteit.com/clip pastee.org shell-fu.org commandlinefu.com catonmat.net
+# linuxconfig.net github.com bitbucket.org slexy.org stackoverflow.com
+# askubuntu.com superuser.com dotfiles.org dotshare.it gitorious.org
+# serverfault.com wikia.com stackexchange.com" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-piratebay() { url=$(echo "http://thepiratebay.org/search/$@" \
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-porn() { sitelist=$(echo "youporn.com redtube.com xvideos.com xhamster.com
+# tube8.com grayvee.com pornhub.com/view_video.php?viewkey tnaflix.com
+# youjizz.com hardsextube.com/video drtuber.com/video pornoxo.com limesteam.com
+# motherless.com xnxx.com cliphunter.com extremetube.com/video" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-reader() { url=$(echo "https://encrypted.google.com/reader/view/#search/$@" \
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-search() { url=$(echo "https://encrypted.google.com/search?hl=en&q=$@" \
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-serial() { sitelist=$(echo "freeserials.com/serials/download.php?id= serials.ws/d.php?n" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-torrent() { sitelist=$(echo "eztv.it thepiratebay.se torrentzap.com fenopy.com
+# torrindex.com h33t.com tokyotosho.info nyaa.eu" \
+# | sed 's/ /\+OR\+site\:/g')
+# url=$(echo "https://encrypted.google.com/search?hl=en&q=$@+site:$sitelist"\
+# | sed 's/ /+/g'); $BROWSER $url; }
+#gg-translate() {
+# $BROWSER http://translate.google.com/#auto/en/"$*" ;}
+#
+##}}}
+###########################################################
+##-------- Search for Files {{{
+##------------------------------------------------------
+## http://askubuntu.com/questions/460535/how-do-i-tell-locate-to-keep-the-index-of-an-external-hdd
+#updatedb-external() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "create private updatedb"
+# echo -e "\nUsage:\n$0 <filename.db> <path>"
+# echo -e "\nexample:\n$0 bingbong /media/bingbong"
+# return 1
+# fi
+# mkdir -p ~/.updatedb
+# updatedb -l 0 -o ~/.updatedb/"$1.db" -U "$2"
+#}
+#
+#@locate-external() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "locate using private updatedb"
+# echo -e "\nUsage:\n$0 <keywords>"
+# echo -e "\nexample:\n$0 dragon ball z"
+# echo -e "\nending extension:\n$0 naruto mkv$"
+# echo -e "\nOR operator:\n$0 '(naruto|blech)'"
+# echo -e "$0 '(naruto|bleach) (mkv|mp4)'"
+# echo -e "\nupdate database:\nsudo updatedb"
+# echo -e "\nquit vim:\nShift+ZZ or Shift+ZQ"
+# return 1
+# fi
+# keyword=$(echo "$@" | sed -e 's/ /.*/g' -e 's:|:\\|:g' -e 's:(:\\(:g' -e 's:):\\):g')
+# locate -d ~/.updatedb/bingbong.db -ir "$keyword" | vim -R -
+#}
+#
+#@find() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "find files recursively in current folder"
+# echo -e "\nUsage:\n$0 <keywords>"
+# echo -e "\nexample:\n$0 dragon ball z"
+# echo -e "\nquit vim:\nShift+ZZ or Shift+ZQ"
+# return 1
+# fi
+# keyword=$(echo "*$@*" | sed -e 's/ /*/g')
+# find . -type f -iname $keyword | vim -R -
+#}
+#
+## find starting at current dir and go recursively to sub dir
+## @search() {
+## if [ $# -lt 1 ]
+## then
+## echo -e "search for files "
+## echo -e "\nUsage:\n$0 <keywords>"
+## echo -e "\nexample:\n$0 dragon ball z"
+## echo -e "\nending extension:\n$0 naruto mkv$"
+## echo -e "\nOR operator:\n$0 '(naruto|blech)'"
+## echo -e "$0 '(naruto|bleach) (mkv|mp4)'"
+## echo -e "\nupdate database:\nsudo updatedb"
+## echo -e "\nquit vim:\nShift+ZZ or Shift+ZQ"
+## return 1
+## fi
+## keyword=$(echo "*$@*" | sed -e 's/ /*/g')
+## find -type f -iname $keyword | vim -R -
+## }
+#
+## find current dir files bigger than X size
+## useage: @size <filesize> <keyword>
+#@size() {
+# keyword=$(echo "*${@:2}*" | sed -e 's/ /*/g')
+# find -type f -size +${1}M -iname $keyword | vim -R - ;}
+#
+## search pdf files in current dir for keywords inside the pdfs
+## http://www.commandlinefu.com/commands/view/9189
+#@pdfgrep() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "search all pdf in current directory recursively for keyword inside the pdfs"
+# echo -e "\nUsage:\n$0 <keyword>"
+# echo -e "\nexample:\n$0 homework"
+# echo -e "\n$0 'school transcript'"
+#
+# return 1
+# fi
+# find -iname \*.pdf -print0 | xargs -0 pdfgrep -in "$@"
+#}
+#
+#@locate() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "search for files using updatedb"
+# echo -e "\nUsage:\n$0 <keywords>"
+# echo -e "\nexample:\n$0 dragon ball z"
+# echo -e "\nending extension:\n$0 naruto mkv$"
+# echo -e "\nOR operator:\n$0 '(naruto|blech)'"
+# echo -e "$0 '(naruto|bleach) (mkv|mp4)'"
+# echo -e "\nupdate database:\nsudo updatedb"
+# echo -e "\nquit vim:\nShift+ZZ or Shift+ZQ"
+# return 1
+# fi
+# # escape spaces, pipe and parentheses
+# keyword=$(echo "$@" | sed -e 's/ /.*/g' -e 's:|:\\|:g' -e 's:(:\\(:g' -e 's:):\\):g')
+# locate -ir "$keyword" | vim -R -
+#}
+#
+##}}}
+###########################################################
+##-------- IPTV {{{
+##------------------------------------------------------
+## http://database.freetuxtv.net/WebStream/
+## http://www.thestreamdb.com/
+## http://pclosmag.com/html/Issues/201104/page19.html
+#
+#IPTVPLAYER=mplayer
+#itv-tech-twit() { "$IPTVPLAYER" "http://bglive-a.bitgravity.com/twit/live/high" ;}
+##}}}
+###########################################################
+##-------- Internet Videos - Castalba.tv {{{
+##------------------------------------------------------
+## http://castalba.tv/channels
+## Animation, Documentary, Entertainment, Sports, News
+#
+## sample of fail capture links
+##rtmpdump -r "rtmp://live.castalba.tv/calive" -a "calive" -f "LNX 11,2,202,243" -W "http://static.castalba.tv/player.swf" -p "http://castalba.tv/channel/6768" -y "174956" -o 174956.flv
+#
+#CTVPLAYER=mplayer
+#ctv-news-aljazeera() { rtmpdump -v -r "rtmp://aljazeeraflashlivefs.fplive.net/aljazeeraflashlive-live" \
+# -a "aljazeeraflashlive-live" \
+# -f "LNX 11,2,202,261" \
+# -W "http://static.castalba.tv/player.swf" \
+# -p "http://castalba.tv/channel/4182" \
+# -y "aljazeera_eng_low" | "$CTVPLAYER" - ;}
+#
+##}}}
+###########################################################
+##-------- GNOME 2 configs {{{
+##------------------------------------------------------
+#
+## function h-framebuffer() {
+## echo -e '
+## mplayer -vo fbdev -fs -vf scale=1280:-3 FileName
+## mplayer -vo fbdev -fs -vf scale=-3:1024 FileName
+##
+## on Arch linux use fbdev2
+## mplayer -vo fbdev2
+##
+## vlc video_file
+## vlc --vout fb video_file
+## '}
+## function h-gconf-tweaks() {
+## echo -e "
+## #Wallpaper Changer
+## bash -c 'gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$(find ~/Pictures/Wallpapers -type f | shuf -n1)"'
+##
+## compiz --replace
+## metacity --replace
+## emerald --replace
+## xkill
+## gnome-system-monitor
+## gnome-search-tool --hidden
+##
+## #Dont Dim When Asking for Password
+## gconftool-2 --type boolean --set /apps/gksu/disable-grab "True"
+## gconftool-2 --set "/apps/metacity/general/button_layout" --type string ":close"
+##
+## #Button Placement
+## gconftool-2 --set "/apps/metacity/general/button_layout" --type string ":minimize,maximize,close"
+## gconftool-2 --set "/apps/metacity/general/button_layout" --type string ":close"
+##
+## #Middle Click Minimize
+## gconftool-2 --set "/apps/metacity/general/action_middle_click_titlebar" --type string "minimize"
+##
+## #Hide Desktop Icon Drives
+## gconftool-2 --set "/apps/nautilus/desktop/volumes_visible" --type boolean "false"
+##
+## #Disable Lock on Idle
+## gconftool-2 --set "/apps/gnome-power-manager/lock/gnome_keyring_hibernate" --type boolean "false"
+## gconftool-2 --set "/apps/gnome-power-manager/lock/hibernate" --type boolean "false"
+## gconftool-2 --set "/apps/gnome-power-manager/lock/suspend" --type boolean "false"
+##
+## #Enable Metacity Compositing
+## gconftool-2 --set '/apps/metacity/general/compositing_manager' --type boolean "true"
+##
+## #Disable Screensaver
+## gconftool-2 --set '/apps/gnome-screensaver/idle_activation_enabled' --type boolean "false"
+## gconftool-2 --set '/apps/gnome-screensaver/lock_enabled' --type boolean "false"
+##
+## #Clock Format
+## gconftool-2 --set '/apps/panel/applets/clock_screen0/prefs/format' --type string "custom"
+## gconftool-2 --set '/apps/panel/applets/clock_screen0/prefs/custom_format' --type string "%a %b/%d/%y, %I:%M %p"
+##
+## #AWN Auto Hide
+## Set awn setting behavior: Custom | Autohide mode: Fade Out | Icon Effects: Simple
+## gconftool-2 --set '/apps/instances/avant-window-navigator/panel-1/panel/intellihide_mode' --type string "0"
+##
+## #AWN OLD WAY TO AUTO HIDE
+## gconftool-2 --set '/apps/awn-applet-taskmanager/intellihide' --type boolean "false"
+##
+## # Default Open App, LINK CLICK
+## gconftool-2 -t string -s /desktop/gnome/url-handlers/magnet/command "/usr/bin/transmission-gtk %s"
+## gconftool-2 -s /desktop/gnome/url-handlers/magnet/needs_terminal false -t bool
+## gconftool-2 -t bool -s /desktop/gnome/url-handlers/magnet/enabled true
+##
+##
+## "}
+#
+#
+## }}}
+###########################################################
+##-------- Clean Stuff {{{
+##------------------------------------------------------
+#
+## http://www.commandlinefu.com/commands/view/954
+#symlinks() { find . -type l ! -exec test -e {} \; -print ;}
+#symlinks-delete() { find . -type l ! -exec test -e {} \; -print0 | xargs -0 rm ;}
+#rm-except() {
+# find . -type f -not -name '*copy*' | xargs rm
+#}
+## --// Cleanup //--
+#cleanup () {
+# echo -e '\e[1;31m * Cleaning Thumbnails * \e[1;37m'
+# rm -rfv ~/.thumbnails/*
+# rm -rfv ~/.cache/thumbnails/*
+# echo -e '\e[1;31m * Removing cache * \e[1;37m'
+# rm -rfv ~/.cache/chromium/*
+# rm -rfv ~/.cache/vlc/*
+# echo -e '\e[1;31m * Cleaning Trash * \e[1;37m'
+# gvfs-trash --empty
+#}
+#d-swiggle() { find . -type f -name '*~' -exec rm -v {} \; ;}
+#d-url() { find . -type f -iname '*.url' -exec rm -v {} \; ;}
+#d-thumbsdb() { find . -type f -iname 'Thumbs.db' -exec rm -v {} \; ;}
+#swiggle() { find . -name *~ -delete ;}
+#cleanlinks() {
+# # not in the repos: inspired by http://www.xfree86.org/4.8.0/cleanlinks.1.html
+# # delete empty folder
+# find . -type d -empty -print0 | xargs -0 rmdir
+# # delete broken symlinks
+# find . -type l -xtype l | xargs -l rm
+#}
+## }}}
+###########################################################
+##-------- Logitech K810 Keyboard {{{
+##------------------------------------------------------
+#
+#k810-battery() { echo Logitech K810 Battery: $(cat /sys/class/power_supply/hid-00:1f:20:a8:08:47-battery/capacity) ;}
+#k810-resync() { echo -e 'connect 00:1F:20:A8:08:47 \nexit' | bluetoothctl ;}
+## }}}
+###########################################################
+##-------- TMSU (File Tagging CLI) {{{
+##------------------------------------------------------
+#
+#tmsu-add() { tmsu tag --tags "$@" ;}
+#tmsu-list() { tmsu tags ;}
+#tmsu-repair() { tmsu repair "$@" ;}
+#tmsu-search() { tmsu files "$@" ;}
+#fzf-tmsu() {
+# nohup xdg-open "$(tmsu files "$@" | fzf -e -i )" >/dev/null 2>&1&
+#
+# # if cancle or fail then exit
+# if [ $? -ne 0 ]
+# then
+# exit
+# fi
+#}
+## }}}
+###########################################################
+##-------- Remote Desktop {{{
+##------------------------------------------------------
+#
+#rdp-winxp() { rdesktop -u administrator -g 1920x1020 192.168.1.150:3389 -r sound:local ;}
+#rdp-win7() { rdesktop -u bonster -g 1920x1020 192.168.1.152:3389 -r sound:local ;}
+#
+## }}}
+###########################################################
+##-------- Surfraw Bookmarks {{{
+##------------------------------------------------------
+## surfraw completions testing
+## https://blogs.oracle.com/AlejandroVargas/entry/awk_examples
+## removes empty line, removes comments, prints 1st word, sort abc ordered
+##
+#showbookmarks() { awk 'NF != 0 && !/#/ {print $1}' ~/.config/surfraw/bookmarks | sort -n ;}
+#
+##}}}
+###########################################################
+##-------- WINE Gaming {{{
+##------------------------------------------------------
+## get newest version
+#syu-winetrickz() { cd ~/Programs/appz/winetricks; rm -f winetricks; \
+# wget http://www.kegel.com/wine/winetricks; chmod +x winetricks ;}
+#
+## http://wiki.winehq.org/winetricks
+## change wineprefix location so winetricks can be use on it
+#set-wineprefix() {
+# WINEPREFIX="$PWD"
+# echo "ex: /home/username/.PlayOnLinux/wineprefix/Office2007"
+# echo "wineprefix is now set to: $WINEPREFIX"
+#}
+#
+#
+##}}}
+###########################################################
+##-------- DPKG {{{
+##------------------------------------------------------
+#
+#alias pydeb='sudo python setup.py --command-packages=stdeb.command debianize'
+#alias dp-installed='dpkg --get-selections | grep $1'
+#alias dp-deb-show='dpkg --info' #to examine archive files
+#alias dp-deb-content='dpkg --contents' #to list their contents.
+#whichpkg() { dpkg -S $( which $1 ); } #lookup for what package uses this command
+#cmdpkg() { PACKAGE=$(dpkg -S $(which $1) | cut -d':' -f1); echo "[${PACKAGE}]"; dpkg -s "${PACKAGE}" ;}
+#
+#
+#alias dp-history-install='cat /var/log/dpkg.log | grep "install "'
+#alias dp-history-upgrade='cat /var/log/dpkg.log | grep upgrade'
+#alias dp-history-remove='cat /var/log/dpkg.log | grep remove'
+#dp-history-rollback() { cat /var/log/dpkg.log | grep upgrade | grep "$2" -A10000000 | grep "$3" -B10000000 |awk '{print $4"="$5}';}
+#
+#
+#dp-hold()
+#{
+#echo -n "Please enter the package you wish to put a hold on:
+#"
+#read progID
+#echo "$progID hold" |sudo dpkg --set-selections
+#}
+#
+#dp-unhold()
+#{
+#echo -n "Please enter the package you wish to remove the hold on:
+#"
+#read progID
+#echo "$progID install" |sudo dpkg --set-selections
+#}
+#
+#
+#killkernel() { #Removes all unused kernel, except the newest one
+# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r \
+# | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' \
+# | xargs sudo apt-get -y purge ;}
+#
+## }}}
+###########################################################
+##-------- Renaming Case {{{
+##------------------------------------------------------
+#
+#alias renameit="ls | rename -v 's/ /_/g'" #change files with spaces to underscore
+#single-to-doubles() {
+## for bash shell only
+# for i in ?.jpg; do mv $i 0$i; done
+# for i in ?.png; do mv $i 0$i; done
+# for i in ?.PNG; do mv $i 0$i; done
+#}
+#doubles-to-triples() {
+# for i in ??.jpg; do mv $i 0$i; done
+# for i in ??.png; do mv $i 0$i; done
+#}
+#string-lowercase() { echo "$@" | tr '[:upper:]' '[:lower:]' ;} # converts string to lowercase
+#
+## http://stackoverflow.com/a/3211670
+#nametodigit() {
+# local a=1
+# for i in `ls -v | grep -i "$1"`; do
+# new=$(printf "%04d.$1" "$a") #04 pad to length of 4
+# mv -- "${i}" "${new}"
+# let a=a+1
+# done
+#}
+#
+#paddy() {
+#for file in foo[0-9]*.png; do
+# # strip the prefix ("foo") off the file name
+# postfile=${file#foo}
+# # strip the postfix (".png") off the file name
+# number=${postfile%.png}
+# # subtract 1 from the resulting number
+# i=$((number-1))
+# # copy to a new name in a new folder
+# cp ${file} ../newframes/$(printf foo%08d.png $i)
+#done
+#}
+#
+#
+#
+## http://www.walkingrandomly.com/?p=2850
+## adds leading zeros to digits in filenames
+#
+#padme() {
+# num=`expr match "$1" '[^0-9]*\([0-9]\+\).*'`
+# paddednum=`printf "%03d" $num`
+# echo ${1/$num/$paddednum}
+#}
+#
+## http://www.walkingrandomly.com/?p=2850
+#zeropadding() {
+# num=`expr match "$1" '[^0-9]*\([0-9]\+\).*'`
+# paddednum=`printf "%03d" $num`
+# echo ${1/$num/$paddednum}
+#}
+#
+#
+#
+#zeropad() { for i in "$@" ;do mv $i `padme $i`; done ;}
+## http://www.youtube.com/watch?v=rE7ISiKoNec
+##lower case bash/zsh
+## lowercase() {
+## # [bash] https://www.garron.me/en/bits/rename-files-from-uppercase-to-lowercase.html
+## for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; done
+## # [zsh] https://lorenzod8n.wordpress.com/category/zsh/
+## for file in *; do mv $file ${file:l}; done
+## ;}
+#
+## http://stackoverflow.com/a/11824856
+#lowercase-extension() { find . -name '*.*' -exec sh -c ' a=$(echo "$0" | sed -r "s/([^.]*)\$/\L\1/"); [ "$a" != "$0" ] && mv "$0" "$a" ' {} \; ;}
+## }}}
+###########################################################
+##-------- Keyboard related {{{
+##------------------------------------------------------
+#
+#touchpad-toggle() { synclient TouchpadOff=$(synclient -l | grep -c ‘TouchpadOff.*=.*0’) ;}
+#lang-toggle() { setxkbmap -option grp:alt_caps_toggle "us,jp" ;}
+#vim-toggle() {
+## https://xpressrazor.wordpress.com/2014/03/30/script-to-toggle-keys
+## toggle caplock and esc key
+#if xmodmap -pke | egrep -i "escape" | egrep -i "keycode.*9.*"; then
+# echo "Changing from original to mapped"
+# xmodmap -e "clear lock"
+# xmodmap -e "keycode 66 = Escape"
+# xmodmap -e "keycode 9 = Caps_Lock"
+# xmodmap -e "add Lock = Caps_Lock"
+#else
+# echo "Changing back from mapped to original"
+# xmodmap -e "clear lock"
+# xmodmap -e "keycode 9 = Escape"
+# xmodmap -e "keycode 66 = Caps_Lock"
+# xmodmap -e "add Lock = Caps_Lock"
+#fi
+#}
+## }}}
+###########################################################
+##-------- Function Informations {{{
+##------------------------------------------------------
+#
+#function osr { shutdown -r now; }
+#function osh { shutdown -h now; }
+#
+#function mfloppy { mount /dev/fd0 /mnt/floppy; }
+#function umfloppy { umount /mnt/floppy; }
+#
+#function mdvd { mount -t iso9660 -o ro /dev/dvd /mnt/dvd; }
+#function umdvd { umount /mnt/dvd; }
+#
+#function mcdrom { mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom; }
+#function umcdrom { umount /mnt/cdrom; }
+#
+#
+#function dub { du -sclb $@; }
+#function duk { du -sclk $@; }
+#function dum { du -sclm $@; }
+#
+#function dfk { df -PTak $@; }
+#function dfm { df -PTam $@; }
+#function dfh { df -PTah $@; }
+#function dfi { df -PTai $@; }
+## }}}
+###########################################################
+##-------- OCR {{{
+##------------------------------------------------------
+#
+#ocr2clipboard() {
+# # folder to dump it to
+# DIR=/tmp
+#
+# # scale up the image resolution for better ocr-ing
+# convert "$1" -resize 5000 "$DIR"/image_out.png
+# # ocr the scaled image
+# tesseract "$DIR"/image_out.png "$DIR"/result
+# # copy to the clipboard
+# xclip -selection clipboard -i "$DIR"/result.txt
+#}
+## }}}
+###########################################################
+##-------- Midi Music {{{
+##------------------------------------------------------
+#
+#midplayer() { adlmidi "$1" > /dev/null 2>&1 ;}
+## https://wiki.archlinux.org/index.php/FluidSynth#Standalone_mode
+#midi-fluidsynth() { fluidsynth -a alsa -m alsa_seq -l -i /usr/share/soundfonts/fluidr3/FluidR3GM.SF2 "$1" ;}
+## }}}
+###########################################################
+##-------- SSD TRIM {{{
+##------------------------------------------------------
+#
+## http://www.webupd8.org/2013/01/enable-trim-on-ssd-solid-state-drives.html
+#trim-check() {
+## sudo hdparm -I /dev/sda | grep "TRIM supported"
+# sudo hdparm -I /dev/"$1" | awk '/.*TRIM supported.*/{ if ($1 == "*") print "Yes, TRIM is enabled"; else print "No, TRIM is not enabled." ;}'
+#}
+#trim-fstrim() { sudo fstrim -v "$1" ;}
+#gen-cron-trim() { sudo cp ~/.scripts/trim /etc/cron.daily/ ;}
+## }}}
+###########################################################
+##-------- OLD CFG {{{
+##------------------------------------------------------
+#
+#cfg-ghsync() { $EDITOR ~/.scripts/ghsync-script.sh ;}
+#cfg-dircolors() { $EDITOR ~/.dircolors ;}
+#cfg-percol() { $EDITOR ~/.percol.d/rc.py ;}
+#cfg-sourcelist() { sudo $EDITOR /etc/apt/sources.list ;}
+#cfg-pacman() { sudo $EDITOR /etc/pacman.conf ;}
+#cfg-pacman-mirrorlist() { sudo $EDITOR /etc/pacman.d/mirrorlist ;}
+## http://blog.dotsmart.net/2011/09/30/change-font-size-in-chrome-devtools/
+#cfg-chromium-devtoolsize() { $EDITOR ~/.config/chromium/Default/User\ StyleSheets/Custom.css ;}
+#cfg-chromium-noscript() { $EDITOR ~/.config/chromium/Default/Extensions/odjhifogjcknibkahlpidmdajjpkkcfn/*/CHANGE__PASSWORD__HERE.js ;}
+#cfg-timidity() { sudo $EDITOR /etc/timidity++/timidity.cfg ;}
+#cfg-xdg-mine() { $EDITOR ~/.local/share/applications/mimeapps.list ;}
+#rld-screenlayout() { ~/.screenlayout/reload_monitor.sh ;}
+#
+## }}}
+###########################################################
+##-------- IMGUR {{{
+##------------------------------------------------------
+#
+## imgur album downloader
+## https://github.com/alexgisby/imgur-album-downloader
+## tutorial video: https://www.youtube.com/watch?v=dW4co9f5Ors
+#imguralbum() { python ~/.scripts/imgur-album-downloader/imguralbum.py "$@" ;}
+#
+#imguralbum_cbz() {
+# # usage: imguralbum [link] [filename]
+#
+# local IMGUR_SAVE_PATH=/tmp
+#
+# # make a temp folder
+# # mkdir -p "$IMGUR_SAVE_PATH"/"$2"
+#
+# #download album
+# python ~/.scripts/imgur-album-downloader/imguralbum.py "$1" "$IMGUR_SAVE_PATH"/"$2"
+#
+# #create zip archive using .cbz extension for comics
+# zip -r "${2%/}.cbz" "$IMGUR_SAVE_PATH"/"$2"
+#
+# #delete temp folder
+# rm -rf "$IMGUR_SAVE_PATH"/"$2"
+#}
+## }}}
+###########################################################
+#
+#quicksynergy-daemon() { /usr/bin/synergys --daemon --config ~/.quicksynergy/synergy.conf ;}
+## mutt background fix
+#COLORFGBG="default;default"
+#
+#jdownloader() { nohup java -jar ~/.scripts/JDownloader/JDownloader.jar >/dev/null 2>&1& }
+#
+#
+#date-global() {
+## use tzselect to find timezone listing
+# local SHOWTIMEZONE="$(
+# alias date='date +"%a %D %l:%M %p"'
+# echo "Current Location:" "$(date)"
+# echo "USA LosAngeles:" "$(TZ='America/Los_Angeles' date)"
+# echo "Canada Alberta:" "$(TZ='America/Edmonton' date)"
+# echo "USA NewYork:" "$(TZ='America/New_York' date)"
+# echo "EU London:" "$(TZ='Europe/London' date)"
+# echo "Bangladesh Dhaka:" "$(TZ='Asia/Dhaka' date)"
+# echo "China Xinjiang:" "$(TZ='Asia/Urumqi' date)"
+# echo "Vietnam Saigon:" "$(TZ='Asia/Ho_Chi_Minh' date)"
+# echo "China Beijing:" "$(TZ='Asia/Shanghai' date)"
+# echo "HK HongKong:" "$(TZ='Asia/Hong_Kong' date)"
+# echo "Japan Tokyo:" "$(TZ='Asia/Tokyo' date)"
+# )"
+# echo "$SHOWTIMEZONE" | column -t
+#}
+#
+## http://stackoverflow.com/a/13541721
+#git-sync-ignorelist() { git rm --cached `git ls-files -i --exclude-from=.gitignore` ;}
+#
+#mp3cut() {
+#
+# # example: cut from 5s to 10s; mpgtx -s file.mp3 "[00:05-00:10]" -b file-output
+# mpgtx -s "$1" "["$2":"$3"-"$4":"$5"]" -b "${1%.*}"-output."${1##*.}"
+#
+# }
+#
+#mpv-saveposition() { mpv --save-position-on-quit "$@" ;}
+#mplayer-createplaylist() { ls --ignore="*.m3u" --ignore="*.pos" | grep -i "$1" | sort -u > "$1".m3u ;}
+#
+#
+#
+##List files only, the advantage is that it works just like normal 'ls' so you could do 'lf -al | grep blah' etc.
+#lf () {
+#ls -1p $@ | grep -v '\/$'
+#}
+#
+#
+#qrdecode() { zbarimg -S\*.disable -Sqrcode.enable "$1" -q | sed '1s/^[^:]\+://'; }
+#
+##checkexist() {
+##if which lynx >/dev/null; then
+## echo exists
+##else
+## echo does not exist
+##fi
+##}
+#
+#pvcp() {
+# # a better cp with pv; http://jrenard.info/blog/a-better-cp-with-pv.html
+# SOURCE=$1
+#
+# if [ -d $2 ]
+# then
+# DESTINATION=$2/`basename $SOURCE`
+# else
+# DESTINATION=$2
+# fi
+#
+# pv ${SOURCE} | > ${DESTINATION}
+#}
+#
+## http://www.falsyana.com/2010/linux/cp-mv-with-a-progress-bar/
+## http://unix.stackexchange.com/questions/2577/move-files-with-progress-bar
+## slower then regular mv or cp
+##alias cp='rsync --progress -ah'
+##alias mv='rsync --progress -ah --remove-sent-files'
+#
+#
+#
+## Readablity CLI
+## Removes junk from websites and just give you the body of the post
+## requires python2-2.7 & python2-chardet
+## https://github.com/buriy/python-readability
+## ebook-convert from http://manual.calibre-ebook.com/cli/ebook-convert.html
+#readability2html() {
+# python2.7 -m readability.readability -u "$1" > /tmp/"$2".html
+# ebook-convert /tmp/"$2".html ~/Downloads/"$2".epub
+#}
+#
+#compile-cpp() { g++ -Wall -o "${1%.cpp}" "$1" ; }
+#
+##mplayer playlist
+#mplist(){ mplayer -playlist <(tree -aif "$1" | awk '/\.(mp3|wav|ogg|avi|mpg|iso)$/'); }
+##mplist(){ mplayer -playlist <(find "$1" -regex '.*\.\(mp3\|wav\|ogg\|avi\|mpg\|iso\)' | sort); }
+#
+#zombie-process() { ps aux | awk '{ print $8 " " $2 }' | grep -w Z ;}
+#
+#getexe() {
+# TEMPFILE1=$(mktemp)
+# TEMPFILE2=$(mktemp)
+# INPUTFILE="$1"
+# # Extract raw version resource:
+# wrestool --extract --raw --type=version "$INPUTFILE" > $TEMPFILE1
+#
+# if [ -s $TEMPFILE1 ]
+# then
+# # Search for a sane version string.
+# # This (especially the final regexp) took me really long time to figure out. Am I that lame?
+# VERSION=$(< $TEMPFILE1 \
+# tr '\0, ' '\t.\0' \
+# | sed 's/\t\t/_/g' \
+# | tr -c -d '[:print:]' \
+# | sed -r -n 's/.*Version[^0-9]*([0-9]+\.[0-9]+(\.[0-9][0-9]?)?).*/\1/p'
+# )
+# echo $VERSION
+# fi
+#}
+#function etym(){
+# for term in "$@"
+# do
+# url="etymonline.com/index.php?term=$term"
+# curl -s $url | grep "<dd " |
+# sed -e 's/<a[^>]*>\([^<]*\)<[^>]*>/:\1:/g' -e 's/<[^>]*>//g' |
+# fold -sw `[ $COLUMNS -lt 80 ] && echo $COLUMNS || echo 79 `
+# echo
+# done
+#}
+#DISTRO=$(cat /etc/*-release | head -1 | awk -F\" '{print $(NF-1)}')
+#alias m-windowmanager="wmctrl -m | grep "Name:" | awk '{print $2}'"
+#mbuffer() {
+# mplayer -vo fbdev $1 -fs -subcp ${2:-cp1251} -vf scale=${3:-1280:720}
+#}
+## MPlayer on /dev/ttyN
+# alias fbmplayer='mplayer -vo fbdev2 -vf scale=1280:1024 "$@"'
+#lanshare() {
+# echo "Test Server: http://127.0.0.1:8000 or http://localhost:8000"
+# echo "Server IP (LAN): $(ifconfig eth0 | awk '/inet / {print $2}' | cut -d\: -f2):8000"
+# echo "Server IP (WWW): $(curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"):8000"
+# echo "Hit Ctrl+C to Stop Sharing"
+# python2 -m SimpleHTTPServer
+#}
+#
+#
+#menu() {
+# { tput smcup ; clear; } >/dev/tty
+# [ -n "$LINES" ] || local LINES=$(tput lines)
+# local val; val=$(slmenu -i -l $((LINES-1)) -p "${1:->}")
+# local ret=$?
+# tput rmcup > /dev/tty
+# printf %s\\n "$val"
+# return $ret
+#}
+#normalizeaudio() { sox --norm "$1" "${1%.*}"."$0"."${1##*.}" ;}
+## usage: combine-zip file.zip -- join splited zip (z01, z02 ..etc)
+#unsplit_zip() { zip -s- "$1" -O "${1%.*}"-unsplited.zip ;}
+#
+## usage: combine-001 file.avi.001 -- only requires the 1st file
+#unsplit_001() { lxsplit -j "$1" ;}
+#
+## mkvinfo filename.mkv
+## mkvextract tracks filename.mkv 2:subs.ass
+## mkvextract tracks filename.mkv 2:subs.srt
+## mkvextract attachments filename.mkv 1:BAARS___.TTF
+## put the font files into ~/.fonts and then run `fc-cache -vf'
+## cd to flac
+## flac to wav
+## wav to cd
+## split bin/cue audio
+#
+## -b = -b:v
+## -av = audio bitrate
+#
+## gif, vob, m4v, mov, wmv, wma, vob, cd_mp3, cd_flac, avi
+## mp4 subtitles burn in hardcoded
+#
+#web2png() { CutyCapt --url="$1" --out=web2png_output.png ;}
+## url shortener
+#tiny-isgd() { wget -qO - "http://is.gd/create.php?format=simple&url=$1" ;}
+## create qrcode
+#qrcode() { link=$(echo "http://qrcode.kaywa.com/img.php?s=8&d=$@" | sed 's/ /+/g'); $BROWSER $link ;}
+#quicktime() { mplayer -rtsp-stream-over-tcp -user-agent QuickTime/7.6.4 ;} # -cache 3072
+#
+## http://sourceforge.net/projects/lesspipe/
+## tutorial video: https://www.youtube.com/watch?v=ZEHxG1OhIFo
+##export LESSOPEN='|/usr/bin/lesspipe.sh %s'
+##export LESS='-R'
+#
+## Source-Highlight
+##export LESSOPEN='|/usr/bin/src-hilite-lesspipe.sh %s'
+##export LESS='R'
+#
+## http://zameermanji.com/blog/2012/12/30/using-vim-as-manpager/
+## export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""
+#
+# # Goes up many dirs as the number passed as argument, if none goes up by 1 by default
+#
+#
+## REMIND ME, ITS IMPORTANT!
+# # usage: remindme <time> <text>
+# # e.g.: remindme 10m "omg, the pizza"
+# remindme() { sleep $1 && zenity --info --text "$2" & }
+# #
+#
+## https://github.com/Daenyth/dotfiles/blob/master/.bashrc
+## Environment variables
+## if have less; then
+## export PAGER='less'
+## unset LESSCHARSET # Fix manpages looking funky
+## export LESS='--ignore-case --line-numbers --hilite-unread -z-4 --hilite-search --LONG-PROMPT --no-init --quit-if-one-screen --quit-on-intr --RAW-CONTROL-CHARS'
+## # Colorized less, woohoo
+## export LESS_TERMCAP_mb=$'\E[01;31m'
+## export LESS_TERMCAP_md=$'\E[01;31m'
+## export LESS_TERMCAP_me=$'\E[0m'
+## export LESS_TERMCAP_se=$'\E[0m'
+## export LESS_TERMCAP_so=$'\E[01;44;33m'
+## export LESS_TERMCAP_ue=$'\E[0m'
+## export LESS_TERMCAP_us=$'\E[01;32m'
+## elif have most; then
+## export PAGER='most'
+## else
+## export PAGER='more'
+## fi
+#
+#
+#
+#
+##
+## Run a command x times
+## http://www.stefanoforenza.com/how-to-repeat-a-shell-command-n-times/
+##
+#runx() {
+# n=$1
+# shift
+# while [ $(( n -= 1 )) -ge 0 ]
+# do
+# "$@"
+# done
+#}
+#
+## ask() -- ask user a yes/no question
+#function ask()
+#{
+# echo -n "$@" '[y/N] ' ; read ans
+# case "$ans" in
+# y*|Y*) return 0 ;;
+# *) return 1 ;;
+# esac
+#}
+#
+#
+## vim: set filetype=sh:
+#alias cue2flac="find -type f -name '*.cue' -execdir cue2tracks -R -n 19 -o '%N. %p ─ %t' {} \;"
+#
+#
+## Git Shortcuts! ##
+## alias g="git"
+## alias gr="git rm -rf"
+## alias gs="git status"
+## alias ga="g add"
+## alias gc="git commit -m"
+## alias gp="git push origin master"
+## alias gl="git pull origin master"
+#
+## load rbenv if available
+#if command -v rbenv >/dev/null; then
+# eval "$(rbenv init - --no-rehash)"
+#fi
+## https://github.com/nicknisi/dotfiles/blob/master/zsh/functions.zsh
+## print available colors and their numbers
+#function colours() {
+# for i in {0..255}; do
+# printf "\x1b[38;5;${i}m colour${i}"
+# if (( $i % 5 == 0 )); then
+# printf "\n"
+# else
+# printf "\t"
+# fi
+# done
+#}
+#
+#
+## Start an HTTP server from a directory, optionally specifying the port
+#function server() {
+# local port="${1:-8000}"
+# open "http://localhost:${port}/"
+# # Set the default Content-Type to `text/plain` instead of `application/octet-stream`
+# # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
+# python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
+#}
+#
+## Escape UTF-8 characters into their 3-byte format
+#function escape() {
+# printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
+# echo # newline
+#}
+#
+## Decode \x{ABCD}-style Unicode escape sequences
+#function unidecode() {
+# perl -e "binmode(STDOUT, ':utf8'); print \"$@\""
+# echo # newline
+#}
+#
+#
+#
+#
+function xtrct {
+ if [ -z "$1" ]; then
+ # display usage if no parameters given
+ echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
+ else
+ if [ -f "$1" ] ; then
+ NAME=${1%.*}
+ #mkdir $NAME && cd $NAME
+ case "$1" in
+ *.tar.bz2) tar xvjf ./"$1" ;;
+ *.tar.gz) tar xvzf ./"$1" ;;
+ *.tar.xz) tar xvJf ./"$1" ;;
+ *.lzma) unlzma ./"$1" ;;
+ *.bz2) bunzip2 ./"$1" ;;
+ *.rar) unrar x -ad ./"$1" ;;
+ *.gz) gunzip ./"$1" ;;
+ *.tar) tar xvf ./"$1" ;;
+ *.tbz2) tar xvjf ./"$1" ;;
+ *.tgz) tar xvzf ./"$1" ;;
+ *.zip) unzip ./"$1" ;;
+ *.Z) uncompress ./"$1" ;;
+ *.7z) 7z x ./"$1" ;;
+ *.xz) unxz ./"$1" ;;
+ *.exe) cabextract ./"$1" ;;
+ *) echo "extract: '$1' - unknown archive method" ;;
+ esac
+ else
+ echo "'$1' - file does not exist"
+ fi
+fi
+}
+#
+#
+#
+#
+#function thumbify() {
+# if [ -f $1 ]; then
+# cp $1 thumb-$1
+# if [ $2 ]; then
+# mogrify -resize $2 thumb-$1
+# else
+# mogrify -resize 250x250 thumb-$1
+# fi
+# else
+# echo "$1: not a regular file"
+# fi
+#}
+#
+#
+#alias cadate='TZ=America/Los_Angeles date'
+#alias frdate='TZ=Europe/Paris date'
+#alias ozdate='TZ=Australia/Brisbane date'
+#
+#alias myip='wget -qO- http://ipecho.net/plain ; echo'
+#
+## no line wrapping in less
+#export LESS=$LESS" -S"
+#
+#alias vless="/usr/share/vim/vim74/macros/less.sh"
+#
+#
+#
+## Shortcut to get the disk size of a directory and contents
+#sizeof() {
+# du -ch "$1" | grep total
+#}
+#
+## Shortcut to change directory and list contents
+#cdls() {
+# if [ -d "$1" ]; then
+# cd "$1"
+# ls
+# else
+# echo "bash: cl: '$1': Directory not found"
+# fi
+#}
+#
+#
+#
+## super stealth background launch
+#function daemon
+#{
+# (exec "$@" >&/dev/null &)
+#}
+#
+# # Do something and receive a desktop alert when it completes `sudo apt-get install something | alert`
+# alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
+#
+#
+# # Search for files and page it
+# function search() { find . -iname "*$@*" | less; }
+# # nohup "$@" > /dev/null 2>&1 < /dev/null &
+#
+#
+# # *.dmg) hdiutil mount $1 ;;
+#
+#
+#
+#
+#
+#function lsofg()
+#{
+# if [ $# -lt 1 ] || [ $# -gt 1 ]; then
+# echo "grep lsof"
+# echo "usage: losfg [port/program/whatever]"
+# else
+# lsof | grep -i $1 | less
+# fi
+#}
+#
+#
+#
+#function psg()
+#{
+# if [ $# -lt 1 ] || [ $# -gt 1 ]; then
+# echo "grep running processes"
+# echo "usage: psg [process]"
+# else
+# ps aux | grep USER | grep -v grep
+# ps aux | grep -i $1 | grep -v grep
+# fi
+#}
+#
+####### convert binaries
+## copyright 2007 - 2010 Christopher Bratusek
+#function bin2all() {
+# if [[ $1 ]]; then
+# echo "binary $1 = octal $(bin2oct $1)"
+# echo "binary $1 = decimal $(bin2dec $1)"
+# echo "binary $1 = hexadecimal $(bin2hex $1)"
+# echo "binary $1 = base32 $(bin2b32 $1)"
+# echo "binary $1 = base64 $(bin2b64 $1)"
+# echo "binary $1 = ascii $(bin2asc $1)"
+# fi
+#}
+#
+####### DVD to ISO
+#function dvd2iso()
+#{
+## to get desired device
+#df -h -x tmpfs -x usbfs
+#echo -n "Using the information in the terminal window, please enter the appropriate DVD drive:
+#"
+#read DVDDEVICE
+#echo -n "Please enter a name for the ISO file you will create:
+#"
+#read XVIDNAME
+#pv "$DVDDEVICE" | dd of="$XVIDNAME".iso
+#}
+#
+####### DVD to VOB
+## requires vobcopy: sudo apt-get install vobcopy
+## alias dvd2vob='vobcopy -i /dev/dvd -o ~/ -l'
+#
+#function daemon()
+#{
+# (exec "$@" >&/dev/null &)
+#}
+#
+#function geniso() {
+# # copyright 2007 - 2010 Christopher Bratusek
+# if [[ $CD_WRITER ]]; then
+# dd $DD_OPTS if=$CD_WRITER of="$1"
+# else dd $DD_OPTS if=/dev/dvdrw of="$1"
+# fi
+#}
+#
+#function lowercase()
+#{
+# for file ; do
+# filename=${file##*/}
+# case "$filename" in
+# */*) dirname==${file%/*} ;;
+# *) dirname=.;;
+# esac
+# nf=$(echo $filename | tr A-Z a-z)
+# newname="${dirname}/${nf}"
+# if [ "$nf" != "$filename" ]; then
+# mv "$file" "$newname"
+# echo "lowercase: $file --> $newname"
+# else
+# echo "lowercase: $file not changed."
+# fi
+# done
+#}
+#
+#
+ function rip_orig() {
+ handbrake -i /dev/dvd -o ${HOME}/${1}.mp4 -L -U -F -f mp4 -e x264 -b 4000 -B 192
+ }
+#
+###################################################
+## Slow down CPU and IO for process and its #
+## offsprings #
+###################################################
+#
+####### requires gawk: sudo apt-get install gawk
+#function slow2() { ionice -c3 renice -n 20 $(pstree `pidof $1` -p -a -u -A|gawk 'BEGIN{FS=","}{print $2}'|cut -f1 -d " ") ; }
+#
+#
+#
+#
+###################################################
+## ISO-writer #
+###################################################
+#
+#function writeiso() {
+# # copyright 2007 - 2010 Christopher Bratusek
+# if [[ $CD_WRITER ]]; then
+# cdrecord dev=$CD_WRITER "$1"
+# else cdrecord deV=/dev/dvdrw "$1"
+# fi
+#}
+#
+#alias cdcopy='pv /dev/cdrom | dd of=cd.iso' # to backup a cd from a cdrom drive to an ISO
+#
+#alias diskcopy='pv /dev/dvd | dd of=disk.iso' # to backup the disc (cd/dvd/whatever) to an ISO
+#alias floppycopy='pv /dev/fd0 | dd of=floppy.image' # to duplicate a floppy disk to hard drive image file
+#alias partitioncopy='sudo pv /dev/sda1 | dd of=/dev/sda2 bs=4096 conv=notrunc,noerror' # to duplicate one hard disk partition to another
+#alias restore-sda='sudo pv /dev/hda | dd of=/dev/sda bs=64k conv=notrunc,noerror' # to restore from ??? to the existing drive
+#alias scsicopy='sudo pv /dev/scd0 | dd of=cd.iso' # if cdrom is scsi}
+#
+#alias extundelete-d='sudo extundelete "$1" --restore-directory "$2"' # restore all files possible from specified dir. ("$2" = path/to/directory)
+#alias extundelete-f='sudo extundelete "$1" --restore-files "$2"' # restore list of files (use to restore single file) ("$2" = filename)
+#alias extundelete-r='sudo extundelete "$1" --restore-all' # restore all files possible to undelete
+#alias blankcd='cdrecord -v dev=/dev/cdrom blank=fast gracetime=3'
+#alias blankdvd='cdrecord -v dev=/dev/dvd blank=fast gracetime=3'
+#alias rdp='rdesktop -u "$USER" -g 1600x1200 -D -r disk:home=/home -r clipboard:PRIMARYCLIPBOARD' # quick full screen RDP connection
+#
+###################################################
+## Remastersys stuff #
+###################################################
+#
+#alias remastersys-backup-custom='sudo remastersys backup custom.iso' # to make a livecd/dvd backup and call the iso custom.iso
+#alias remastersys-backup='sudo remastersys backup' # to make a livecd/dvd backup of your system
+#alias remastersys-clean='sudo remastersys clean' # to clean up temporary files of remastersys
+#alias remastersys-dist-cdfs='sudo remastersys dist cdfs' # to make a distributable livecd/dvd filesystem only
+#alias remastersys-dist-custom='sudo remastersys dist iso custom.iso' # to make a distributable iso named custom.iso but only if cdfs is present
+#alias remastersys-dist='sudo remastersys dist' # to make a distributable livecd/dvd of your system
+#
+#
+## Kill all the tabs in Chrome to free up memory
+## [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
+#alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
+#
+#
+#
+#mountiso() { mkdir -p "$HOME"/.gvfs/"${1%.*}" && gvfs-mount "$1" "$HOME"/.gvfs/"${1%.*}" ;}
+#
+#resize_images() {
+# if [ $# -lt 1 ]; then
+# echo -e "Usage: $0 <file_name>"
+# echo -e "\nsingle: $0 file.m4a"
+# echo -e "\nmultiple: $0 file1.m4a file2.m4a file3.m4a"
+# echo -e "\nwildcard: $0 *"
+# echo -e "\nwildcard: $0 *.jpg"
+# return 1
+# fi
+#
+# myArray=( "${@:2}" )
+# for arg in "${myArray[@]}"; do
+# convert "$arg" -monitor -resize "$1" "${arg%.*}""$1"_resized."${arg##*.}"
+# done
+#}
+## If piping something in, copy it.
+## If just doing `clip`, paste it.
+#function clip { [ -t 0 ] && pbpaste || pbcopy;}
+#
+#
+#sbg(){
+# ("$@" & disown ) >/dev/null 2>&1 </dev/null
+# which "$1" >/dev/null 2>&1
+#}
+#
+#alias netlisten='lsof -i -P | grep LISTEN' #listening ports
+##internetinfo | Usage: ii
+#function ii() # get current host related info
+#{
+# echo -e "\n${RED}Kernel Information:$NC " ; uname -a
+# echo -e "\n${RED}Users logged on:$NC " ; w -h
+# echo -e "\n${RED}Current date :$NC " ; date
+# echo -e "\n${RED}Machine stats :$NC " ; uptime
+# echo -e "\n${RED}Memory stats :$NC " ; free
+# echo -e "\n${RED}Disk Usage :$NC " ; df -Th
+# echo -e "\n${RED}LAN Information :$NC" ; netinfoLAN
+# echo
+#}
+#
+#dd_clone() {
+# if [ $# -lt 2 ]; then
+# echo -e "image or clone <image|drive|parition> including free space and verify data"
+# echo -e "\nUsage: $0 <input> <output>"
+# echo -e "\nExample: $0 /dev/sdX /tmp/output.dd"
+# echo -e "\n$0 /dev/sdX /dev/sdY"
+# echo -e "\n$0 /tmp/output.img /dev/sdX"
+# echo -e "\n$0 /dev/cdrom /tmp/output.iso"
+# echo -e "\nList All Drives: sudo fdisk -l"
+# echo -e "\nRequirement: pv dcfldd"
+# return 1
+# fi
+#
+# sudo sh -c "
+# # clone
+# pv -tpreb "$1" | dcfldd of="$2" bs=4M
+# # verify data match or mismatch
+# dcfldd if="$1" vf="$2"
+# "
+#}
+#
+#verify_md5sum() { pv "$1" | md5sum ;}
+#
+#formatme() {
+# sudo mkdosfs -n 'Label' -I /dev/sdd
+#}
+#
+#
+#### Full Disk Clone and Restore
+#clonezilla_disk_cloning() {
+# if [ $# -lt 2 ]; then
+# echo -e "clone fulldisk device to image"
+# echo -e "\nUsage: $0 <output_file> <device>"
+# echo -e "\nExample: $0 laptop_fulldisk_2015_12_25_img sdx"
+# echo -e "\nNote: device does not have numbers at the end (sdx)"
+# return 1
+# fi
+# sudo /usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 5000000 -sc -p true savedisk "$1" "$2"
+#}
+#
+#clonezilla_disk_restore() {
+# if [ $# -lt 2 ]; then
+# echo -e "restore fulldisk image to device"
+# echo -e "\nUsage: $0 <input_file> <device>"
+# echo -e "\nExample: $0 laptop_fulldisk_2015_12_25_img sdx1"
+# echo -e "\nNote: partitions usually have numbers at the end (sdx1)"
+# return 1
+# fi
+# sudo /usr/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p true restoredisk "$1" "$2"
+#}
+#
+#### Partition Clone and Restore
+#clonezilla_partition_cloning() {
+# if [ $# -lt 2 ]; then
+# echo -e "clone device partition to image"
+# echo -e "\nUsage: $0 <output_file> <device>"
+# echo -e "\nExample: $0 desktop_partition_2016_12_25_img sdx"
+# echo -e "\nNote: device does not have numbers at the end (sdx)"
+# return 1
+# fi
+# sudo /usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 5000000 -sc -p true saveparts "$1" "$2"
+#}
+#
+#clonezilla_partition_restore() {
+# if [ $# -lt 2 ]; then
+# echo -e "restore image to device partition"
+# echo -e "\nUsage: $0 <input_file> <device>"
+# echo -e "\nExample: $0 desktop_partition_2016_12_25_img sdx1"
+# echo -e "\nNote: partitions usually have numbers at the end (sdx1)"
+# return 1
+# fi
+# sudo /usr/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -k -p true restoreparts "$1" "$2"
+#}
+#
+## http://stackoverflow.com/a/22049344
+#killall-zombies() { kill -HUP $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }') ;}
+#
+#m-disconnect() { nmcli d disconnect enp5s0 ;}
+#m-connect() { nmcli d connect enp5s0 ;}
+#mount-image() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "concatenate multiple pdf files into one single pdf"
+# echo -e "\nUsage:\n$0 <pdfs>"
+# echo -e "\nexample:\n$0 file1.pdf file2.pdf file3.pdf"
+# echo -e "\n$0 *.pdf"
+#
+# return 1
+# fi
+#
+# mkdir "/tmp/$1"
+# mount -t vfat -o loop,ro,noexec "$1" "/tmp/$1"
+#
+#}
+#
+#cmus-alarm() {
+# cmus-remote -p -v 100
+#
+#}
+#
+#
+#lynx-mp3() { lynx -dump "$1" | awk '/http/ && /mp3/ {print $2}' ;}
+#
+#nap() {
+# ~/.bin/nap-1.5.4.linux-amd64/nap \
+# -r \
+# -s 108.19.45.179:7777 \
+# -s 108.19.45.179:8888 \
+# -s share-it.loginto.me:3456 \
+# -s 84.24.69.59:6436 \
+# -s spica.sytes.net:8888 \
+# -s 98.202.75.0:8877 \
+# -s 87.13.117.33:8888 \
+# -s 79.103.107.173:5995 \
+# -s 79.31.239.174:8888 \
+# "$@"
+#}
+#
+#cfg-nap() { $EDITOR ~/.nap/napconf ;}
+#
+#
+## http://twit.altervista.org/linux-2/how-to-copy-an-entire-commandline-using-just-the-keyboard.html
+## alias copylastcommand='echo "!!" | xclip -selection clipboard'
+## alias copylastcommand='history -p !! | xsel -ib'
+## alias copylastcommand='$(history -p !-1) | xsel -ib'
+#
+#color_term() {
+# for i in {0..255} ; do
+# printf "\x1b[38;5;${i}mcolour${i}\n"
+# done
+#}
+#
+#vcsi-width-3x5() {
+# vcsi "$2" -t -w "$1" --background-color 000000 --metadata-font-color ffffff -g 3x5 --end-delay-percent 20
+#}
+#convert2image_jpg() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "convert images to jpg"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.bmp pic3.png"
+# echo -e "\n$0 *.png"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# convert -quality 50% "$arg" "${arg%.*}.jpg"
+# done
+#}
+#
+#vcsi-1280-3x4() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "vcsi"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# vcsi "$arg" -t -w 1024 --background-color 000000 --metadata-font-color ffffff -g 2x5 --end-delay-percent 20
+# done
+#}
+#
+#vcsi-auto-3x5() {
+# eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width "$1")
+# get_width=${streams_stream_0_width}
+# vcsi "$1" -t -w "$get_width" --background-color 000000 --metadata-font-color ffffff -g 3x5 --end-delay-percent 20
+#}
+#
+#vsheet() {
+#
+# # generate sheet
+# eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width "$1")
+# get_width=${streams_stream_0_width}
+# vcsi "$1" -t -w "$get_width" --background-color 000000 --metadata-font-color ffffff -g 3x5 --end-delay-percent 20
+#
+# concat_jpg mpv-*.jpg *.png
+# image-resize-1920x1080 concatoutput.jpg
+# mv concatoutput_1920x1080_resized.jpg cover.jpg
+#
+#
+#}
+#
+#
+#
+## http://productivefoss.blogspot.com.au/2015/05/exploring-notification-system-ii-how-to.html?m=1
+## http://www.webupd8.org/2016/03/translate-any-text-you-select-on-your.html
+#
+#
+#publicpickups() {
+# if [ $# -lt 1 ]
+# then
+# echo -e "resize pictures to another resolution"
+# echo -e "\nUsage:\n$0 <picture>"
+# echo -e "\nexample:\n$0 pic1.png pic2.png pic3.png"
+# echo -e "\n$0 *.jpg"
+#
+# return 1
+# fi
+#
+# myArray=( "$@" )
+# for arg in "${myArray[@]}"; do
+# # AUTHORS=$( echo "$arg" | awk -F_ '{print $2 " " $3}' | sed -e "s/\b\(.\)/\u\1/g" )
+# AUTHORS=$( echo "$arg" | awk -F_ '{print $2}' | sed -e "s/\b\(.\)/\u\1/g" )
+# cmx-add $cbsuper -e -a "$AUTHORS" -t "$arg" -T "korn,pov,amatuer" -c "${arg}.jpg"
+# done
+#}
+#
+###########################################################
+#itv(){mpv http://46.249.60.210:15099/play/a00j &> /dev/null & }
+#itv_plus1(){mpv http://46.249.60.210:15099/play/a00l &> /dev/null & }
+#itv2(){mpv http://46.249.60.210:15099/play/a00o &> /dev/null & }
+#itv2_plus1(){mpv http://46.249.60.210:15099/play/a01j &> /dev/null & }
+#itv4(){mpv http://46.249.60.210:15099/play/a00p &> /dev/null & }
+#itv4_plus1(){mpv http://46.249.60.210:15099/play/a00r &> /dev/null & }
+
+#ch4(){mpv http://195.189.203.18:8080/play/a01b &> /dev/null & }
+#ch4_plus1(){mpv http://195.189.203.18:8080/play/a01e &> /dev/null & }
+#bbc1(){${HOME}/bin/get_iplayer --stream --type=livetv "BBC One" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbc2(){${HOME}/bin/get_iplayer --stream --type=livetv "BBC Two" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbc3(){${HOME}/bin/get_iplayer --stream --type=livetv "BBC Three" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbc4(){${HOME}/bin/get_iplayer --stream --type=livetv "BBC Four" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcn(){${HOME}/bin/get_iplayer --stream --type=livetv "BBC News" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbccbbc(){${HOME}/bin/get_iplayer --stream --type=livetv "CBBC" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbccbbs(){${HOME}/bin/get_iplayer --stream --type=livetv "CBeebies" --player="/usr/bin/mplayer -" &> /dev/null &}
+
+#bbcr1x(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC 1xtra" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr1(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 1" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr2(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 2" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr3(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 3" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr4(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 4 FM" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr4x(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 4 Extra" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr5(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC Radio 5 live" --player="/usr/bin/mplayer -" &> /dev/null &}
+#bbcr5x(){${HOME}/bin/get_iplayer --stream --type=liveradio "BBC 5 live Sports Extra" --player="/usr/bin/mplayer -" &> /dev/null &}
+#ewtn(){mpv http://ewtn.mpl.miisolutions.net:1935/ewtn-live-1/smil:dome.smil/playlist.m3u8 &> /dev/null &}
+#ewtn(){mpv "http://bogtvhdlive-f.akamaihd.net/main_1_400@79148?v=2.9.4&fp=WIN%2016,0,0,257&r=DIQLE&g=YMULUMYIOWWK" &> /dev/null & }
+###########################################################
+##
+## #-------- Functions #-------- }}}
+##
+############################################################
diff --git a/.zshopts b/.zshopts
new file mode 100644
index 0000000..e520b3c
--- /dev/null
+++ b/.zshopts
@@ -0,0 +1,23 @@
+###############################################################################
+#
+# STARTUP MESSAGES --- {{{
+#
+###############################################################################
+
+#prompt
+clear
+echo "Welcome to ${HOSTNAME}"
+#neofetch
+ip_show
+echo
+startup_diskUsage
+
+echo
+w
+prompt_bash
+
+###############################################################################
+#
+# STARTUP MESSAGES --- }}}
+#
+###############################################################################
diff --git a/.zshrc b/.zshrc
new file mode 100644
index 0000000..9b1ffa7
--- /dev/null
+++ b/.zshrc
@@ -0,0 +1,116 @@
+if [[ "$(tty)" = "/dev/tty1" ]]; then
+ pgrep i3 || startx ~/.xinitrc
+fi
+
+setxkbmap gb && xmodmap ~/.Xmodmap
+# Path to your oh-my-zsh installation.
+export ZSH=$HOME/.oh-my-zsh
+
+#Path to aliases and environment variables used in bash
+export BASH_DIR=$HOME/.bashrc.d
+export Z_DIR=$HOME/dotfiles/z
+# Set name of the theme to load.
+# Look in ~/.oh-my-zsh/themes/
+# Optionally, if you set this to "random", it'll load a random theme each
+# time that oh-my-zsh is loaded.
+#ZSH_THEME="robbyrussell"
+#ZSH_THEME="af-magic"
+ZSH_THEME="mh"
+#ZSH_THEME="af-mh"
+#ZSH_THEME="agnoster"
+#ZSH_THEME="robbyrussell"
+#ZSH_THEME="lukerandall"
+
+# Uncomment the following line to use case-sensitive completion.
+# CASE_SENSITIVE="true"
+
+# Uncomment the following line to use hyphen-insensitive completion. Case
+# sensitive completion must be off. _ and - will be interchangeable.
+# HYPHEN_INSENSITIVE="true"
+
+# Uncomment the following line to disable bi-weekly auto-update checks.
+# DISABLE_AUTO_UPDATE="true"
+
+# Uncomment the following line to change how often to auto-update (in days).
+# export UPDATE_ZSH_DAYS=13
+
+# Uncomment the following line to disable colors in ls.
+# DISABLE_LS_COLORS="true"
+
+# Uncomment the following line to disable auto-setting terminal title.
+ DISABLE_AUTO_TITLE="true"
+
+# Uncomment the following line to enable command auto-correction.
+ ENABLE_CORRECTION="true"
+
+# Uncomment the following line to display red dots whilst waiting for completion.
+ COMPLETION_WAITING_DOTS="true"
+
+# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
+# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
+# Example format: plugins=(rails git textmate ruby lighthouse)
+# Add wisely, as too many plugins slow down shell startup.
+plugins=(zsh-interactive-cd vi-mode git python sudo fzf fasd fd ripgrep tmux torrent zsh-nvm adb )
+
+# User configuration
+# Set personal aliases, overriding those provided by oh-my-zsh libs,
+# plugins, and themes. Aliases can be placed here, though oh-my-zsh
+# users are encouraged to define aliases within the ZSH_CUSTOM folder.
+# For a full list of active aliases, run `alias`.
+
+source $HOME/.zshenv
+source $HOME/.zshaliases
+source $HOME/.googler_at
+source $HOME/.zshfunc
+source $HOME/.zshopts
+source $ZSH/oh-my-zsh.sh
+
+#Use fasd
+eval "$(fasd --init auto)"
+
+#use github cli (gh)
+eval "(gh completion -s zsh) >/dev/null"
+
+# vi mode
+bindkey -v
+
+autoload -U edit-command-line
+zle -N edit-command-line
+bindkey '^x^x' edit-command-line
+
+function zle-line-init zle-keymap-select {
+ VIM_PROMPT="%{$fg_bold[yellow]%} [% VIM-MODE]% %{$reset_color%}"
+ RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
+ zle reset-prompt
+}
+
+zle -N zle-line-init
+zle -N zle-keymap-select
+export KEYTIMEOUT=1
+
+neofetch
+source "$HOME/.config/shortcutrc" # Load shortcut aliases
+
+# MPD daemon start if no other user instance exists
+#[ ! -s ~/..config/mpd/pid ] && mpd
+
+# >>> conda initialize >>>
+# !! Contents within this block are managed by 'conda init' !!
+__conda_setup="$('/home/archlinux/vgg/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
+if [ $? -eq 0 ]; then
+ eval "$__conda_setup"
+else
+ if [ -f "/home/archlinux/vgg/anaconda3/etc/profile.d/conda.sh" ]; then
+ . "/home/archlinux/vgg/anaconda3/etc/profile.d/conda.sh"
+ else
+ export PATH="/home/archlinux/vgg/anaconda3/bin:$PATH"
+ fi
+fi
+unset __conda_setup
+# <<< conda initialize <<<
+
+fpath=(~/.zsh.d/ $fpath)
+# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
+export PATH="$HOME/.gem/ruby/2.6.0/bin:$HOME/.rvm/bin:$PATH"
+
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh