literate-dotfiles/docs/binaries-private.html
2022-05-09 10:05:23 +02:00

353 lines
32 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>
<!-- 2022-05-09 lun. 10:04 -->
<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="#phonebook"><code>phonebook</code> ESRF phone-book</a></li>
<li><a href="#contacts"><code>contacts</code> Personnal phone-book</a></li>
<li><a href="#qutebrowser"><code>qutebrowser</code></a></li>
<li><a href="#remote-home"><code>remote-home</code> - Remote Desktop to Home PC</a></li>
<li><a href="#remote-desktop"><code>remote-desktop</code> - Remote Desktop Connect</a></li>
<li><a href="#orgbac0a18"><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-esrf"><code>print-esrf</code> - Print on Rnice</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>
<li><a href="#orgad4e28d"><code>qrdecode</code> - Decode QRcode by taking screenshot</a></li>
</ul>
</div>
</div>
<div id="outline-container-phonebook" class="outline-2">
<h2 id="phonebook"><code>phonebook</code> ESRF phone-book</h2>
<div class="outline-text-2" id="text-phonebook">
<p>
The phone-list is taken from <code>scp opid21@lid21nano:/mnt/multipath-shares/sware/pub/phonelist/share/annuaire.txt /home/thomas/.local/data/annuaire.txt</code>
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-type">cat</span> ~/.local/data/annuaire.txt | fzf --header=<span class="org-string">"NAME Phone Box department roomNumber description mail"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash">$<span class="org-variable-name">TERMINAL</span> --title esrf-phonebook -e phonebook
</pre>
</div>
</div>
</div>
<div id="outline-container-contacts" class="outline-2">
<h2 id="contacts"><code>contacts</code> Personnal phone-book</h2>
<div class="outline-text-2" id="text-contacts">
<div class="org-src-container">
<pre class="src src-bash">khard | fzf --header=<span class="org-string">"Index Name Phone E-Mail"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash">$<span class="org-variable-name">TERMINAL</span> --title esrf-phonebook -e contacts
</pre>
</div>
</div>
</div>
<div id="outline-container-qutebrowser" class="outline-2">
<h2 id="qutebrowser"><code>qutebrowser</code></h2>
<div class="outline-text-2" id="text-qutebrowser">
<div class="org-src-container">
<pre class="src src-bash">~/.local/soft/qutebrowser/.venv/bin/python3 -m qutebrowser <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-remote-home" class="outline-2">
<h2 id="remote-home"><code>remote-home</code> - Remote Desktop to Home PC</h2>
<div class="outline-text-2" id="text-remote-home">
<div class="org-src-container">
<pre class="src src-bash">notify-send <span class="org-string">'Rdesktop'</span> <span class="org-string">"Connection to Home PC..."</span>
<span class="org-variable-name">common_arg</span>=<span class="org-string">"/clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /wm-class:RDP_PC /grab-keyboard /cert:ignore"</span>
xfreerdp $<span class="org-variable-name">common_arg</span> /u:thomas /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> home_pc/thomas | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:192.168.1.72 &gt; /tmp/freerdp_home_pc.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp;
</pre>
</div>
</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">'WID21SPEEDGOAT1\nWBM23SPEEDGOAT1\nWID24SPEEDGOAT1\nPCMEL1\nRNICE\nPCDEHAEZE\nLAPPAMU1\nPCNASS1\nDesktop-W10'</span> | rofi -i -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>;
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z <span class="org-string">"</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-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</span>
notify-send <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-variable-name">proxy_arg</span>=<span class="org-string">""</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</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">computer</span></span><span class="org-string">"</span> = <span class="org-string">"Desktop-W10"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If connect to local PC</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> ping -c <span class="org-highlight-numbers-number">1</span> -t <span class="org-highlight-numbers-number">1</span> desktop-w10.lan &amp;&gt; /dev/null <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">And outside of local network, use proxy</span>
<span class="org-variable-name">proxy_arg</span>=<span class="org-string">"/proxy:socks5://localhost:8080"</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">timeout</span><span class="org-string"><span class="org-sh-quoted-exec"> 1s dig +short proxy.esrf.fr.)</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Outside the ESRF network</span>
<span class="org-variable-name">proxy_arg</span>=<span class="org-string">"/proxy:socks5://localhost:8081"</span>
<span class="org-keyword">fi</span>
<span class="org-variable-name">common_arg</span>=<span class="org-string">"/clipboard /bpp:8 /bpp:16 /compression -themes -wallpaper /async-update /async-input -glyph-cache /audio-mode:1 /dynamic-resolution /auto-reconnect /wm-class:RDP_</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"> /grab-keyboard /cert:ignore"</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">computer</span></span><span class="org-string">"</span><span class="org-keyword"> in</span>
<span class="org-string">"RNICE"</span> | <span class="org-string">"PCDEHAEZE"</span> | <span class="org-string">"PCNASS1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:dehaeze /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:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"PCMEL1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:OPPEL /p:TonicPEL /v:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"WID21SPEEDGOAT1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:opid21 /p:tonic21 /v:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"WBM23SPEEDGOAT1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:opd23 /p:tonic23 /v:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"WID24SPEEDGOAT1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:opid24 /p:tonic24 /v:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"LAPPAMU1"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:opid00 /p:tonic00 /v:$<span class="org-variable-name">computer</span>.esrf.fr &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-string">"Desktop-W10"</span>)
xfreerdp $<span class="org-variable-name">proxy_arg</span> $<span class="org-variable-name">common_arg</span> /d:ESRF /u:thomas /p:$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">pass</span> windows/Desktop-W10 | sed -n 1p<span class="org-rainbow-delimiters-depth-1">)</span> /v:192.168.1.72 &gt; /tmp/freerdp_$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">computer</span><span class="org-rainbow-delimiters-depth-1">}</span>.log <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span> &amp; ;;
<span class="org-keyword">esac</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbac0a18" class="outline-2">
<h2 id="orgbac0a18"><code>mount-dir</code> - Mount/Unmout directories</h2>
<div class="outline-text-2" id="text-orgbac0a18">
<div class="org-src-container">
<pre class="src src-text"># &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
homelab:/srv/storage/ /home/thomas/mnt/homelab fuse.sshfs noauto,allow_other,user,default_permissions 0 0
</pre>
</div>
<div class="org-src-container">
<pre class="src src-text"># &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
dehaeze@rnice:/tmp_14_days/ /home/thomas/mnt/tmp_14_days fuse.sshfs noauto,allow_other,user,default_permissions 0 0
</pre>
</div>
<div class="org-src-container">
<pre class="src src-text"># &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
dehaeze@rnice:/home/esrf/dehaeze/ /home/thomas/mnt/unix_home fuse.sshfs noauto,allow_other,user,default_permissions 0 0
</pre>
</div>
<div class="org-src-container">
<pre class="src src-text"># &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump&gt; &lt;pass&gt;
//wfiles/groupshare /home/thomas/mnt/groupshare vsifs noauto,user,credentials=/home/thomas/.smbcredentials,uid=1001,gid=1001,forceuid,forcegid 0 0
</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-variable-name">#</span> -eq <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<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">'monochromators\ntmp_14_days\nhomelab\ngroupshare\nunix_home\ndata_id21'</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-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z <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-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">drive</span>=$<span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</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> &amp;&amp; <span class="org-sh-escaped-newline">\</span>
notify-send <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"> &#62003;"</span> <span class="org-string">'Successfully unmounted'</span> || <span class="org-sh-escaped-newline">\</span>
notify-send --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"> &#62003;"</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> &amp;&amp; <span class="org-sh-escaped-newline">\</span>
notify-send <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"> &#62003;"</span> <span class="org-string">'Successfully mounted'</span> || <span class="org-sh-escaped-newline">\</span>
notify-send --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"> &#62003;"</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\nLaptop\nHome"</span> | rofi -dmenu -no-custom -p <span class="org-string">'Screen:'</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-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z <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-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</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 &gt;/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 &amp;
<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 eDP-1 --off --output DP-3-2 --primary --mode 2560x1440 --pos 0x0 --rotate normal &amp;&amp; <span class="org-sh-escaped-newline">\</span>
after_screen_change
;;
<span class="org-string">"Laptop"</span>)
xrandr --output DP-1-2 --off --output DP-3-2 --off --output eDP-1 --primary --mode 1920x1200 --pos 0x0 --rotate normal &amp;&amp; <span class="org-sh-escaped-newline">\</span>
after_screen_change
;;
<span class="org-string">"Home"</span>)
xrandr --output eDP-1 --off --output DP-3-2 --primary --mode 2560x1440 --pos 0x0 --rotate normal &amp;&amp; <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-esrf" class="outline-2">
<h2 id="print-esrf"><code>print-esrf</code> - Print on Rnice</h2>
<div class="outline-text-2" id="text-print-esrf">
<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-variable-name">printer</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">echo</span> -e <span class="org-string">'ctb127c1u\nctb110c1u'</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-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z <span class="org-string">"</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">"</span> || -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">side</span></span><span class="org-string">"</span> || -z <span class="org-string">"</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">"</span> || -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">printer</span></span><span class="org-string">"</span> <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-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</span>
lpr -o <span class="org-variable-name">media</span>=$<span class="org-variable-name">media</span> -o <span class="org-variable-name">sides</span>=$<span class="org-variable-name">sides</span> -o number-up=$<span class="org-variable-name">nbpage</span> -P $<span class="org-variable-name">printer</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">1</span></span><span class="org-string">"</span>;
</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/ &amp;&amp; <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/ &amp;&amp; <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 id="outline-container-orgad4e28d" class="outline-2">
<h2 id="orgad4e28d"><code>qrdecode</code> - Decode QRcode by taking screenshot</h2>
<div class="outline-text-2" id="text-orgad4e28d">
<ul class="org-ul">
<li><code>zbar-tools</code></li>
<li><code>main</code></li>
<li><code>xclip</code></li>
<li><code>notify-send</code></li>
</ul>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">image_file</span>=<span class="org-string">"/tmp/ocr.png"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Take screenshot by selecting the area</span>
maim -s <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">image_file</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Get the exit code of the previous command.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">So in this case, it is the screenshot command. If it did not exit with an</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">exit code 0, then it means the user canceled the process of taking a</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">screenshot by doing something like pressing the escape key</span>
<span class="org-variable-name">status</span>=$<span class="org-variable-name">?</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If the user pressed the escape key or did something to terminate the proccess</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">taking a screenshot, then just exit</span>
<span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">status</span> -ne <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Use zbarimg to decode the text from the QR code</span>
<span class="org-variable-name">decoded_text</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">zbarimg</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">image_file</span></span><span class="org-string">"</span> -q --raw<span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">decoded_text</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
notify-send <span class="org-string">"qrshot"</span> <span class="org-string">"no text was detected"</span>
<span class="org-type">rm</span> $<span class="org-variable-name">image_file</span> &amp;&amp; <span class="org-keyword">exit</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-keyword">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Copy text to clipboard</span>
<span class="org-builtin">printf</span> %b <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">decoded_text</span></span><span class="org-string">"</span> | xclip -selection clip
<span class="org-comment-delimiter"># </span><span class="org-comment">Let us know that something was decoded</span>
notify-send <span class="org-string">"qrshot"</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">decoded_text</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Cleaning up the trash that was left behind</span>
<span class="org-type">rm</span> $<span class="org-variable-name">image_file</span>
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2022-05-09 lun. 10:04</p>
</div>
</body>
</html>