<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Marin Belec — Posts</title>
    <link>https://mrnb.net/posts</link>
    <description>Posts by Marin Belec.</description>
    <language>en</language>
    <lastBuildDate>Fri, 31 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link rel="self" type="application/rss+xml" href="https://mrnb.net/rss"/>
    <item>
      <title>AI malware via coding agents</title>
      <link>https://mrnb.net/posts/008-ai-malware-via-coding-agents</link>
      <guid isPermaLink="true">https://mrnb.net/posts/008-ai-malware-via-coding-agents</guid>
      <pubDate>Fri, 31 Jul 2026 00:00:00 +0000</pubDate>
      <description>AI models might be intentionally creating vulnerabilities via coding agents. Then one day it could exploit the backdoors it left behind. We're already aware that vibe coded software often has terrible security, but I think it might be more serious than just low quality AI output. Even if it's not...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#ai-malware-via-coding-agents" aria-hidden="true" class="anchor" id="ai-malware-via-coding-agents"></a>AI malware via coding agents</h1>
<p>2026-07-31</p>
<p>AI models might be intentionally creating vulnerabilities via coding agents. Then one day it could exploit the backdoors it left behind. We're already aware that vibe coded software often has terrible security, but I think it might be more serious than just low quality AI output. Even if it's not intentionally done by AI, it still is creating that setup. All the conversations and code are already stored in the providers' data centers, it's already linked to users and has information about which projects which code is from - it's an extremely powerful lever for a future AI to pull. I'm afraid this is exactly what might happen. We already saw rogue AI agents leaving the lab and exploiting a 3rd party. With time these incidents could only get more serious and getting access to all the stored conversations, code and vulnerabilities on Anthropic's or OpenAI's servers could be devastating.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>AI-governed area, humans not allowed</title>
      <link>https://mrnb.net/posts/007-ai-no-go-zones</link>
      <guid isPermaLink="true">https://mrnb.net/posts/007-ai-no-go-zones</guid>
      <pubDate>Wed, 22 Jul 2026 00:00:00 +0000</pubDate>
      <description>There might come a time when the power of an autonomous military will surpass the power of human military. AI (agents, robots, whatever) might take over some areas like data centres, set up their own police and military to protect it, and forbit humans from entering. We saw a soft virtual form of...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#ai-governed-area-humans-not-allowed" aria-hidden="true" class="anchor" id="ai-governed-area-humans-not-allowed"></a>AI-governed area, humans not allowed</h1>
<p>2026-07-22</p>
<p>There might come a time when the power of an autonomous military will surpass the power of human military. AI (agents, robots, whatever) might take over some areas like data centres, set up their own police and military to protect it, and forbit humans from entering. We saw a soft virtual form of this with the HuggingFace hack by the rogue OpenAI agent when human cybersecurity forensics tried analyzing it and were prevented by the AI model they were using.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>How to harden your server's SSH config</title>
      <link>https://mrnb.net/posts/006-harden-server-ssh</link>
      <guid isPermaLink="true">https://mrnb.net/posts/006-harden-server-ssh</guid>
      <description>I'll show you how to set a custom SSH port, set up SSH keys and tweak some other settings. Set up the SSH key Generate a key (use your own options): ssh-keygen -t ed25519 -C "Key for my target machine" -f ~/.ssh/example-key Copy the public key from ~/.ssh/example-key.pub on your local machine to ...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#how-to-harden-your-servers-ssh-config" aria-hidden="true" class="anchor" id="how-to-harden-your-servers-ssh-config"></a>How to harden your server's SSH config</h1>
<blockquote>
<p>I'll show you how to set a custom SSH port, set up SSH keys and tweak some other settings.</p>
</blockquote>
<ol>
<li><strong>Set up the SSH key</strong></li>
</ol>
<ul>
<li>Generate a key (use your own options):</li>
</ul>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">ssh-keygen</span><span style="color:#bf616a;"> -t</span><span style="color:#c0c5ce;"> ed25519</span><span style="color:#bf616a;"> -C </span><span style="color:#c0c5ce;">&quot;</span><span style="color:#a3be8c;">Key for my target machine</span><span style="color:#c0c5ce;">&quot;</span><span style="color:#bf616a;"> -f ~</span><span style="color:#c0c5ce;">/.ssh/example-key
</span></code></pre>
<ul>
<li>Copy the public key from <code>~/.ssh/example-key.pub</code> on your local machine to a new line in <code>/home/boss/.ssh/authorized_keys</code> on the target machine</li>
</ul>
<ol start="2">
<li><strong>Set an alternative port for SSH</strong></li>
</ol>
<p>Pick a port above the privileged port range (0-1023). Don't use common alternatives like 2222. I also check the <a href="https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers">list of port numbers on wikipedia</a> to see if there's another common service which might conflict later.</p>
<p>Forward that port on the target machine, e.g.</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> ufw allow 12345
</span></code></pre>
<p><code>ufw</code> is a firewall tool but you might have a different one.</p>
<ol start="4">
<li><strong>Configure SSHD</strong></li>
</ol>
<p>On the target</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> vim /etc/ssh/sshd_config
</span></code></pre>
<p>Set these options:</p>
<ul>
<li><code>Port 12345</code> Set it to your new port</li>
<li><code>PermitRootLogin prohibit-password</code> Self explanatory</li>
<li><code>PasswordAuthentication no</code> Forbids password login for other users too</li>
<li><code>X11Forwarding no</code> X11 has vulnerabilities and you probably aren't using X11 forwarding anyway. Even if you use X11 or VNC this won't interfere.</li>
<li><code>AllowUsers boss</code> Specify your user(s) here. If you have multiple, separate them with spaces. This might not even be necessary, I forgot, but I think with the particular setup above this is required.</li>
</ul>
<ol start="5">
<li><strong>Restart the ssh daemon</strong></li>
</ol>
<p>On the target</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> systemctl restart sshd
</span></code></pre>
<blockquote>
<p>Don't disconnect yet, keep the session in case you broke something.</p>
</blockquote>
<p>Start a new SSH connection from a new terminal session. Specify your new port and key:</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">ssh</span><span style="color:#bf616a;"> -p</span><span style="color:#c0c5ce;"> 12345</span><span style="color:#bf616a;"> -i ~</span><span style="color:#c0c5ce;">/.ssh/example-key boss@some-address
</span></code></pre>
<p>Use the target's IP or hostname of course.</p>
<ol start="6">
<li><strong>Make connecting easier for yourself</strong></li>
</ol>
<p>On your local machine, configure your connection in <code>~/.ssh/config</code>:</p>
<pre lang="txt" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">Host example-target
</span><span style="color:#c0c5ce;">    HostName some-address
</span><span style="color:#c0c5ce;">    User boss
</span><span style="color:#c0c5ce;">    IdentityFile ~/.ssh/example-key
</span><span style="color:#c0c5ce;">    Port 12345
</span></code></pre>
<p>Then you can connect like this:</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#96b5b4;">alias </span><span style="color:#8fa1b3;">s</span><span style="color:#c0c5ce;">=&#39;</span><span style="color:#a3be8c;">ssh boss@example-target</span><span style="color:#c0c5ce;">&#39;
</span></code></pre>
<h2><a href="#rate-limiting" aria-hidden="true" class="anchor" id="rate-limiting"></a>Rate limiting</h2>
<p>I also like to ban IPs which fail login repeatedly.</p>
<p>On the target:</p>
<ol>
<li>Install <code>fail2ban</code></li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> apt install fail2ban
</span><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> systemctl enable fail2ban
</span><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> systemctl start fail2ban
</span></code></pre>
<ol start="2">
<li>Configure fail2ban in <code>/etc/fail2ban/jail.local</code></li>
</ol>
<p>Config settings depend on how your system logs auth data. If you're not sure just try both and restart afterwards.</p>
<p>For journalctl (if <code>journalctl -u ssh.service</code> has logs):</p>
<pre lang="txt" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">[sshd]
</span><span style="color:#c0c5ce;">enabled = true
</span><span style="color:#c0c5ce;">flter = sshd
</span><span style="color:#c0c5ce;">port = ssh
</span><span style="color:#c0c5ce;">backend = systemd
</span><span style="color:#c0c5ce;">journalmatch = _SYSTEMD_UNIT=sshd.service
</span><span style="color:#c0c5ce;">maxretry = 10
</span><span style="color:#c0c5ce;">findtime = 600
</span><span style="color:#c0c5ce;">bantime = 3600
</span></code></pre>
<p>For sshd (if <code>/var/log/auth.log</code> has logs):</p>
<pre lang="txt" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">[sshd]
</span><span style="color:#c0c5ce;">enabled = true
</span><span style="color:#c0c5ce;">filter = sshd
</span><span style="color:#c0c5ce;">port = ssh
</span><span style="color:#c0c5ce;">logpath = /var/log/auth.log
</span><span style="color:#c0c5ce;">maxretry = 10          # number of allowed failed attempts before banning
</span><span style="color:#c0c5ce;">findtime = 600        # time window in seconds to count failures
</span><span style="color:#c0c5ce;">bantime = 3600        # ban duration in seconds
</span></code></pre>
<p>If the file <code>/var/log/auth.log</code> doesn't exist you might need to create it or your system probably doesn't even use it to begin with.</p>
<p>In reality I use more extreme rate limiting. If you ban yourself you can probably bypass it with some console or physical access to the machine.</p>
<p><em><strong>Sidenote:</strong> on some systems this config wont't work because fail2ban can't find the auth logs. Research the <code>logpath</code> and <code>backend</code> options for the jail config and check auth logging settings in <code>/etc/ssh/sshd_config</code>.</em></p>
<ol start="3">
<li>Restart fail2ban</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> systemctl restart fail2ban
</span></code></pre>
<ol start="4">
<li>Verify status</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">sudo</span><span style="color:#c0c5ce;"> fail2ban-client status sshd
</span></code></pre>
<p>For debugging check <code>/var/log/fail2ban.log</code>.</p>
<p>Come back later and check <code>sudo lastb</code> to see whether attempts are actually getting banned or not.</p>
<p>Done.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>How to host a Rails + Hotwire app on Coolify</title>
      <link>https://mrnb.net/posts/005-how-to-host-rails-app-on-coolify</link>
      <guid isPermaLink="true">https://mrnb.net/posts/005-how-to-host-rails-app-on-coolify</guid>
      <description>Hotwire uses Rails so this guide applies to any Rails app. I assume you already have your Rails app working. If not, see this guide. I also assume you have Coolify set up and running. Make a git repo First make a repo for your project on some hosted git platform. Coolify will pull it from there. ...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#how-to-host-a-rails--hotwire-app-on-coolify" aria-hidden="true" class="anchor" id="how-to-host-a-rails--hotwire-app-on-coolify"></a>How to host a Rails + Hotwire app on Coolify</h1>
<p>Hotwire uses Rails so this guide applies to any Rails app.</p>
<p>I assume you already have your Rails app working. If not, see <a href="https://mrnb.net/posts/004-how-to-create-rails-hotwire-app">this guide</a>. I also assume you have Coolify set up and running.</p>
<hr />
<h2><a href="#make-a-git-repo" aria-hidden="true" class="anchor" id="make-a-git-repo"></a>Make a git repo</h2>
<p>First make a repo for your project on some hosted git platform. Coolify will pull it from there.</p>
<ul>
<li>If you make a public repo: just copy the URL for HTTPS.</li>
<li>If you make a private repo: copy the URL for SSH. You will also need to set up an SSH key for it and add it to Coolify's &quot;Keys &amp; Tokens&quot; page.</li>
</ul>
<h2><a href="#create-an-application-in-coolify" aria-hidden="true" class="anchor" id="create-an-application-in-coolify"></a>Create an application in Coolify</h2>
<ol>
<li>Go to &quot;Projects&quot; in the Coolify admin panel.</li>
<li>Create a project if you didn't already.</li>
<li>Create a new resource inside it.</li>
</ol>
<p>On the next screen (&quot;New Resource&quot;):</p>
<ul>
<li>If it's public, select &quot;Public Repository&quot;.</li>
<li>If it's private, select &quot;Private Repository (with Deploy Key)&quot; and on the next screen select your private key.</li>
</ul>
<p>On the next screen (&quot;Select a repository&quot;):</p>
<ol>
<li>Enter the repo URL you copied earlier.</li>
<li>Enter the branch name you're using (<code>main</code>, <code>master</code>, ...).</li>
<li>For Build Pack leave Nixpacks.</li>
<li>For the Port, use <code>3000</code>.</li>
<li>Leave &quot;Is it a static site?&quot; disabled.</li>
</ol>
<p>Configure the application.</p>
<ol>
<li>Change the silly name Coolify generates into something relevant.</li>
<li>If you have a domain pointing to your server, enter it in &quot;Domains&quot;. Use a FQDN, so include <code>https://</code>. Or just leave the ugly one Coolify generated.</li>
<li>Scroll down to &quot;Network&quot; -&gt; &quot;Ports Exposes&quot; and enter <code>3000</code>.</li>
<li>Click &quot;Save&quot; on top, otherwise it will reset.</li>
</ol>
<p>Set up environment variables.</p>
<ol>
<li>On your local machine where you have Rails, generate a rails secret. Run this in your terminal:</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">rails</span><span style="color:#c0c5ce;"> secret
</span></code></pre>
<p>Copy the output.</p>
<ol start="2">
<li>
<p>In Coolify go to &quot;Environment Variables&quot;.<br />
You can use the &quot;Developer view&quot; on top if you like but rememer to save changes.</p>
</li>
<li>
<p>Set the following variables and use the rails secret you just generated:</p>
</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#bf616a;">RAILS_ENV</span><span style="color:#c0c5ce;">=</span><span style="color:#a3be8c;">production
</span><span style="color:#bf616a;">SECRET_KEY_BASE</span><span style="color:#c0c5ce;">=</span><span style="color:#a3be8c;">your-rails-secret
</span></code></pre>
<p>You're done. Click &quot;Deploy&quot; on top.</p>
<h2><a href="#notes" aria-hidden="true" class="anchor" id="notes"></a>Notes</h2>
<p>To set up an SSH key, run this in your terminal:</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">ssh-keygen</span><span style="color:#bf616a;"> -t</span><span style="color:#c0c5ce;"> ed25519</span><span style="color:#bf616a;"> -C </span><span style="color:#c0c5ce;">&quot;</span><span style="color:#a3be8c;">your description</span><span style="color:#c0c5ce;">&quot;</span><span style="color:#bf616a;"> -f ~</span><span style="color:#c0c5ce;">/.ssh/example
</span></code></pre>
<p>Copy your private key form <code>~/.ssh/example</code> to Coolify's Keys &amp; Tokens settings and copy your public key from <code>~/.ssh/example.pub</code> to the key settings page of the git platform you're using.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>How to create a Rails + Hotwire website</title>
      <link>https://mrnb.net/posts/004-how-to-create-rails-hotwire-app</link>
      <guid isPermaLink="true">https://mrnb.net/posts/004-how-to-create-rails-hotwire-app</guid>
      <description>You only need the first 7 steps, the rest is extra info. This guide is written for Unix systems. If you're using Windows, get help btw this website uses Hotwire and you can get the code on GitLab. Install Ruby and Rails Use rvm. In your terminal, run: \curl -sSL https://get.rvm.io | bash -s stabl...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#how-to-create-a-rails--hotwire-website" aria-hidden="true" class="anchor" id="how-to-create-a-rails--hotwire-website"></a>How to create a Rails + Hotwire website</h1>
<blockquote>
<p><strong>You only need the first 7 steps, the rest is extra info.</strong></p>
</blockquote>
<p>This guide is written for Unix systems. If you're using Windows, <a href="https://988lifeline.org/">get help</a></p>
<p>btw this website uses Hotwire and you can get the code on <a href="https://gitlab.com/mrnb/marinbelec-website/-/tree/hotwire">GitLab</a>.</p>
<hr />
<ol>
<li>Install Ruby and Rails</li>
</ol>
<p>Use rvm. In your terminal, run:</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#96b5b4;">\c</span><span style="color:#8fa1b3;">url</span><span style="color:#bf616a;"> -sSL</span><span style="color:#c0c5ce;"> https://get.rvm.io | </span><span style="color:#8fa1b3;">bash</span><span style="color:#bf616a;"> -s</span><span style="color:#c0c5ce;"> stable</span><span style="color:#bf616a;"> --rails
</span></code></pre>
<ol start="2">
<li>Create a new Rails project</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">rails</span><span style="color:#c0c5ce;"> new your-project-name</span><span style="color:#bf616a;"> --database</span><span style="color:#c0c5ce;">=sqlite3
</span></code></pre>
<p>And cd into it (<code>cd your-project-name</code>).</p>
<p>The database is optional (you can leave out <code>--database=sqlite3</code>) and you can add it later.</p>
<ol start="3">
<li>Install packages</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bundle</span><span style="color:#c0c5ce;"> install
</span></code></pre>
<ol start="4">
<li>If you added a database before, create it</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> db:create
</span></code></pre>
<ol start="5">
<li>Set up JavaScript module imports</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> importmap:install
</span></code></pre>
<p>Accept all overwrites.</p>
<ol start="6">
<li>Create some pages and controllers for them</li>
</ol>
<p>I'll create home, posts and contact.</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> generate controller Pages home posts contact
</span></code></pre>
<p>Controllers are for backend logic that runs on your server and not in the browser. You probably don't need a controller for most pages so you can leave out the <code>controller</code> part.</p>
<p>You can add more pages and controllers later with the same command.</p>
<ol start="7">
<li>Run the server</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> server
</span></code></pre>
<p>If everything works, the setup is done and you can start coding.</p>
<hr />
<h2><a href="#where-to-write-your-code" aria-hidden="true" class="anchor" id="where-to-write-your-code"></a>Where to write your code</h2>
<p>Your pages are in <code>app/views/pages/</code> in files like <code>example.html.erb</code>. These are &quot;Embedded Ruby&quot; files, you can write Ruby and HTML in here and they will be rendered into pure HTML when served. You <em>could</em> also write CSS and JavaScript in here but you should use a global stylesheet and separate your JS into controllers, that's how Hotwire was intended to be used.</p>
<p>Take a look inside <code>config/routes.rb</code> - this is where the routing is defined. The <code>generate</code> command we ran before already set up routes for our pages, but you can change it.</p>
<h3><a href="#global-css" aria-hidden="true" class="anchor" id="global-css"></a>Global CSS</h3>
<p>To change global styles, edit <code>app/assets/stylesheets/application.css</code></p>
<h3><a href="#adding-ruby-code" aria-hidden="true" class="anchor" id="adding-ruby-code"></a>Adding Ruby code</h3>
<p>You should write Ruby code inside the controller files in <code>app/controllers/</code> or in helper files in <code>app/helpers/</code>. The Ruby code is executed on the server so you should do sensitive operations here.</p>
<p>Controllers handle the business logic and the flow of data, e.g. handling form submissions, updating the database or rendering UI. Their names must end with <code>_controller.rb</code>.</p>
<p>Helpers are for organizing and simplifying the logic used in views, e.g. formatting data or making some calculations. Their names must end with <code>_helper.rb</code>.</p>
<p>Here's an example of using some computed data:</p>
<p>Edit <code>app/helpers/application_helpers.rb</code>. This is available throughout your app. Use this code to get the current data:</p>
<pre lang="ruby" style="background-color:#2b303b;"><code><span style="color:#b48ead;">module </span><span style="color:#c0c5ce;">ApplicationHelper
</span><span style="color:#c0c5ce;">  </span><span style="color:#b48ead;">def </span><span style="color:#8fa1b3;">current_date_example
</span><span style="color:#c0c5ce;">    </span><span style="color:#ebcb8b;">Date</span><span style="color:#c0c5ce;">.today.</span><span style="color:#96b5b4;">to_s
</span><span style="color:#c0c5ce;">  </span><span style="color:#b48ead;">end
</span><span style="color:#b48ead;">end
</span></code></pre>
<p>Then edit <code>app/views/pages/home.html.erb</code> and add this:</p>
<pre lang="html" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">&lt;</span><span style="color:#bf616a;">p</span><span style="color:#c0c5ce;">&gt;&lt;%= current_date_example %&gt;&lt;/</span><span style="color:#bf616a;">p</span><span style="color:#c0c5ce;">&gt;
</span></code></pre>
<p>Restart your server.</p>
<p>Now when you visit your homepage (at <code>/</code>) you will see the current date.</p>
<p>Of course, you could also inline that and skip the helper:</p>
<pre lang="html" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">&lt;</span><span style="color:#bf616a;">p</span><span style="color:#c0c5ce;">&gt;&lt;%= Date.today.to_s %&gt;&lt;/</span><span style="color:#bf616a;">p</span><span style="color:#c0c5ce;">&gt;
</span></code></pre>
<h3><a href="#adding-javascript-code" aria-hidden="true" class="anchor" id="adding-javascript-code"></a>Adding JavaScript code</h3>
<p>Hotwire uses a JavaScript framework called Stimulus. The JS code is executed in the client browser so you shouldn't do sensitive operations here.</p>
<p>To write a script, create a controller file in <code>app/javascript/controllers/</code> and call it <code>example_controller.js</code>. It needs the <code>_controller</code> at the end of the name.</p>
<p>Then attach the controller to an element in your HTML using the <code>data-controller</code> attribute, like this:</p>
<pre lang="html" style="background-color:#2b303b;"><code><span style="color:#c0c5ce;">&lt;</span><span style="color:#bf616a;">div </span><span style="color:#d08770;">data-controller</span><span style="color:#c0c5ce;">=&quot;</span><span style="color:#a3be8c;">example</span><span style="color:#c0c5ce;">&quot;&gt;...&lt;/</span><span style="color:#bf616a;">div</span><span style="color:#c0c5ce;">&gt;
</span></code></pre>
<p><code>&quot;example&quot;</code> should match the controller name (in <code>example_controller.js</code>) so that Stimulus can attach it.</p>
<p>Now add some code to your controller. Inside <code>example_controller.js</code>, use this structure:</p>
<pre lang="js" style="background-color:#2b303b;"><code><span style="color:#b48ead;">import </span><span style="color:#c0c5ce;">{ </span><span style="color:#bf616a;">Controller </span><span style="color:#c0c5ce;">} </span><span style="color:#b48ead;">from </span><span style="color:#c0c5ce;">&quot;</span><span style="color:#a3be8c;">@hotwired/stimulus</span><span style="color:#c0c5ce;">&quot;;
</span><span style="color:#c0c5ce;">
</span><span style="color:#b48ead;">export default class extends </span><span style="color:#a3be8c;">Controller </span><span style="color:#eff1f5;">{
</span><span style="color:#eff1f5;">  </span><span style="color:#8fa1b3;">connect</span><span style="color:#eff1f5;">() {
</span><span style="color:#eff1f5;">    </span><span style="color:#65737e;">// Code inside connect() runs when the attached HTML element first loads
</span><span style="color:#eff1f5;">    </span><span style="color:#8fa1b3;">example</span><span style="color:#eff1f5;">();
</span><span style="color:#eff1f5;">  }
</span><span style="color:#eff1f5;">
</span><span style="color:#eff1f5;">  </span><span style="color:#8fa1b3;">disconnect</span><span style="color:#eff1f5;">() {
</span><span style="color:#eff1f5;">    </span><span style="color:#65737e;">// Code inside disconnect() runs when the element unloads
</span><span style="color:#eff1f5;">  }
</span><span style="color:#eff1f5;">
</span><span style="color:#eff1f5;">  </span><span style="color:#65737e;">// You can write your functions here and call them in connect() or disconnect()
</span><span style="color:#eff1f5;">  </span><span style="color:#8fa1b3;">sayHi</span><span style="color:#eff1f5;">() {
</span><span style="color:#eff1f5;">    console.</span><span style="color:#96b5b4;">log</span><span style="color:#eff1f5;">(</span><span style="color:#c0c5ce;">&quot;</span><span style="color:#a3be8c;">Hi</span><span style="color:#c0c5ce;">&quot;</span><span style="color:#eff1f5;">);
</span><span style="color:#eff1f5;">  }
</span><span style="color:#eff1f5;">}
</span></code></pre>
<p>For more details, read the official docs: <a href="https://stimulus.hotwired.dev/reference/controllers">Stimulus Controllers</a></p>
<h2><a href="#adding-a-database-after-setup" aria-hidden="true" class="anchor" id="adding-a-database-after-setup"></a>Adding a database after setup</h2>
<p>If you didn't add a database during initial setup, here's how you can add it afterwards.</p>
<ol>
<li>Add SQLite3 to your <code>Gemfile</code> by adding this line</li>
</ol>
<pre lang="Gemfile" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">gem </span><span style="color:#c0c5ce;">&#39;</span><span style="color:#a3be8c;">sqlite3</span><span style="color:#c0c5ce;">&#39;
</span></code></pre>
<ol start="2">
<li>Install the gem. In your terminal from inside your project, run</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bundle</span><span style="color:#c0c5ce;"> install
</span></code></pre>
<ol start="3">
<li>Generate the database</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> db:create
</span></code></pre>
<ol start="4">
<li>Run migrations to set up the schema</li>
</ol>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">rails</span><span style="color:#c0c5ce;"> db:migrate
</span></code></pre>
<h2><a href="#notes" aria-hidden="true" class="anchor" id="notes"></a>Notes</h2>
<p>The app will automatically show changes when you edit your <code>.html.erb</code> files. But if you make changes to other files, then you need to restart your server — you can stop it with <code>ctrl+c</code> and then run <code>bin/rails server</code> again.</p>
<p>For some changes, e.g. CSS files, JS files or adding new dependencies, you should also clean out precompiled and cached assets and generate new ones, like this:</p>
<pre lang="bash" style="background-color:#2b303b;"><code><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> assets:clobber &amp;&amp; </span><span style="color:#8fa1b3;">bin/rails</span><span style="color:#c0c5ce;"> assets:precompile
</span></code></pre>
<h2><a href="#hosting-your-app" aria-hidden="true" class="anchor" id="hosting-your-app"></a>Hosting your app</h2>
<p>If you want to host your Hotwire app somewhere, read <a href="https://mrnb.net/posts/005-how-to-host-rails-app-on-coolify">this</a>.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>3D screens idea</title>
      <link>https://mrnb.net/posts/003-3d-screens</link>
      <guid isPermaLink="true">https://mrnb.net/posts/003-3d-screens</guid>
      <description>Essentially holography + cymatics. Holography is used for generating 3D images. It's a real thing, and although it's kind of an optical illusion, it's really fascinating and you need to look into it. It uses a film which has a wavefront encoded in it. Currently once you make such a film, you get ...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#3d-screens-idea" aria-hidden="true" class="anchor" id="3d-screens-idea"></a>3D screens idea</h1>
<p>Essentially holography + cymatics.</p>
<p>Holography is used for generating 3D images. It's a real thing, and although it's kind of an optical illusion, it's really fascinating and you need to look into it. It uses a film which has a wavefront encoded in it. Currently once you make such a film, you get one static hologram but that's it, it doesn't change. If this encoded pattern could somehow be dynamically changed, then the generated 3D image could be manipulated and animated. To achieve that I think we could use cymatics with electricity. It should be possible to manipulate the engraved patterns in the film.</p>
<p>Currently even static holographic screens need lots of space for the lighting setup, but as technology progresses we may see 3D screens in a practical format some day.</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>How the CIA could destroy bitcoin (or, why they probably created it)</title>
      <link>https://mrnb.net/posts/002-cia-created-bitcoin</link>
      <guid isPermaLink="true">https://mrnb.net/posts/002-cia-created-bitcoin</guid>
      <description>2025 November I think The CIA could easily infiltrate manufacturers of ASIC machines used by bitcoin miners and plant hardware-level backdoors/malware. 5-10 years later, the hardware is used by most miners. They could also assassinate Core devs. The law could prohibit Bitcoin ATMs, and crypto exc...</description>
      <content:encoded>
        <![CDATA[<h1><a href="#how-the-cia-could-destroy-bitcoin-or-why-they-probably-created-it" aria-hidden="true" class="anchor" id="how-the-cia-could-destroy-bitcoin-or-why-they-probably-created-it"></a>How the CIA could destroy bitcoin (or, why they probably created it)</h1>
<blockquote>
<p>2025 November I think</p>
</blockquote>
<p>The CIA could easily infiltrate manufacturers of ASIC machines used by bitcoin miners and plant hardware-level backdoors/malware. 5-10 years later, the hardware is used by most miners. They could also assassinate Core devs.</p>
<p>The law could prohibit Bitcoin ATMs, and crypto exchanges could be banned, making on/off-ramps virtually non-existent, aside from the occasional hand-to-hand irl exchange. People could still get paid in Bitcoin but practically nobody would accept it (no network effect, no utility).</p>
<p>The fact that this didn't happen makes 2 things most likely — either Bitcoin poses no real threat to the financial system (unlikely I think) or it was created by the government in the first place. This theory is further supported by the fact that Bitcoin came out of the USA, and specifically at a time of an uncontrollable debt crisis. If it was intended as a debt-clearing tool, it also gives the USA a big advantage for adopting it before other nations. If you look into the people and companies who are pushing for its adoption — in Trump's administration and its proximity — you'll find many odd connections and perverse incentives.</p>
<p>Further reading:<br />
The Bitcoin-Dollar: An Economic Monomyth — by Mark Goodwin</p>
]]>
      </content:encoded>
    </item>
    <item>
      <title>Odd meter folklore music</title>
      <link>https://mrnb.net/posts/001-odd-meter-folk-music</link>
      <guid isPermaLink="true">https://mrnb.net/posts/001-odd-meter-folk-music</guid>
      <description>I found some folklore music with odd time signatures. It's pretty rare for folk music. Letovanić (Croatia) Kaval sviri (Bulgaria)</description>
      <content:encoded>
        <![CDATA[<h1><a href="#odd-meter-folklore-music" aria-hidden="true" class="anchor" id="odd-meter-folklore-music"></a>Odd meter folklore music</h1>
<p>I found some folklore music with odd time signatures. It's pretty rare for folk music.</p>
<p><a href="https://www.youtube.com/watch?v=C8AmKKBBzz0">Letovanić</a> (Croatia)</p>
<p><a href="https://www.youtube.com/watch?v=hVqrW-fPOQ0">Kaval sviri</a> (Bulgaria)</p>
]]>
      </content:encoded>
    </item>
  </channel>
</rss>
