<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>til on Alán's blog</title><link>https://quasimorphic.com/categories/til/</link><description>Recent content in til on Alán's blog</description><generator>Hugo</generator><language>en-uk</language><lastBuildDate>Thu, 23 Oct 2025 15:21:00 -0400</lastBuildDate><atom:link href="https://quasimorphic.com/categories/til/index.xml" rel="self" type="application/rss+xml"/><item><title>Use dired-do-shell to explore the parquet schema from Emacs</title><link>https://quasimorphic.com/archive/emacs_dired_do_shell_duckdb/</link><pubDate>Thu, 23 Oct 2025 15:21:00 -0400</pubDate><guid>https://quasimorphic.com/archive/emacs_dired_do_shell_duckdb/</guid><description>&lt;p>I use &lt;code>dired-do-shell&lt;/code> command in Emacs to run CLI commands from within its file manager &lt;a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html">dired&lt;/a>. This workflow makes it easy to perform batch operations on files that would be annoying otherwise. The trouble arose when trying to use the &lt;code>duckdb&lt;/code> CLI to print the schema of a parquet file, as the notation for wildcards in emacs (&lt;code>*&lt;/code> and &lt;code>?&lt;/code>) conflicts with duckdb&amp;rsquo;s usage of the former. Thus running the following after &lt;code>M-x dired-do-shell&lt;/code> (bound to &lt;code>!&lt;/code> in &lt;code>dired-mode&lt;/code>) did not work:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>duckdb -c &lt;span style="color:#e6db74">&amp;#34;DESCRIBE * FROM read_parquet(&amp;#39;?&amp;#39;)&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>I am trying to get Emacs to substitute &lt;code>?&lt;/code> for the selected file(s) in dired and retain &lt;code>*&lt;/code> as a normal duckdb wildcard (for which it means &amp;ldquo;get all columns&amp;rdquo;), but Emacs interprets the star as a wildcard and not the question mark. Thus Emacs yapped about it:&lt;/p>
&lt;blockquote>
&lt;p>dired-do-shell-command: You can not combine ‘*’ and ‘?’ substitution marks&lt;/p>&lt;/blockquote>
&lt;p>The trick is that we need to surround &lt;code>?&lt;/code> with backquotes (&lt;code>`&lt;/code>), otherwise the spaces will be in the file name that &lt;code>read_parquet&lt;/code> ingests. To fix the &amp;ldquo;naked star&amp;rdquo; problem (which Emacs will try to substitute) we can envelop it with the &lt;code>COLUMNS()&lt;/code> command, and the lack of spaces around &lt;code>*&lt;/code> will prevent Emacs from substituting its value. Thus the following command in the Emacs command line does the trick:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>duckdb -c &lt;span style="color:#e6db74">&amp;#34;DESCRIBE COLUMNS(*) FROM read_parquet(&amp;#39;`?`&amp;#39;)&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Which is a bit verbose but I can easily reuse from my command history to explore the schemas or parquets without leaving the dired buffer.&lt;/p></description></item>/<item><title>Recursive search and replace</title><link>https://quasimorphic.com/archive/recursive-search-replace/</link><pubDate>Tue, 12 Aug 2025 13:07:00 -0400</pubDate><guid>https://quasimorphic.com/archive/recursive-search-replace/</guid><description>&lt;p>I needed to rename all occurrences of a pattern with another, where I knew there was no ambiguous situations. This uses &lt;code>ripgrep&lt;/code>, &lt;code>xargs&lt;/code> and &lt;code>GNU sed&lt;/code>. &lt;a href="https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#search-and-replace">source&lt;/a>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>rg old_pattern --files-with-matches | xargs sed -i &lt;span style="color:#e6db74">&amp;#39;s/old_pattern/new_pattern/g&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item>/<item><title>Github code review on existing code base</title><link>https://quasimorphic.com/archive/github-review-existing-code/</link><pubDate>Tue, 26 Nov 2024 13:06:00 -0500</pubDate><guid>https://quasimorphic.com/archive/github-review-existing-code/</guid><description>&lt;p>Create an empty branch with one empty commit&lt;/p>
&lt;ol>
&lt;li>Create new branch &lt;code>git checkout --orphan review-1-target&lt;/code>&lt;/li>
&lt;li>Reset &lt;code>git reset .&lt;/code>&lt;/li>
&lt;li>Clean branch &lt;code>git clean -df&lt;/code>&lt;/li>
&lt;li>Add empty commit &lt;code>git commit --allow-empty -m 'Empty commit'&lt;/code>&lt;/li>
&lt;/ol>
&lt;p>Rebase a branch to put this commit at the root&lt;/p>
&lt;ol>
&lt;li>Push to your fork &lt;code>git push -u origin review-1-target&lt;/code>&lt;/li>
&lt;li>Move to branch to review &lt;code>git checkout origin/main&lt;/code>&lt;/li>
&lt;li>Spin-off branch from here &lt;code>git checkout -b review-1&lt;/code>&lt;/li>
&lt;li>Rebase to empty branch &lt;code>git rebase -i review-1-target&lt;/code>, the empty commit must be at the start&lt;/li>
&lt;li>Push &lt;code>git push -u origin review-1&lt;/code>&lt;/li>
&lt;/ol>
&lt;p>That should make a pull request possible, providing the code review tooling.
&lt;a href="https://thib.me/recipe-code-reviews-for-existing-code-with-github">source&lt;/a>&lt;/p></description></item>/</channel></rss>