UP | HOME

My own specific binaries

Table of Contents

remote-desktop - Remote Desktop Connect

computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20);

case $computer in
    PCMEL1)
          rdesktop -a 16 -P -z -x m -r sound:off -g "80%" -u "ESRF\OPPEL" -p $(pass esrf/PCMEL1/OPPEL | sed -n 1p) pcmel1
          ;;
    PCMEG01)
          rdesktop -a 16 -P -z -x m -r sound:off -g "80%" -u "ESRF\DEHAEZE" -p $(pass ssl.esrf.fr/dehaeze | sed -n 1p) pcmeg01
          ;;
    PCNASS1)
          rdesktop -a 16 -P -z -x m -r sound:off -g "80%" -u "ESRF\DEHAEZE" -p $(pass ssl.esrf.fr/dehaeze | sed -n 1p) pcnass1
          ;;
    RNICE)
          echo "Not yet implemented"
          ;;
    *)
          echo "Not existing"
          ;;
esac

print-rnice - Print on Rnice

nbpage=$(echo -e '1\n2\n4' | dmenu -p 'Number of pages per sheet' -l 20);
sides=$(echo -e 'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge' | dmenu -p 'Two Sided:' -l 20);

# First copy the file to Rnice
if sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" scp $1 dehaeze@rnice:~/Downloads/; then
  # Then print on Rnice
  sshpass -p "$(pass ssl.esrf.fr/dehaeze | sed -n 1p)" ssh dehaeze@rnice "lpr -o media=A4 -o sides=$sides -o number-up=$nbpage -P ctb110c1u ~/Downloads/$1";
  # Finally, delete the file
else
  echo "Command Failed"
fi

tmp14 - Mount/Umount tmp_14_days folder

if [ $1 == "mount" ]; then
    if sshfs -o allow_other,default_permissions -p 5022 dehaeze@firewall.esrf.fr:/tmp_14_days/ ~/mnt/ESRF; then
        dunstify --replace=58249 'ESRF TMP ' 'Successfully mounted'
    else
        dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while mounted'
    fi
elif [ $1 == "umount" ]; then
    if umount /home/thomas/mnt/ESRF/; then
        dunstify --replace=58249 'ESRF TMP ' 'Successfully unmounted'
    else
        dunstify --replace=58249 --urgency=critical 'ESRF TMP ' 'Error while unmounted'
    fi
fi

nas - Interact with the NAS

As an alternative, sshfs can be used:

sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS
if [ $1 == "mount" ]; then
    if mount /home/thomas/mnt/NAS/; then
        dunstify --replace=58249 'NAS ' 'Successfully mounted'
    else
        dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while mounted'
    fi
elif [ $1 == "umount" ]; then
    if umount /home/thomas/mnt/NAS/; then
        dunstify --replace=58249 'NAS ' 'Successfully unmounted'
    else
        dunstify --replace=58249 --urgency=critical 'NAS ' 'Error while unmounted'
    fi
fi

torrent-add - Download Torrent

transmission-remote ***REMOVED***:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \
    dunstify 'Torrent' 'Successfully added' || \
    dunstify 'Torrent' 'Error'

Author: Dehaeze Thomas

Created: 2020-05-26 mar. 08:39