242 lines
20 KiB
HTML
242 lines
20 KiB
HTML
<?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-11-03 mar. 16:26 -->
|
|
<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>
|
|
<li><a href="#org35e44f2"><code>note-extract-fig</code> - Extract Figure from note file</a></li>
|
|
<li><a href="#org5c51513"><code>share</code> - Share file with self-hosted <code>transfer.sh</code></a></li>
|
|
<li><a href="#org8406a5d"><code>screen-select</code> - Xrandr pre-defined scripts</a></li>
|
|
<li><a href="#orge197761"><code>color-picker</code> - Pick color and copy to clipboard</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"><span class="org-variable-name">computer</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'RNICE\nPCMEL1\nPCNASS1\nPCMEG01'</span> | dmenu -p <span class="org-string">'Computer:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
|
|
|
dunstify --replace=<span class="org-highlight-numbers-number">89891</span> <span class="org-string">'Rdesktop'</span> <span class="org-string">"Connection to </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{computer}</span></span><span class="org-string">..."</span>
|
|
|
|
<span class="org-keyword">case</span> $<span class="org-variable-name">computer</span><span class="org-keyword"> in</span>
|
|
PCMEL1)
|
|
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:PCMEL1.esrf.fr;
|
|
;;
|
|
PCMEG01)
|
|
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:PCMEG01.esrf.fr;
|
|
;;
|
|
PCNASS1)
|
|
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:PCNASS1.esrf.fr;
|
|
;;
|
|
RNICE)
|
|
xfreerdp /u:dehaeze /d:ESRF /clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> ssl.esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:rnice.esrf.fr;
|
|
;;
|
|
*)
|
|
<span class="org-type">echo</span> <span class="org-string">"Not existing"</span> && <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">89891</span> --urgency=critical <span class="org-string">'Rdesktop'</span> <span class="org-string">"No config for </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">computer</span></span><span class="org-string">"</span>;
|
|
;;
|
|
<span class="org-keyword">esac</span>
|
|
</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"><span class="org-variable-name">nbpage</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'1\n2\n4'</span> | dmenu -p <span class="org-string">'Number of pages per sheet'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
|
<span class="org-variable-name">sides</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge'</span> | dmenu -p <span class="org-string">'Two Sided:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
|
<span class="org-variable-name">media</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'A4\nA3'</span> | dmenu -p <span class="org-string">'Size:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
|
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">First copy the file to Rnice</span>
|
|
<span class="org-keyword">if</span> sshpass -p <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">pass</span><span class="org-string"><span class="org-sh-quoted-exec"> ssl.esrf.fr/dehaeze | sed -n 1p)</span></span><span class="org-string">"</span> scp $<span class="org-highlight-numbers-number">1</span> dehaeze@rnice:~/Downloads/; <span class="org-keyword">then</span>
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Then print on Rnice</span>
|
|
sshpass -p <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">pass</span><span class="org-string"><span class="org-sh-quoted-exec"> ssl.esrf.fr/dehaeze | sed -n 1p)</span></span><span class="org-string">"</span> ssh dehaeze@rnice <span class="org-string">"lpr -o media=</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">media</span></span><span class="org-string"> -o sides=</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">sides</span></span><span class="org-string"> -o number-up=</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">nbpage</span></span><span class="org-string"> -P ctb110c1u ~/Downloads/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>;
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Finally, delete the file</span>
|
|
<span class="org-keyword">else</span>
|
|
<span class="org-type">echo</span> <span class="org-string">"Command Failed"</span>
|
|
<span class="org-keyword">fi</span>
|
|
</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"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-highlight-numbers-number">1</span> == <span class="org-string">"mount"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
<span class="org-keyword">if</span> sshfs -o allow_other,default_permissions -p <span class="org-highlight-numbers-number">5022</span> dehaeze@firewall.esrf.fr:/tmp_14_days/ ~/mnt/ESRF; <span class="org-keyword">then</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> <span class="org-string">'ESRF TMP '</span> <span class="org-string">'Successfully mounted'</span>
|
|
<span class="org-keyword">else</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">'ESRF TMP '</span> <span class="org-string">'Error while mounted'</span>
|
|
<span class="org-keyword">fi</span>
|
|
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-highlight-numbers-number">1</span> == <span class="org-string">"umount"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
<span class="org-keyword">if</span> umount /home/thomas/mnt/ESRF/; <span class="org-keyword">then</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> <span class="org-string">'ESRF TMP '</span> <span class="org-string">'Successfully unmounted'</span>
|
|
<span class="org-keyword">else</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">'ESRF TMP '</span> <span class="org-string">'Error while unmounted'</span>
|
|
<span class="org-keyword">fi</span>
|
|
<span class="org-keyword">fi</span>
|
|
</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"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-highlight-numbers-number">1</span> == <span class="org-string">"mount"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
<span class="org-keyword">if</span> mount /home/thomas/mnt/NAS/; <span class="org-keyword">then</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> <span class="org-string">'NAS '</span> <span class="org-string">'Successfully mounted'</span>
|
|
<span class="org-keyword">else</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">'NAS '</span> <span class="org-string">'Error while mounted'</span>
|
|
<span class="org-keyword">fi</span>
|
|
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-highlight-numbers-number">1</span> == <span class="org-string">"umount"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
<span class="org-keyword">if</span> umount /home/thomas/mnt/NAS/; <span class="org-keyword">then</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> <span class="org-string">'NAS '</span> <span class="org-string">'Successfully unmounted'</span>
|
|
<span class="org-keyword">else</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">'NAS '</span> <span class="org-string">'Error while unmounted'</span>
|
|
<span class="org-keyword">fi</span>
|
|
<span class="org-keyword">fi</span>
|
|
</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 82.64.103.2:9091 --auth tdehaeze:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> nas/transmission | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> -a $<span class="org-highlight-numbers-number">1</span> && <span class="org-sh-escaped-newline">\</span>
|
|
dunstify <span class="org-string">'Torrent'</span> <span class="org-string">'Successfully added'</span> || <span class="org-sh-escaped-newline">\</span>
|
|
dunstify <span class="org-string">'Torrent'</span> <span class="org-string">'Error'</span>
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org35e44f2" class="outline-2">
|
|
<h2 id="org35e44f2"><code>note-extract-fig</code> - Extract Figure from note file</h2>
|
|
<div class="outline-text-2" id="text-org35e44f2">
|
|
<p>
|
|
Script used to convert a figure drawn on my Boox note2 to a png file that can then be imported into a document.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">First check that the first argument is a pdf file</span>
|
|
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f $<span class="org-highlight-numbers-number">1</span> && $<span class="org-highlight-numbers-number">1</span> == *.pdf <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
<span class="org-variable-name">pngfile</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> $<span class="org-highlight-numbers-number">1</span> | cut -f <span class="org-highlight-numbers-number">1</span> -d <span class="org-string">'.'</span> | sed <span class="org-string">'s/$/.png/'</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
|
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Convert to png and crop png</span>
|
|
pdf2png $<span class="org-highlight-numbers-number">1</span> && convert -trim <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">pngfile</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">pngfile</span></span><span class="org-string">"</span>
|
|
<span class="org-keyword">fi</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org5c51513" class="outline-2">
|
|
<h2 id="org5c51513"><code>share</code> - Share file with self-hosted <code>transfer.sh</code></h2>
|
|
<div class="outline-text-2" id="text-org5c51513">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
|
|
tmux split -v -l <span class="org-highlight-numbers-number">1</span> <span class="org-string">"</span><span class="org-type"><span class="org-string">curl</span></span><span class="org-string"> --progress-bar -F\"file=@</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">\" https://file.tdehaeze.xyz/ | xsel -ib && dunstify 'Upload' 'Successful' || dunstify --urgency=critical 'Upload' 'Failed';"</span> && tmux select-pane -U
|
|
<span class="org-keyword">else</span>
|
|
<span class="org-type">curl</span> --progress-bar -F<span class="org-string">"file=@</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> https://file.tdehaeze.xyz/ | xsel -ib && <span class="org-sh-escaped-newline">\</span>
|
|
dunstify <span class="org-string">'Upload'</span> <span class="org-string">'Successful'</span> || <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --urgency=critical <span class="org-string">'Upload'</span> <span class="org-string">'Failed'</span>
|
|
<span class="org-keyword">fi</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org8406a5d" class="outline-2">
|
|
<h2 id="org8406a5d"><code>screen-select</code> - Xrandr pre-defined scripts</h2>
|
|
<div class="outline-text-2" id="text-org8406a5d">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-variable-name">option</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">"Work\nXPS\nHome"</span> | rofi -i -dmenu<span class="org-rainbow-delimiters-depth-1">)</span>
|
|
|
|
<span class="org-keyword">case</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">option</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
|
|
<span class="org-string">"Work"</span>)
|
|
xrandr --output eDP1 --off --output DP1 --off --output DP1-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
|
;;
|
|
<span class="org-string">"XPS"</span>)
|
|
xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output DP1-1 --off --output DP1-2 --off --output DP2 --off --output VIRTUAL1 --off
|
|
;;
|
|
<span class="org-string">"Home"</span>)
|
|
xrandr --output eDP1 --off --output DP1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP2 --off --output VIRTUAL1 --off
|
|
;;
|
|
*)
|
|
<span class="org-type">echo</span> <span class="org-string">"== ! missing or invalid argument ! =="</span>
|
|
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">2</span>
|
|
<span class="org-keyword">esac</span>
|
|
|
|
setbg <span class="org-comment-delimiter"># </span><span class="org-comment">Fix background if screen size/arangement has changed.</span>
|
|
$<span class="org-variable-name">HOME</span>/.config/polybar/scripts/launch.sh <span class="org-comment-delimiter"># </span><span class="org-comment">restart polybar</span>
|
|
|
|
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">0</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orge197761" class="outline-2">
|
|
<h2 id="orge197761"><code>color-picker</code> - Pick color and copy to clipboard</h2>
|
|
<div class="outline-text-2" id="text-orge197761">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash">xcolor | xsel -b
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="postamble" class="status">
|
|
<p class="author">Author: Dehaeze Thomas</p>
|
|
<p class="date">Created: 2020-11-03 mar. 16:26</p>
|
|
</div>
|
|
</body>
|
|
</html>
|