252 lines
21 KiB
HTML
252 lines
21 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>
|
|
<!-- 2021-11-03 mer. 10:59 -->
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
<title>My own specific binaries</title>
|
|
<meta name="author" content="Dehaeze Thomas" />
|
|
<meta name="generator" content="Org Mode" />
|
|
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
|
|
<script type="text/javascript" src="./dist/script.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" class="content">
|
|
<h1 class="title">My own specific binaries</h1>
|
|
<div id="table-of-contents" role="doc-toc">
|
|
<h2>Table of Contents</h2>
|
|
<div id="text-table-of-contents" role="doc-toc">
|
|
<ul>
|
|
<li><a href="#remote-desktop"><code>remote-desktop</code> - Remote Desktop Connect</a></li>
|
|
<li><a href="#orgd5ee6e7"><code>mount-dir</code> - Mount/Unmout directories</a></li>
|
|
<li><a href="#screen-select"><code>screen-select</code> - Xrandr pre-defined scripts</a></li>
|
|
<li><a href="#print-rnice"><code>print-rnice</code> - Print on Rnice</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="#color-picker"><code>color-picker</code> - Pick color and copy to clipboard</a></li>
|
|
<li><a href="#readbib"><code>readbib</code> - Open Bibliography File</a></li>
|
|
<li><a href="#readnotes"><code>readnotes</code> - Open Note</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<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">
|
|
<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\nPCDEHAEZE\nPCNASS1'</span> | rofi -dmenu -no-custom -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>
|
|
PCDEHAEZE)
|
|
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> esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:PCDEHAEZE.esrf.fr > /tmp/freerdp_pcdehaeze.log <span class="org-highlight-numbers-number">2</span>>&<span class="org-highlight-numbers-number">1</span> &
|
|
;;
|
|
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> esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:PCNASS1.esrf.fr > /tmp/freerdp_pcnass1.log <span class="org-highlight-numbers-number">2</span>>&<span class="org-highlight-numbers-number">1</span> &
|
|
;;
|
|
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> esrf.fr/dehaeze | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:rnice.esrf.fr > /tmp/freerdp_rnice.log <span class="org-highlight-numbers-number">2</span>>&<span class="org-highlight-numbers-number">1</span> &
|
|
;;
|
|
*)
|
|
<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-orgd5ee6e7" class="outline-2">
|
|
<h2 id="orgd5ee6e7"><code>mount-dir</code> - Mount/Unmout directories</h2>
|
|
<div class="outline-text-2" id="text-orgd5ee6e7">
|
|
<div class="org-src-container">
|
|
<pre class="src src-text"># <file system> <mount point> <type> <options> <dump> <pass>
|
|
homelab:/srv/storage/ /home/thomas/mnt/NAS fuse.sshfs noauto,allow_other,default_permissions 0 0
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-text"># <file system> <mount point> <type> <options> <dump> <pass>
|
|
dehaeze@rnice:/tmp_14_days/ /home/thomas/mnt/ESRF fuse.sshfs noauto,allow_other,default_permissions 0 0
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-variable-name">drive</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'ESRF\nNAS'</span> | rofi -dmenu -no-custom -p <span class="org-string">'Drive:'</span> -l <span class="org-highlight-numbers-number">20</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
|
|
|
<span class="org-keyword">if</span> <span class="org-type">grep</span> -qs <span class="org-string">"/home/thomas/mnt/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">drive</span></span><span class="org-string">"</span> /proc/mounts; <span class="org-keyword">then</span>
|
|
umount <span class="org-string">"/home/thomas/mnt/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">drive</span></span><span class="org-string">"</span> && <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</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">drive</span></span><span class="org-string"> "</span> <span class="org-string">'Successfully unmounted'</span> || <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">drive</span></span><span class="org-string"> "</span> <span class="org-string">'Error while unmounted'</span>
|
|
<span class="org-keyword">else</span>
|
|
<span class="org-type">echo</span> <span class="org-string">"It's not mounted."</span>
|
|
mount <span class="org-string">"/home/thomas/mnt/</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">drive</span></span><span class="org-string">"</span> && <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</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">drive</span></span><span class="org-string"> "</span> <span class="org-string">'Successfully mounted'</span> || <span class="org-sh-escaped-newline">\</span>
|
|
dunstify --replace=<span class="org-highlight-numbers-number">58249</span> --urgency=critical <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">drive</span></span><span class="org-string"> "</span> <span class="org-string">'Error while mounted'</span>
|
|
<span class="org-keyword">fi</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<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">
|
|
<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-function-name">after_screen_change</span> <span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Fix background if screen size/arangement has changed.</span>
|
|
setbg
|
|
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Kill polybar</span>
|
|
killall -q polybar
|
|
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Wait until the processes have been shut down</span>
|
|
<span class="org-keyword">while</span> <span class="org-type">pgrep</span> -u $<span class="org-variable-name">UID</span> -x polybar >/dev/null; <span class="org-keyword">do</span> <span class="org-type">sleep</span> <span class="org-highlight-numbers-number">1</span>; <span class="org-keyword">done</span>
|
|
|
|
<span class="org-comment-delimiter"># </span><span class="org-comment">Launch bars</span>
|
|
polybar top &
|
|
<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 DP2 --off --output DP2-1 --off --output VIRTUAL1 --off --output DP2-2 --primary --mode 2560x1440 --pos 0x0 --rotate normal && <span class="org-sh-escaped-newline">\</span>
|
|
after_screen_change
|
|
;;
|
|
<span class="org-string">"XPS"</span>)
|
|
xrandr --output DP1 --off --output DP2 --off --output DP2-1 --off --output VIRTUAL1 --off --output DP2-2 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal && <span class="org-sh-escaped-newline">\</span>
|
|
after_screen_change
|
|
;;
|
|
<span class="org-string">"Home"</span>)
|
|
xrandr --output eDP1 --off --output DP1 --off --output DP2 --off --output DP2-2 --off --output VIRTUAL1 --off --output DP2-1 --primary --mode 2560x1440 --pos 0x0 --rotate normal && <span class="org-sh-escaped-newline">\</span>
|
|
after_screen_change
|
|
;;
|
|
*)
|
|
<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>
|
|
|
|
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">0</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<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">
|
|
<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> | rofi -dmenu -no-custom -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> | rofi -dmenu -no-custom -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> | rofi -dmenu -no-custom -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"> esrf.fr/dehaeze | sed -n 1p)</span></span><span class="org-string">"</span> scp $<span class="org-highlight-numbers-number">1</span> dehaeze@rnice:/home/esrf/dehaeze/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"> 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 ctb127c1w \"/home/esrf/dehaeze/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-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">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash">transmission-remote <<get-password<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">passname</span>=<span class="org-string">"ip/homelab"</span><span class="org-rainbow-delimiters-depth-1">)</span>>>: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-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>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<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">
|
|
<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-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">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash">xcolor | tr -d <span class="org-string">'\n'</span> | xsel -b
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-readbib" class="outline-2">
|
|
<h2 id="readbib"><code>readbib</code> - Open Bibliography File</h2>
|
|
<div class="outline-text-2" id="text-readbib">
|
|
<p>
|
|
List all <code>pdf</code> files and open selected one with zathura.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-type">cd</span> ~/Cloud/pdfs/ && <span class="org-type">ls</span> | rofi -dmenu -lines <span class="org-highlight-numbers-number">20</span> | xargs -I <span class="org-rainbow-delimiters-depth-1">{}</span> zathura <span class="org-rainbow-delimiters-depth-1">{}</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-readnotes" class="outline-2">
|
|
<h2 id="readnotes"><code>readnotes</code> - Open Note</h2>
|
|
<div class="outline-text-2" id="text-readnotes">
|
|
<p>
|
|
List all <code>pdf</code> files and open selected one with zathura.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-type">cd</span> ~/Cloud/brain/pdfs/ && <span class="org-type">ls</span> *.pdf | rofi -dmenu -lines <span class="org-highlight-numbers-number">20</span> | xargs -I <span class="org-rainbow-delimiters-depth-1">{}</span> zathura <span class="org-rainbow-delimiters-depth-1">{}</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="postamble" class="status">
|
|
<p class="author">Author: Dehaeze Thomas</p>
|
|
<p class="date">Created: 2021-11-03 mer. 10:59</p>
|
|
</div>
|
|
</body>
|
|
</html>
|