<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>flocks.dev</title>
<id>https://www.flocks.dev</id>
<link rel="self" href="https://www.flocks.dev/feed.xml"/>
<link rel="alternate" href="https://www.flocks.dev"/>
<author>
<name>flocks.dev</name>
</author>
<updated>2026-03-04T19:14:47.251Z</updated>

<entry>
<title>On code indentation</title>
<id>https://www.flocks.dev/posts/code/code-indentation.html</id>
<link rel="alternate" href="https://www.flocks.dev/posts/code/code-indentation.html"/>
<updated>2026-03-04T00:00:00.000Z</updated>
<summary type="text">Code indentation is not always only cosmetic</summary>
<content type="html">&lt;p&gt;I&amp;#39;ve always considered debates about code indentation silly and
pointless. For me it was only a matter of taste. I had no strong
opinion on it and would adapt to the project convention I&amp;#39;m working on.
And for personal project, I would simply rely on default style
convention of tools such as prettier, that automatically formats code.&lt;/p&gt;
&lt;p&gt;But recently, I stumbled upon a code formating convention in some C projects
where the definition of function would follow this pattern&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-C&quot;&gt;type_of_return
&lt;span class=&quot;hljs-title function_&quot;&gt;name_of_function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(args....)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So you would have first the return type, and then on a newline, the
name of the function.&lt;/p&gt;
&lt;p&gt;At first, I didn&amp;#39;t really like it. No strong argument, only
aesthetics.&lt;/p&gt;
&lt;p&gt;But then I realized how powerful it is. Now without any LSP, or any
fancy IDE features, you can quickly find any function declaration by
assuming it will be on a line starting with the function name.&lt;/p&gt;
&lt;p&gt;So it&amp;#39;s just a matter of doing:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-console&quot;&gt;grep -rn ^function_name
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, I wonder if there is any other formatting conventions that favor code
discovery with simple and ubiquitous tools like grep!&lt;/p&gt;
</content>
</entry>
<entry>
<title>Using git bare repository</title>
<id>https://www.flocks.dev/posts/git/you-dont-always-need-github.html</id>
<link rel="alternate" href="https://www.flocks.dev/posts/git/you-dont-always-need-github.html"/>
<updated>2025-12-21T00:00:00.000Z</updated>
<summary type="text">Self-host your git server</summary>
<content type="html">&lt;p&gt;This is nothing revolutionnary but it&amp;#39;s worth reminding that if you
already own a VPS, or any server, and you need to create &lt;em&gt;private&lt;/em&gt; git
repository, you don&amp;#39;t need to use github or any equivalent platform.&lt;/p&gt;
&lt;p&gt;Sometimes, you work on a side project that is intended to remain
private. You still want git history, for obvious reason, and you still
want to be able to clone the repo and work from multiple PC.&lt;/p&gt;
&lt;p&gt;If you already own a VPS, or any kind of server, that is accessible
via SSH and git is installed there, you already own a GIT server.&lt;/p&gt;
&lt;p&gt;You just need to init a &lt;em&gt;bare&lt;/em&gt; repo  with&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-console&quot;&gt;git init --bare .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And that&amp;#39;s it!&lt;/p&gt;
&lt;p&gt;On your PC, just config the remote so it points to your server.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-console&quot;&gt;git remote add origin username@URL-SERVER:~/path/to/repo
&lt;/code&gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<title>Sharing code snippets on IRC with Emacs</title>
<id>https://www.flocks.dev/posts/emacs/share-on-irc-with-emacs.html</id>
<link rel="alternate" href="https://www.flocks.dev/posts/emacs/share-on-irc-with-emacs.html"/>
<updated>2025-10-19T00:00:00.000Z</updated>
<summary type="text">Little elisp functions to share code snippets (and more) on irc with Emacs</summary>
<content type="html">&lt;p&gt;I like to use IRC (Internet Relay Chat) because it&amp;#39;s a text only
protocol and it&amp;#39;s relaxing in the age of social networks full of
images/videos and all sort of distractions.&lt;/p&gt;
&lt;p&gt;But sharing code is not really convenient because IRC is a
&amp;quot;line-based&amp;quot; medium: every new line becomes a new message.&lt;/p&gt;
&lt;p&gt;So the way people do that is by sharing URL of pastebin or equivalent. &lt;/p&gt;
&lt;p&gt;Here are 2 little elisp functions that I use everytime I want to share
some code snippets.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-elisp&quot;&gt;(&lt;span class=&quot;hljs-name&quot;&gt;defun&lt;/span&gt; ft--upload-file (&lt;span class=&quot;hljs-name&quot;&gt;file&lt;/span&gt;)
  (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;let*&lt;/span&gt;&lt;/span&gt; ((&lt;span class=&quot;hljs-name&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;https://envs.sh&amp;quot;&lt;/span&gt;)
         (&lt;span class=&quot;hljs-name&quot;&gt;upload-command&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;format&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;curl -s -F&amp;#x27;file=@%s&amp;#x27; %s&amp;quot;&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;expand-file-name&lt;/span&gt; file) hostname))
         (&lt;span class=&quot;hljs-name&quot;&gt;url&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;shell-command-to-string&lt;/span&gt; upload-command)))
    (&lt;span class=&quot;hljs-name&quot;&gt;kill-new&lt;/span&gt; url)
    (&lt;span class=&quot;hljs-name&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;%s&amp;quot;&lt;/span&gt; url)))

(&lt;span class=&quot;hljs-name&quot;&gt;defun&lt;/span&gt; ft-share-region (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;begin&lt;/span&gt;&lt;/span&gt; end)
  &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Take region and upload the text to 0x0.st or equivalent&amp;quot;&lt;/span&gt;
  (&lt;span class=&quot;hljs-name&quot;&gt;interactive&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt;)
  (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;when&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;not&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;use-region-p&lt;/span&gt;))
    (&lt;span class=&quot;hljs-name&quot;&gt;user-error&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;No region selected&amp;quot;&lt;/span&gt;))
  (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;let*&lt;/span&gt;&lt;/span&gt; ((&lt;span class=&quot;hljs-name&quot;&gt;text&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;buffer-substring-no-properties&lt;/span&gt; begin end))
         (&lt;span class=&quot;hljs-name&quot;&gt;file-text&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;make-temp-file&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt; nil &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;.txt&amp;quot;&lt;/span&gt; text)))
    (&lt;span class=&quot;hljs-name&quot;&gt;ft--upload-file&lt;/span&gt; file-text)))

(&lt;span class=&quot;hljs-name&quot;&gt;defun&lt;/span&gt; ft-share-file (&lt;span class=&quot;hljs-name&quot;&gt;file&lt;/span&gt;)
  &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;Take marked file and upload it to 0x0.st. Prompt for file if no marked file&amp;quot;&lt;/span&gt;
  (&lt;span class=&quot;hljs-name&quot;&gt;interactive&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
                (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;let&lt;/span&gt;&lt;/span&gt; ((&lt;span class=&quot;hljs-name&quot;&gt;files-marked&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;dired-get-marked-files&lt;/span&gt;)))
                  (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;if&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;=&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;length&lt;/span&gt;&lt;/span&gt; files-marked) &lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;)
                      (&lt;span class=&quot;hljs-name&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;car&lt;/span&gt;&lt;/span&gt; files-marked)
                    (&lt;span class=&quot;hljs-name&quot;&gt;read-file-name&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&amp;quot;File to upload: &amp;quot;&lt;/span&gt;)))))
  (&lt;span class=&quot;hljs-name&quot;&gt;ft--upload-file&lt;/span&gt; file))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can either directly select a region (&lt;code&gt;ft-share-region&lt;/code&gt;), or I can
directly send the content of a file (&lt;code&gt;ft-share-file&lt;/code&gt;). It will copy in
my kill ring the URL, and will also display it in the echo area, so I
have a little nice feedback it worked.&lt;/p&gt;
&lt;p&gt;Obviously, &lt;code&gt;ft-share-file&lt;/code&gt; will work with every kind of files. I also
regularly use it to share screenshots, or even GIFs. Since Emacs web
browser, eww, is totally able to display images (even GIF), providing
you run emacs in graphical mode, this provides a fully integrated experience. &lt;/p&gt;
&lt;p&gt;&lt;code&gt;ft-share-file&lt;/code&gt; could be improved, and it could accept multiple
files. It could also take the content of the file and render it in
HTML inside a &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; tag, so Emacs browser could apply syntax
highlighting. But honestly, I never need the former, and I&amp;#39;m too lazy
for the latter.&lt;/p&gt;
</content>
</entry>
</feed>
