the ugly ocaml monstrosity powering my site oppi.li
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

new post: OSC-52

Akshay 92a1fd5c 9828c78d

+301 -44
+18 -18
docs/index.html
··· 39 39 <tr> 40 40 <td class=table-post> 41 41 <div class="date"> 42 - 01/08 — 2024 42 + 28/11 — 2024 43 + </div> 44 + <a href="/posts/OSC-52" class="post-link"> 45 + <span class="post-link">OSC-52</span> 46 + </a> 47 + </td> 48 + <td class=table-stats> 49 + <span class="stats-number"> 50 + 1.9 51 + </span> 52 + <span class=stats-unit>min</span> 53 + </td> 54 + </tr> 55 + 56 + <tr> 57 + <td class=table-post> 58 + <div class="date"> 59 + 02/08 — 2024 43 60 </div> 44 61 <a href="/posts/introducing_tablespoon" class="post-link"> 45 62 <span class="post-link">Introducing Tablespoon</span> ··· 65 82 <td class=table-stats> 66 83 <span class="stats-number"> 67 84 2.1 68 - </span> 69 - <span class=stats-unit>min</span> 70 - </td> 71 - </tr> 72 - 73 - <tr> 74 - <td class=table-post> 75 - <div class="date"> 76 - 18/06 — 2023 77 - </div> 78 - <a href="/posts/plain_text_journaling" class="post-link"> 79 - <span class="post-link">Plain Text Journaling</span> 80 - </a> 81 - </td> 82 - <td class=table-stats> 83 - <span class="stats-number"> 84 - 8.9 85 85 </span> 86 86 <span class=stats-unit>min</span> 87 87 </td>
+53
docs/index.xml
··· 12 12 <language>en-us</language> 13 13 <copyright>Creative Commons BY-NC-SA 4.0</copyright> 14 14 <item> 15 + <title>OSC-52</title> 16 + <description>&lt;p&gt;I use &lt;code&gt;ssh&lt;/code&gt; a lot. Copying text from the remote machine to 17 + the host machine always sucked. But OSC-52 makes that easy.&lt;/p&gt; 18 + &lt;p&gt;OSC-52 is an ANSI escape sequence to write text to the terminal 19 + emulator. The terminal emulator, if it understands what is going on, 20 + will in turn write this text to the system clipboard.&lt;/p&gt; 21 + &lt;p&gt;What this means is some &lt;code&gt;printf&lt;/code&gt; magic can send text to 22 + your clipboard. I store this one-liner in a script called 23 + &lt;code&gt;oclip&lt;/code&gt;:&lt;/p&gt; 24 + &lt;div class="sourceCode" id="cb1"&gt;&lt;pre 25 + class="sourceCode bash"&gt;&lt;code class="sourceCode bash"&gt;&lt;span id="cb1-1"&gt;&lt;a href="#cb1-1" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;span class="bu"&gt;printf&lt;/span&gt; &lt;span class="st"&gt;&amp;quot;\033]52;c;%s\007&amp;quot;&lt;/span&gt; &lt;span class="st"&gt;&amp;quot;&lt;/span&gt;&lt;span class="va"&gt;$(&lt;/span&gt;&lt;span class="fu"&gt;base64&lt;/span&gt; &lt;span class="op"&gt;&amp;lt;&amp;amp;&lt;/span&gt;&lt;span class="dv"&gt;0&lt;/span&gt;&lt;span class="va"&gt;)&lt;/span&gt;&lt;span class="st"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; 26 + &lt;p&gt;and I run it with:&lt;/p&gt; 27 + &lt;div class="sourceCode" id="cb2"&gt;&lt;pre 28 + class="sourceCode bash"&gt;&lt;code class="sourceCode bash"&gt;&lt;span id="cb2-1"&gt;&lt;a href="#cb2-1" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;span class="ex"&gt;remote&lt;/span&gt; $ cat some_file.txt &lt;span class="kw"&gt;|&lt;/span&gt; &lt;span class="ex"&gt;oclip&lt;/span&gt;&lt;/span&gt; 29 + &lt;span id="cb2-2"&gt;&lt;a href="#cb2-2" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;/span&gt; 30 + &lt;span id="cb2-3"&gt;&lt;a href="#cb2-3" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;span class="co"&gt;# some_file.txt&amp;#39;s contents are now the host&amp;#39;s clipboard&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; 31 + &lt;h3 id="the-catch"&gt;The catch&lt;/h3&gt; 32 + &lt;p&gt;Your terminal emulator must support OSC-52, &lt;code&gt;alacritty&lt;/code&gt; 33 + and &lt;code&gt;termux&lt;/code&gt; seem to support this out of the box. In 34 + &lt;code&gt;st&lt;/code&gt;, OSC-52 works with this change to 35 + &lt;code&gt;config.h&lt;/code&gt;:&lt;/p&gt; 36 + &lt;pre&gt;&lt;code&gt;int allowwindowops = 1;&lt;/code&gt;&lt;/pre&gt; 37 + &lt;p&gt;If you are using &lt;code&gt;tmux&lt;/code&gt;, you need to flip this switch 38 + on:&lt;/p&gt; 39 + &lt;pre&gt;&lt;code&gt;set -s set-clipboard on&lt;/code&gt;&lt;/pre&gt; 40 + &lt;p&gt;If you are inside &lt;code&gt;nvim&lt;/code&gt;, it may work as expected as long 41 + as &lt;code&gt;$SSH_TTY&lt;/code&gt; is set. I sometimes physically start a session, 42 + and &lt;code&gt;ssh&lt;/code&gt; into the same session later from another machine, 43 + and &lt;code&gt;$SSH_TTY&lt;/code&gt; remains unset, so I force OSC-52 in 44 + &lt;code&gt;nvim&lt;/code&gt; at all times (see &lt;a 45 + href="https://neovim.io/doc/user/provider.html#clipboard-osc52"&gt;nvimdoc&lt;/a&gt;):&lt;/p&gt; 46 + &lt;div class="sourceCode" id="cb5"&gt;&lt;pre 47 + class="sourceCode lua"&gt;&lt;code class="sourceCode lua"&gt;&lt;span id="cb5-1"&gt;&lt;a href="#cb5-1" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;span class="va"&gt;vim&lt;/span&gt;&lt;span class="op"&gt;.&lt;/span&gt;&lt;span class="va"&gt;g&lt;/span&gt;&lt;span class="op"&gt;.&lt;/span&gt;&lt;span class="va"&gt;clipboard&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="op"&gt;{&lt;/span&gt;&lt;/span&gt; 48 + &lt;span id="cb5-2"&gt;&lt;a href="#cb5-2" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="va"&gt;name&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="st"&gt;&amp;#39;OSC 52&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;,&lt;/span&gt;&lt;/span&gt; 49 + &lt;span id="cb5-3"&gt;&lt;a href="#cb5-3" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="va"&gt;copy&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="op"&gt;{&lt;/span&gt;&lt;/span&gt; 50 + &lt;span id="cb5-4"&gt;&lt;a href="#cb5-4" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;[&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;+&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;]&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="fu"&gt;require&lt;/span&gt;&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;vim.ui.clipboard.osc52&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;).&lt;/span&gt;copy&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;+&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;),&lt;/span&gt;&lt;/span&gt; 51 + &lt;span id="cb5-5"&gt;&lt;a href="#cb5-5" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;[&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;]&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="fu"&gt;require&lt;/span&gt;&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;vim.ui.clipboard.osc52&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;).&lt;/span&gt;copy&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;),&lt;/span&gt;&lt;/span&gt; 52 + &lt;span id="cb5-6"&gt;&lt;a href="#cb5-6" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;},&lt;/span&gt;&lt;/span&gt; 53 + &lt;span id="cb5-7"&gt;&lt;a href="#cb5-7" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="va"&gt;paste&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="op"&gt;{&lt;/span&gt;&lt;/span&gt; 54 + &lt;span id="cb5-8"&gt;&lt;a href="#cb5-8" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;[&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;+&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;]&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="fu"&gt;require&lt;/span&gt;&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;vim.ui.clipboard.osc52&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;).&lt;/span&gt;paste&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;+&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;),&lt;/span&gt;&lt;/span&gt; 55 + &lt;span id="cb5-9"&gt;&lt;a href="#cb5-9" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;[&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;]&lt;/span&gt; &lt;span class="op"&gt;=&lt;/span&gt; &lt;span class="fu"&gt;require&lt;/span&gt;&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;vim.ui.clipboard.osc52&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;).&lt;/span&gt;paste&lt;span class="op"&gt;(&lt;/span&gt;&lt;span class="st"&gt;&amp;#39;*&amp;#39;&lt;/span&gt;&lt;span class="op"&gt;),&lt;/span&gt;&lt;/span&gt; 56 + &lt;span id="cb5-10"&gt;&lt;a href="#cb5-10" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt; &lt;span class="op"&gt;},&lt;/span&gt;&lt;/span&gt; 57 + &lt;span id="cb5-11"&gt;&lt;a href="#cb5-11" aria-hidden="true" tabindex="-1"&gt;&lt;/a&gt;&lt;span class="op"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; 58 + &lt;p&gt;If you are inside &lt;code&gt;nvim&lt;/code&gt; inside &lt;code&gt;tmux&lt;/code&gt; inside 59 + an &lt;code&gt;ssh&lt;/code&gt; session inside &lt;code&gt;st&lt;/code&gt;, you neeed all of the 60 + above tweaks. &lt;code&gt;nvim&lt;/code&gt; will pass the contents around to 61 + &lt;code&gt;tmux&lt;/code&gt;, which in turn will pass the contents to 62 + &lt;code&gt;st&lt;/code&gt;, which should pass it to your system clipboard.&lt;/p&gt;</description> 63 + <link>https://peppe.rs/posts/OSC-52/</link> 64 + <pubDate>Wed, 27 Nov 2024 22:56:00 +0000</pubDate> 65 + <guid>https://peppe.rs/posts/OSC-52/</guid> 66 + </item> 67 + <item> 15 68 <title>Introducing Tablespoon</title> 16 69 <description>&lt;p&gt;&lt;a href="https://git.peppe.rs/languages/tbsp"&gt;tbsp&lt;/a&gt; (tree-based 17 70 source-processing language) is an awk-like language that operates on
+119
docs/posts/OSC-52/index.html
··· 1 + <!DOCTYPE html> 2 + <html lang="en"> 3 + <head> 4 + <link rel="stylesheet" href="/style.css"> 5 + <link rel="stylesheet" href="/syntax.css"> 6 + <meta charset="UTF-8"> 7 + <meta name="viewport" content="initial-scale=1"> 8 + <meta content="#ffffff" name="theme-color"> 9 + <meta name="HandheldFriendly" content="true"> 10 + <meta property="og:title" content="OSC-52"> 11 + <meta property="og:type" content="website"> 12 + <meta property="og:description" content="a static site {for, by, about} me "> 13 + <meta property="og:url" content="https://peppe.rs"> 14 + <link rel="icon" type="image/x-icon" href="/favicon.png"> 15 + <title>OSC-52 · peppe.rs</title> 16 + <body> 17 + <div class="posts"> 18 + <div class="post"> 19 + <a href="/" class="post-end-link">Home</a> 20 + <span>/</span> 21 + <a href="/posts" class="post-end-link">Posts</a> 22 + <span>/</span> 23 + <a class="post-end-link">OSC-52</a> 24 + <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/OSC-52.md 25 + ">View Raw</a> 26 + <div class="separator"></div> 27 + <div class="date"> 28 + 28/11 — 2024 29 + <div class="stats"> 30 + <span class="stats-number"> 31 + 26.37 32 + </span> 33 + <span class="stats-unit">cm</span> 34 + &nbsp 35 + <span class="stats-number"> 36 + 1.9 37 + </span> 38 + <span class="stats-unit">min</span> 39 + </div> 40 + </div> 41 + <h1> 42 + OSC-52 43 + </h1> 44 + <div class="post-text"> 45 + <p>I use <code>ssh</code> a lot. Copying text from the remote machine to 46 + the host machine always sucked. But OSC-52 makes that easy.</p> 47 + <p>OSC-52 is an ANSI escape sequence to write text to the terminal 48 + emulator. The terminal emulator, if it understands what is going on, 49 + will in turn write this text to the system clipboard.</p> 50 + <p>What this means is some <code>printf</code> magic can send text to 51 + your clipboard. I store this one-liner in a script called 52 + <code>oclip</code>:</p> 53 + <div class="sourceCode" id="cb1"><pre 54 + class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="bu">printf</span> <span class="st">&quot;\033]52;c;%s\007&quot;</span> <span class="st">&quot;</span><span class="va">$(</span><span class="fu">base64</span> <span class="op">&lt;&amp;</span><span class="dv">0</span><span class="va">)</span><span class="st">&quot;</span></span></code></pre></div> 55 + <p>and I run it with:</p> 56 + <div class="sourceCode" id="cb2"><pre 57 + class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">remote</span> $ cat some_file.txt <span class="kw">|</span> <span class="ex">oclip</span></span> 58 + <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span> 59 + <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="co"># some_file.txt&#39;s contents are now the host&#39;s clipboard</span></span></code></pre></div> 60 + <h3 id="the-catch">The catch</h3> 61 + <p>Your terminal emulator must support OSC-52, <code>alacritty</code> 62 + and <code>termux</code> seem to support this out of the box. In 63 + <code>st</code>, OSC-52 works with this change to 64 + <code>config.h</code>:</p> 65 + <pre><code>int allowwindowops = 1;</code></pre> 66 + <p>If you are using <code>tmux</code>, you need to flip this switch 67 + on:</p> 68 + <pre><code>set -s set-clipboard on</code></pre> 69 + <p>If you are inside <code>nvim</code>, it may work as expected as long 70 + as <code>$SSH_TTY</code> is set. I sometimes physically start a session, 71 + and <code>ssh</code> into the same session later from another machine, 72 + and <code>$SSH_TTY</code> remains unset, so I force OSC-52 in 73 + <code>nvim</code> at all times (see <a 74 + href="https://neovim.io/doc/user/provider.html#clipboard-osc52">nvimdoc</a>):</p> 75 + <div class="sourceCode" id="cb5"><pre 76 + class="sourceCode lua"><code class="sourceCode lua"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="va">vim</span><span class="op">.</span><span class="va">g</span><span class="op">.</span><span class="va">clipboard</span> <span class="op">=</span> <span class="op">{</span></span> 77 + <span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="va">name</span> <span class="op">=</span> <span class="st">&#39;OSC 52&#39;</span><span class="op">,</span></span> 78 + <span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="va">copy</span> <span class="op">=</span> <span class="op">{</span></span> 79 + <span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span><span class="st">&#39;+&#39;</span><span class="op">]</span> <span class="op">=</span> <span class="fu">require</span><span class="op">(</span><span class="st">&#39;vim.ui.clipboard.osc52&#39;</span><span class="op">).</span>copy<span class="op">(</span><span class="st">&#39;+&#39;</span><span class="op">),</span></span> 80 + <span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span><span class="st">&#39;*&#39;</span><span class="op">]</span> <span class="op">=</span> <span class="fu">require</span><span class="op">(</span><span class="st">&#39;vim.ui.clipboard.osc52&#39;</span><span class="op">).</span>copy<span class="op">(</span><span class="st">&#39;*&#39;</span><span class="op">),</span></span> 81 + <span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="op">},</span></span> 82 + <span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="va">paste</span> <span class="op">=</span> <span class="op">{</span></span> 83 + <span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span><span class="st">&#39;+&#39;</span><span class="op">]</span> <span class="op">=</span> <span class="fu">require</span><span class="op">(</span><span class="st">&#39;vim.ui.clipboard.osc52&#39;</span><span class="op">).</span>paste<span class="op">(</span><span class="st">&#39;+&#39;</span><span class="op">),</span></span> 84 + <span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="op">[</span><span class="st">&#39;*&#39;</span><span class="op">]</span> <span class="op">=</span> <span class="fu">require</span><span class="op">(</span><span class="st">&#39;vim.ui.clipboard.osc52&#39;</span><span class="op">).</span>paste<span class="op">(</span><span class="st">&#39;*&#39;</span><span class="op">),</span></span> 85 + <span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> <span class="op">},</span></span> 86 + <span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div> 87 + <p>If you are inside <code>nvim</code> inside <code>tmux</code> inside 88 + an <code>ssh</code> session inside <code>st</code>, you neeed all of the 89 + above tweaks. <code>nvim</code> will pass the contents around to 90 + <code>tmux</code>, which in turn will pass the contents to 91 + <code>st</code>, which should pass it to your system clipboard.</p> 92 + 93 + </div> 94 + 95 + <div class="intro"> 96 + Hi. 97 + <div class="hot-links"> 98 + <a href="/index.xml" class="feed-button">Subscribe</a> 99 + </div> 100 + <p>I'm Akshay, programmer and pixel-artist. 101 + I write <a href="https://git.peppe.rs">open-source stuff</a>. 102 + I also design fonts: 103 + <a href="https://git.peppe.rs/fonts/scientifica/about">scientifica</a>, 104 + <a href="https://git.peppe.rs/fonts/curie/about">curie</a>. 105 + </p> 106 + <p>Reach out at oppili@irc.rizon.net.</p> 107 + </div> 108 + 109 + <a href="/" class="post-end-link">Home</a> 110 + <span>/</span> 111 + <a href="/posts" class="post-end-link">Posts</a> 112 + <span>/</span> 113 + <a class="post-end-link">OSC-52</a> 114 + <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/OSC-52.md 115 + ">View Raw</a> 116 + </div> 117 + </div> 118 + </body> 119 + </html>
+1 -1
docs/posts/auto-currying_rust_functions/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 08/05 — 2020 28 + 09/05 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 356.44
+1 -1
docs/posts/bash_harder_with_vim/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 30/07 — 2019 28 + 31/07 — 2019 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 24.38
+1 -1
docs/posts/call_to_ARMs/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 07/02 — 2020 28 + 08/02 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 33.57
+1 -1
docs/posts/color_conundrum/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 30/12 — 2019 28 + 31/12 — 2019 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 14.39
+1 -1
docs/posts/font_size_fallacies/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 16/03 — 2020 28 + 17/03 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 32.37
+30 -13
docs/posts/index.html
··· 27 27 <tr> 28 28 <td class=table-post> 29 29 <div class="date"> 30 - 01/08 — 2024 30 + 28/11 — 2024 31 + </div> 32 + <a href="/posts/OSC-52" class="post-link"> 33 + <span class="post-link">OSC-52</span> 34 + </a> 35 + </td> 36 + <td class=table-stats> 37 + <span class="stats-number"> 38 + 1.9 39 + </span> 40 + <span class=stats-unit>min</span> 41 + </td> 42 + </tr> 43 + 44 + <tr> 45 + <td class=table-post> 46 + <div class="date"> 47 + 02/08 — 2024 31 48 </div> 32 49 <a href="/posts/introducing_tablespoon" class="post-link"> 33 50 <span class="post-link">Introducing Tablespoon</span> ··· 61 78 <tr> 62 79 <td class=table-post> 63 80 <div class="date"> 64 - 18/06 — 2023 81 + 19/06 — 2023 65 82 </div> 66 83 <a href="/posts/plain_text_journaling" class="post-link"> 67 84 <span class="post-link">Plain Text Journaling</span> ··· 248 265 <tr> 249 266 <td class=table-post> 250 267 <div class="date"> 251 - 17/06 — 2020 268 + 18/06 — 2020 252 269 </div> 253 270 <a href="/posts/turing_complete_type_systems" class="post-link"> 254 271 <span class="post-link">Turing Complete Type Systems</span> ··· 265 282 <tr> 266 283 <td class=table-post> 267 284 <div class="date"> 268 - 08/05 — 2020 285 + 09/05 — 2020 269 286 </div> 270 287 <a href="/posts/auto-currying_rust_functions" class="post-link"> 271 288 <span class="post-link">Auto-currying Rust Functions</span> ··· 282 299 <tr> 283 300 <td class=table-post> 284 301 <div class="date"> 285 - 08/04 — 2020 302 + 09/04 — 2020 286 303 </div> 287 304 <a href="/posts/pixel_art_in_GIMP" class="post-link"> 288 305 <span class="post-link">Pixel Art In GIMP</span> ··· 299 316 <tr> 300 317 <td class=table-post> 301 318 <div class="date"> 302 - 31/03 — 2020 319 + 01/04 — 2020 303 320 </div> 304 321 <a href="/posts/rapid_refactoring_with_vim" class="post-link"> 305 322 <span class="post-link">Rapid Refactoring With Vim</span> ··· 316 333 <tr> 317 334 <td class=table-post> 318 335 <div class="date"> 319 - 16/03 — 2020 336 + 17/03 — 2020 320 337 </div> 321 338 <a href="/posts/font_size_fallacies" class="post-link"> 322 339 <span class="post-link">Font Size Fallacies</span> ··· 333 350 <tr> 334 351 <td class=table-post> 335 352 <div class="date"> 336 - 07/03 — 2020 353 + 08/03 — 2020 337 354 </div> 338 355 <a href="/posts/termux_tandem" class="post-link"> 339 356 <span class="post-link">Termux Tandem</span> ··· 350 367 <tr> 351 368 <td class=table-post> 352 369 <div class="date"> 353 - 07/02 — 2020 370 + 08/02 — 2020 354 371 </div> 355 372 <a href="/posts/call_to_ARMs" class="post-link"> 356 373 <span class="post-link">Call To ARMs</span> ··· 367 384 <tr> 368 385 <td class=table-post> 369 386 <div class="date"> 370 - 30/12 — 2019 387 + 31/12 — 2019 371 388 </div> 372 389 <a href="/posts/color_conundrum" class="post-link"> 373 390 <span class="post-link">Color Conundrum</span> ··· 384 401 <tr> 385 402 <td class=table-post> 386 403 <div class="date"> 387 - 22/11 — 2019 404 + 23/11 — 2019 388 405 </div> 389 406 <a href="/posts/static_sites_with_bash" class="post-link"> 390 407 <span class="post-link">Static Sites With Bash</span> ··· 401 418 <tr> 402 419 <td class=table-post> 403 420 <div class="date"> 404 - 06/11 — 2019 421 + 07/11 — 2019 405 422 </div> 406 423 <a href="/posts/my_setup" class="post-link"> 407 424 <span class="post-link">My Setup</span> ··· 469 486 <tr> 470 487 <td class=table-post> 471 488 <div class="date"> 472 - 30/07 — 2019 489 + 31/07 — 2019 473 490 </div> 474 491 <a href="/posts/bash_harder_with_vim" class="post-link"> 475 492 <span class="post-link">Bash Harder With Vim</span>
+1 -1
docs/posts/introducing_tablespoon/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 01/08 — 2024 28 + 02/08 — 2024 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 72.33
+1 -1
docs/posts/my_setup/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 06/11 — 2019 28 + 07/11 — 2019 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 10.39
+1 -1
docs/posts/pixel_art_in_GIMP/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 08/04 — 2020 28 + 09/04 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 55.54
+1 -1
docs/posts/plain_text_journaling/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 18/06 — 2023 28 + 19/06 — 2023 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 138.66
+1 -1
docs/posts/rapid_refactoring_with_vim/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 31/03 — 2020 28 + 01/04 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 79.12
+1 -1
docs/posts/static_sites_with_bash/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 22/11 — 2019 28 + 23/11 — 2019 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 21.18
+1 -1
docs/posts/termux_tandem/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 07/03 — 2020 28 + 08/03 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 19.18
+1 -1
docs/posts/turing_complete_type_systems/index.html
··· 25 25 ">View Raw</a> 26 26 <div class="separator"></div> 27 27 <div class="date"> 28 - 17/06 — 2020 28 + 18/06 — 2020 29 29 <div class="stats"> 30 30 <span class="stats-number"> 31 31 9.19
+66
posts/OSC-52.md
··· 1 + I use `ssh` a lot. Copying text from the remote machine to 2 + the host machine always sucked. But OSC-52 makes that easy. 3 + 4 + OSC-52 is an ANSI escape sequence to write text to the 5 + terminal emulator. The terminal emulator, if it understands 6 + what is going on, will in turn write this text to the system 7 + clipboard. 8 + 9 + What this means is some `printf` magic can send text to your 10 + clipboard. I store this one-liner in a script called 11 + `oclip`: 12 + 13 + ```bash 14 + printf "\033]52;c;%s\007" "$(base64 <&0)" 15 + ``` 16 + 17 + and I run it with: 18 + 19 + ```bash 20 + remote $ cat some_file.txt | oclip 21 + 22 + # some_file.txt's contents are now the host's clipboard 23 + ``` 24 + 25 + ### The catch 26 + 27 + Your terminal emulator must support OSC-52, `alacritty` and 28 + `termux` seem to support this out of the box. In `st`, 29 + OSC-52 works with this change to `config.h`: 30 + 31 + ``` 32 + int allowwindowops = 1; 33 + ``` 34 + 35 + If you are using `tmux`, you need to flip this switch on: 36 + 37 + ``` 38 + set -s set-clipboard on 39 + ``` 40 + 41 + If you are inside `nvim`, it may work as expected as long as 42 + `$SSH_TTY` is set. I sometimes physically start a session, 43 + and `ssh` into the same session later from another machine, 44 + and `$SSH_TTY` remains unset, so I force OSC-52 in `nvim` at 45 + all times (see 46 + [nvimdoc](https://neovim.io/doc/user/provider.html#clipboard-osc52)): 47 + 48 + ```lua 49 + vim.g.clipboard = { 50 + name = 'OSC 52', 51 + copy = { 52 + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), 53 + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), 54 + }, 55 + paste = { 56 + ['+'] = require('vim.ui.clipboard.osc52').paste('+'), 57 + ['*'] = require('vim.ui.clipboard.osc52').paste('*'), 58 + }, 59 + } 60 + ``` 61 + 62 + If you are inside `nvim` inside `tmux` inside an `ssh` 63 + session inside `st`, you neeed all of the above tweaks. 64 + `nvim` will pass the contents around to `tmux`, which in 65 + turn will pass the contents to `st`, which should pass it to 66 + your system clipboard.
+2
recover.sh
··· 1 + #! /usr/bin/env nix-shell 2 + #! nix-shell -i bash -p dateutils 1 3 LIMIT=5000 2 4 read_dom () { 3 5 ORIGINAL_IFS=$IFS