diff --git a/dots/bash/.bashrc b/dots/bash/.bashrc index 54b92bc..ba4316b 100644 --- a/dots/bash/.bashrc +++ b/dots/bash/.bashrc @@ -90,6 +90,10 @@ esac # --- +# lf & superfile +# --- + + # lf (change directory on quit) # --- lf() { @@ -105,7 +109,6 @@ lf() { } -# --- # superfile (change directory on quit) # --- spf() { @@ -125,46 +128,6 @@ spf() { } -# --- -# searching -# --- - -# find a file (faf) -faf() { - path="." - if [[ -n $2 ]]; then - path=$2 - fi - find ${path} -type f -iname ${1} 2>/dev/null -} - -# find in file (fif) | https://stackoverflow.com/questions/16956810/find-all-files-containing-a-specific-text-string-on-linux -fif() { - path="." - if [[ -n $2 ]]; then - path=$2 - fi - grep -rnw ${path} -e ${1} 2>/dev/null -} - - -# --- -# networking -# --- - -nmrestart() { - systemctl restart NetworkManager - systemctl status NetworkManager -} - - -# --- -# screens / displays / power management -# --- - -# n/a - - # --- # misc # --- @@ -200,6 +163,84 @@ randoms() { } + +# --- +# mounting +# --- + +alias nas-mount="nas mount 192.168.31.77" +alias nas-umount="nas umount" + +nas() { + if [[ ! -e $dir ]] ; then + sudo mkdir -p "/mnt/nas" + sudo mkdir -p "/mnt/nas-fam" + elif [[ ! -d "/mnt/nas" ]] || [[ ! -d "/mnt/nas-fam" ]] ; then + echo "'/mnt/nas' and/or '/mnt/nas-fam' exists, but is not a directory" 1>&2 + fi + + if [[ -n $1 ]] ; then + if [[ $1 == "umount" ]] || [[ $1 == "unmount" ]] ; then + echo "umount /mnt/nas & /mnt/nas-fam" + sudo umount /mnt/nas + sudo umount /mnt/nas-fam + elif [[ $1 == "mount" ]] && [[ -n $2 ]]; then + echo "mount /mnt/nas & /mnt/nas-fam" + sudo mount -t cifs -o credentials=/home/poq/syncDir/secrets/nas/lillesorteboks.txt,iocharset=utf8,noperm //$2/fro /mnt/nas + sudo mount -t cifs -o credentials=/home/poq/syncDir/secrets/nas/lillesorteboks.txt,iocharset=utf8,noperm //$2/fam /mnt/nas-fam + tree -L 2 /mnt/nas + tree -L 2 /mnt/nas-fam + else + echo "missing the ip when doing a mount? or, just trying a weird command? try: 'nas {mount,umount} {ip?}'" + fi + else + echo "sry, bud! try: 'nas {mount,umount} {ip?}'" + fi +} + + +# --- +# multimedia +# --- + +# downstream() { +# output="output.mp4" +# # https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash +# if [[ -n $2 ]]; then +# output=$2 +# fi +# ffmpeg -i "$1" -c copy -bsf:a aac_adtstoasc "/home/poq/syncDir/0_downloads/${output}" +# } +#alias videoCompressor="/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2104_videoCompressor/src/vc_v2.sh" +# alias videoWatermark="/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2104_videoCompressor/src/vcwm_v1.sh" +#alias toJpg='/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2306_toJpg/toJpg.sh' + +#imgResize() { +# /home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2305_imgResizer/resize.sh 1200 "$1" jpg +#} + +# https://itsfoss.com/compress-pdf-linux/ +pdfCompress() { + gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook \ + -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1.compressed.pdf $1 +} + +# https://stackoverflow.com/questions/8933053/check-duration-of-audio-files-on-the-command-line +lengthInSeconds() { + ffprobe -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $1 2>/dev/null +} + + +# --- +# networking +# --- + +nmrestart() { + systemctl restart NetworkManager + systemctl status NetworkManager +} + + # --- # rotate # --- @@ -382,74 +423,33 @@ rote36() { # --- -# mounting +# searching # --- -alias nas-mount="nas mount 192.168.31.77" -alias nas-umount="nas umount" +# find a file (faf) +faf() { + path="." + if [[ -n $2 ]]; then + path=$2 + fi + find ${path} -type f -iname ${1} 2>/dev/null +} -nas() { - if [[ ! -e $dir ]] ; then - sudo mkdir -p "/mnt/nas" - sudo mkdir -p "/mnt/nas-fam" - elif [[ ! -d "/mnt/nas" ]] || [[ ! -d "/mnt/nas-fam" ]] ; then - echo "'/mnt/nas' and/or '/mnt/nas-fam' exists, but is not a directory" 1>&2 - fi - - if [[ -n $1 ]] ; then - if [[ $1 == "umount" ]] || [[ $1 == "unmount" ]] ; then - echo "umount /mnt/nas & /mnt/nas-fam" - sudo umount /mnt/nas - sudo umount /mnt/nas-fam - elif [[ $1 == "mount" ]] && [[ -n $2 ]]; then - echo "mount /mnt/nas & /mnt/nas-fam" - sudo mount -t cifs -o credentials=/home/poq/syncDir/secrets/nas/lillesorteboks.txt,iocharset=utf8,noperm //$2/fro /mnt/nas - sudo mount -t cifs -o credentials=/home/poq/syncDir/secrets/nas/lillesorteboks.txt,iocharset=utf8,noperm //$2/fam /mnt/nas-fam - tree -L 2 /mnt/nas - tree -L 2 /mnt/nas-fam - else - echo "missing the ip when doing a mount? or, just trying a weird command? try: 'nas {mount,umount} {ip?}'" - fi - else - echo "sry, bud! try: 'nas {mount,umount} {ip?}'" - fi +# find in file (fif) | https://stackoverflow.com/questions/16956810/find-all-files-containing-a-specific-text-string-on-linux +fif() { + path="." + if [[ -n $2 ]]; then + path=$2 + fi + grep -rnw ${path} -e ${1} 2>/dev/null } # --- -# multimedia +# web++ # --- -# downstream() { -# output="output.mp4" -# # https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash -# if [[ -n $2 ]]; then -# output=$2 -# fi -# ffmpeg -i "$1" -c copy -bsf:a aac_adtstoasc "/home/poq/syncDir/0_downloads/${output}" -# } -#alias videoCompressor="/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2104_videoCompressor/src/vc_v2.sh" -# alias videoWatermark="/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2104_videoCompressor/src/vcwm_v1.sh" -#alias toJpg='/home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2306_toJpg/toJpg.sh' -#imgResize() { -# /home/poq/syncDir/gitRepos/gi.op.fo/miniProjects/2305_imgResizer/resize.sh 1200 "$1" jpg -#} - -# https://itsfoss.com/compress-pdf-linux/ -pdfCompress() { - gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook \ - -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1.compressed.pdf $1 -} - -# https://stackoverflow.com/questions/8933053/check-duration-of-audio-files-on-the-command-line -lengthInSeconds() { - ffprobe -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $1 2>/dev/null -} - - - -# --- # ajp related # --- # ajp-cp2dropbox() { @@ -467,7 +467,6 @@ podigy() { # } -# --- # jeton # --- jeton() { @@ -478,7 +477,6 @@ jeton() { } -# --- # misc websites # --- alias 00101111.xyz-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/gi.op.fo/00101111.xyz/www/ usr@178.156.192.201:/var/www/00101111.xyz/" @@ -487,7 +485,6 @@ alias op.fo-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 180 alias wa.fo-deploy="rsync -v -a --progress --stats --delete-delay -e 'ssh -p 1808' /home/poq/syncDir/gitRepos/gi.op.fo/mini-websites/wa.fo/ usr@178.156.192.201:/var/www/wa.fo/" -# --- # jongleur # --- jcssbuilder() {