<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <!-- 2020-05-26 mar. 08:39 --> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>My own specific binaries</title> <meta name="generator" content="Org mode" /> <meta name="author" content="Dehaeze Thomas" /> <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/> <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/> <script type="text/javascript" src="./js/jquery.min.js"></script> <script type="text/javascript" src="./js/bootstrap.min.js"></script> <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script> <script type="text/javascript" src="./js/readtheorg.js"></script> </head> <body> <div id="org-div-home-and-up"> <a accesskey="h" href="./index.html"> UP </a> | <a accesskey="H" href="./index.html"> HOME </a> </div><div id="content"> <h1 class="title">My own specific binaries</h1> <div id="table-of-contents"> <h2>Table of Contents</h2> <div id="text-table-of-contents"> <ul> <li><a href="#org6b54cb5"><code>remote-desktop</code> - Remote Desktop Connect</a></li> <li><a href="#org510bdb5"><code>print-rnice</code> - Print on Rnice</a></li> <li><a href="#org23d98e4"><code>tmp14</code> - Mount/Umount tmp_14_days folder</a></li> <li><a href="#org86657ca"><code>nas</code> - Interact with the NAS</a></li> <li><a href="#org626d308"><code>torrent-add</code> - Download Torrent</a></li> </ul> </div> </div> <div id="outline-container-org6b54cb5" class="outline-2"> <h2 id="org6b54cb5"><code>remote-desktop</code> - Remote Desktop Connect</h2> <div class="outline-text-2" id="text-org6b54cb5"> <div class="org-src-container"> <pre class="src src-bash">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 </pre> </div> </div> </div> <div id="outline-container-org510bdb5" class="outline-2"> <h2 id="org510bdb5"><code>print-rnice</code> - Print on Rnice</h2> <div class="outline-text-2" id="text-org510bdb5"> <div class="org-src-container"> <pre class="src src-bash">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 </pre> </div> </div> </div> <div id="outline-container-org23d98e4" class="outline-2"> <h2 id="org23d98e4"><code>tmp14</code> - Mount/Umount tmp_14_days folder</h2> <div class="outline-text-2" id="text-org23d98e4"> <div class="org-src-container"> <pre class="src src-bash">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 </pre> </div> </div> </div> <div id="outline-container-org86657ca" class="outline-2"> <h2 id="org86657ca"><code>nas</code> - Interact with the NAS</h2> <div class="outline-text-2" id="text-org86657ca"> <p> As an alternative, <code>sshfs</code> can be used: </p> <div class="org-src-container"> <pre class="src src-bash">sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS </pre> </div> <div class="org-src-container"> <pre class="src src-bash">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 </pre> </div> </div> </div> <div id="outline-container-org626d308" class="outline-2"> <h2 id="org626d308"><code>torrent-add</code> - Download Torrent</h2> <div class="outline-text-2" id="text-org626d308"> <div class="org-src-container"> <pre class="src src-bash">transmission-remote ***REMOVED***:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \ dunstify 'Torrent' 'Successfully added' || \ dunstify 'Torrent' 'Error' </pre> </div> </div> </div> </div> <div id="postamble" class="status"> <p class="author">Author: Dehaeze Thomas</p> <p class="date">Created: 2020-05-26 mar. 08:39</p> </div> </body> </html>