literate-dotfiles/docs/binaries-private.html

248 lines
20 KiB
HTML
Raw Normal View History

2020-05-26 08:40:15 +02:00
<?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>
2021-01-01 20:12:34 +01:00
<!-- 2021-01-01 ven. 20:08 -->
2020-05-26 08:40:15 +02:00
<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" />
2021-01-01 20:12:34 +01:00
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
2020-05-26 08:40:15 +02:00
</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>
2021-01-01 20:12:34 +01:00
<li><a href="#remote-desktop"><code>remote-desktop</code> - Remote Desktop Connect</a></li>
<li><a href="#print-rnice"><code>print-rnice</code> - Print on Rnice</a></li>
<li><a href="#tmp14"><code>tmp14</code> - Mount/Umount tmp_14_days folder</a></li>
<li><a href="#nas"><code>nas</code> - Interact with the NAS</a></li>
<li><a href="#torrent-add"><code>torrent-add</code> - Download Torrent</a></li>
<li><a href="#dl-add"><code>dl-add</code> - Direct Download with Aria2</a></li>
<li><a href="#note-extract-fig"><code>note-extract-fig</code> - Extract Figure from note file</a></li>
<li><a href="#share"><code>share</code> - Share file with self-hosted <code>transfer.sh</code></a></li>
<li><a href="#screen-select"><code>screen-select</code> - Xrandr pre-defined scripts</a></li>
<li><a href="#color-picker"><code>color-picker</code> - Pick color and copy to clipboard</a></li>
2020-05-26 08:40:15 +02:00
</ul>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-remote-desktop" class="outline-2">
<h2 id="remote-desktop"><code>remote-desktop</code> - Remote Desktop Connect</h2>
<div class="outline-text-2" id="text-remote-desktop">
2020-05-26 08:40:15 +02:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<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>;
2020-05-26 08:40:15 +02:00
2020-11-03 16:27:09 +01:00
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>
2020-05-26 08:40:15 +02:00
PCMEL1)
2020-11-03 16:27:09 +01:00
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;
2020-05-26 08:40:15 +02:00
;;
PCMEG01)
2020-11-03 16:27:09 +01:00
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;
2020-05-26 08:40:15 +02:00
;;
PCNASS1)
2020-11-03 16:27:09 +01:00
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;
2020-05-26 08:40:15 +02:00
;;
RNICE)
2020-11-03 16:27:09 +01:00
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;
2020-05-26 08:40:15 +02:00
;;
*)
2020-11-03 16:27:09 +01:00
<span class="org-type">echo</span> <span class="org-string">"Not existing"</span> &amp;&amp; <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>;
2020-05-26 08:40:15 +02:00
;;
2020-11-03 16:27:09 +01:00
<span class="org-keyword">esac</span>
2020-05-26 08:40:15 +02:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-print-rnice" class="outline-2">
<h2 id="print-rnice"><code>print-rnice</code> - Print on Rnice</h2>
<div class="outline-text-2" id="text-print-rnice">
2020-05-26 08:40:15 +02:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<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>
2020-05-26 08:40:15 +02:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-tmp14" class="outline-2">
<h2 id="tmp14"><code>tmp14</code> - Mount/Umount tmp_14_days folder</h2>
<div class="outline-text-2" id="text-tmp14">
2020-05-26 08:40:15 +02:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<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 &#62003;'</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 &#62003;'</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 &#62003;'</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 &#62003;'</span> <span class="org-string">'Error while unmounted'</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
2020-05-26 08:40:15 +02:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-nas" class="outline-2">
<h2 id="nas"><code>nas</code> - Interact with the NAS</h2>
<div class="outline-text-2" id="text-nas">
2020-05-26 08:40:15 +02:00
<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">
2020-11-03 16:27:09 +01:00
<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 &#62003;'</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 &#62003;'</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 &#62003;'</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 &#62003;'</span> <span class="org-string">'Error while unmounted'</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
2020-05-26 08:40:15 +02:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-torrent-add" class="outline-2">
<h2 id="torrent-add"><code>torrent-add</code> - Download Torrent</h2>
<div class="outline-text-2" id="text-torrent-add">
2020-05-26 08:40:15 +02:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-bash">transmission-remote ***REMOVED***: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> &amp;&amp; <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>
2021-01-01 20:12:34 +01:00
</pre>
</div>
</div>
</div>
2020-11-03 16:27:09 +01:00
2021-01-01 20:12:34 +01:00
<div id="outline-container-dl-add" class="outline-2">
<h2 id="dl-add"><code>dl-add</code> - Direct Download with Aria2</h2>
<div class="outline-text-2" id="text-dl-add">
<div class="org-src-container">
<pre class="src src-bash">aria2p --port <span class="org-highlight-numbers-number">6800</span> --host http://dl.tdehaeze.xyz --secret $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> dl.tdehaeze.xyz/tdehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> add $<span class="org-highlight-numbers-number">1</span>
2020-11-03 16:27:09 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-note-extract-fig" class="outline-2">
<h2 id="note-extract-fig"><code>note-extract-fig</code> - Extract Figure from note file</h2>
<div class="outline-text-2" id="text-note-extract-fig">
2020-11-03 16:27:09 +01:00
<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> &amp;&amp; $<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> &amp;&amp; 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>
2021-01-01 20:12:34 +01:00
<div id="outline-container-share" class="outline-2">
<h2 id="share"><code>share</code> - Share file with self-hosted <code>transfer.sh</code></h2>
<div class="outline-text-2" id="text-share">
2020-11-03 16:27:09 +01:00
<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 &amp;&amp; dunstify 'Upload' 'Successful' || dunstify --urgency=critical 'Upload' 'Failed';"</span> &amp;&amp; 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 &amp;&amp; <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>
2021-01-01 20:12:34 +01:00
<div id="outline-container-screen-select" class="outline-2">
<h2 id="screen-select"><code>screen-select</code> - Xrandr pre-defined scripts</h2>
<div class="outline-text-2" id="text-screen-select">
2020-11-03 16:27:09 +01:00
<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>
2020-05-26 08:40:15 +02:00
2020-11-03 16:27:09 +01:00
<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>)
2021-01-01 20:12:34 +01:00
xrandr --output eDP1 --off --output DP2-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DP1 --off --output VIRTUAL1 --off
2020-11-03 16:27:09 +01:00
;;
*)
<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>
2021-01-01 20:12:34 +01:00
setbg &amp;&amp; <span class="org-string">\ </span> <span class="org-comment-delimiter"># </span><span class="org-comment">Fix background if screen size/arangement has changed.</span>
polybar-msg cmd restart <span class="org-comment-delimiter"># </span><span class="org-comment">restart polybar</span>
2020-11-03 16:27:09 +01:00
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">0</span>
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-color-picker" class="outline-2">
<h2 id="color-picker"><code>color-picker</code> - Pick color and copy to clipboard</h2>
<div class="outline-text-2" id="text-color-picker">
2020-11-03 16:27:09 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-bash">xcolor | tr -d <span class="org-string">'\n'</span> | xsel -b
2020-05-26 08:40:15 +02:00
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2021-01-01 20:12:34 +01:00
<p class="date">Created: 2021-01-01 ven. 20:08</p>
2020-05-26 08:40:15 +02:00
</div>
</body>
</html>