<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="atom-style.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <id>https://corion.net/blog/tag/tools/</id>
    <title>Corions Musings</title>
    <updated>2026-06-07T00:00:00Z</updated>
    <link href="https://corion.net/blog/tag/tools.atom" rel="self" />
    <link href="https://corion.net/blog/tag/tools/" rel="alternate" />
    <generator version="0.098">Statocles</generator>

    <entry>
        <id>https://corion.net/blog/2026/06/07/more-tools-for-note-selecting/</id>
        <title>More tools for note-selecting</title>
        <author><name>Corion</name></author>
        <link href="https://corion.net/blog/2026/06/07/more-tools-for-note-selecting/" rel="alternate" />
        <content type="html"><![CDATA[
            <p>Sometimes I want to select a markdown note from the shell
for further work. Maybe I want to launch an LLM with the note
or I want to edit the note from within a terminal to fix some bug.</p>

<p>Since I&#39;ve discovered <a href="https://github.com/junegunn/fzf">fzf</a> and its preview
feature I find more and more uses for it. The following shell script shows all
notes that contain a given label and offers them for selection:</p>

<pre><code>#!/bin/bash

# Maybe we can even get tab completion here?!
LABEL=$1; shift

find ~/bin/App-notes-htmx/notes_corion/ -maxdepth 1 -name &#39;*.markdown&#39; -print0 \
  | xargs -0 grep -l -- &quot; - $LABEL&quot; \
  | perl -lpe &#39;BEGIN{$\=&quot;\0&quot;; s!([\s/*?])!\\$1!g }&#39; \
  | fzf --read0 --preview=&#39;cat {}&#39;
</code></pre>

<p>Having not only a selection but also a custom preview makes things convenient.
Perl was useful for properly escaping the filenames. <code>fzf</code> has the <code>--read0</code>
option, but it still passes the item to the shell without escapes. Using
double quotes around the <code>{}</code> does not work.</p>


                <p>Tags:
                    <a href="https://corion.net/blog/tag/blogpost/">Blogpost</a>
                    <a href="https://corion.net/blog/tag/tools/">tools</a>
                </p>

        ]]></content>
        <updated>2026-06-07T00:00:00Z</updated>
        <category term="Blogpost" />
        <category term="tools" />
    </entry>
    <entry>
        <id>https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/</id>
        <title>Automating some file history with git snapshots</title>
        <author><name>Corion</name></author>
        <link href="https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/" rel="alternate" />
        <content type="html"><![CDATA[
            <p>My <a href="https://github.com/Corion/App-notes-htmx">Note taking tool</a> is part journal, part shopping list, part blog posts, part programs. Most notes get written once. Some get revised, some get posted or implemented.
The tool is fully self-hosted and written by me, so I get to decide on its (lack of) features.
For simplicity I avoided keeping a full note history. But then I realized that maybe some kind of history
is actually nice, for the case when a wonky network failure erases or corrupts some note.</p>

<p>My solution for this feature is to simply snapshot the directory where I keep my notes every hour into a <code>git</code> repository. This
gives me some change history, but it does not record every keystroke. The <code>cron</code> job is the following shell script:</p>

<pre><code>SOURCE=/home/corion/bin/App-notes-htmx/notes_corion
TARGET=/home/corion/backup/notes_corion_history
if git --git-dir=$TARGET --work-tree $SOURCE diff --quiet; then
    git --git-dir=$TARGET --work-tree $SOURCE add  --all
    git --git-dir=$TARGET --work-tree $SOURCE commit -m &quot;Hourly&quot;
fi
</code></pre>

<p>I&#39;ve &quot;implemented&quot; the tool as a shell script, but if I add more features, I will likely move it to Perl and use <a href="https://metacpan.org/pod/Git::Raw">Git::Raw</a>
to do the adding/filtering/pruning myself. But then I would lose the convenience of <code>.gitignore</code> for example.</p>

<p>I still have on my list some kind of <code>git history-prune</code>, that coalesces adjacent git commits if they are too close, just
to eliminate changes that don&#39;t matter anymore. Maybe
after a month, compress all commits older than one month and less than 24 hours apart into a single commit.</p>

<p>I think having all changes of a single day in one commit is a sensible granularity for my use case.</p>


                <p>Tags:
                    <a href="https://corion.net/blog/tag/tools/">tools</a>
                </p>

        ]]></content>
        <updated>2026-05-31T00:00:00Z</updated>
        <category term="tools" />
    </entry>
</feed>

