<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Colin Armstrong</title>
        <link>https://paragraph.com/@colins-blog</link>
        <description>Musings on tech &amp; web3 mostly. </description>
        <lastBuildDate>Mon, 24 Aug 2026 02:15:02 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>Colin Armstrong</title>
            <url>https://storage.googleapis.com/papyrus_images/5aaa6b1deddcc3c24b5d3d8a25bd50dd</url>
            <link>https://paragraph.com/@colins-blog</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[The data spectrum: portable, usable & interoperable]]></title>
            <link>https://paragraph.com/@colins-blog/data-spectrum</link>
            <guid>Q84ZW27O9QN4mRrX93rY</guid>
            <pubDate>Tue, 15 Oct 2024 07:00:00 GMT</pubDate>
            <description><![CDATA[Examining the differences between portable, usable, and interoperable data. ]]></description>
            <content:encoded><![CDATA[<h2>Portability</h2><p>Many platforms and companies enable users to <em>export </em>their data. Twitter lets you export your followers, Substack lets you export your email subscribers, and Facebook lets you export a list of all your Facebook friends.</p><p>This data is considered <strong>portable</strong>: you can export it, archive it, back it up, print it out, frame it - the choice is yours. </p><h2>Usability</h2><p>However, the <strong>usability</strong> of this portable data varies. While you can export your Twitter followers&apos; usernames, it doesn&apos;t grant you the ability to interact with them on other platforms or contact them outside Twitter. As such, Twitter data, though exportable, has limited usefulness.</p><p>Substack is a bit better: exporting a list of your subscriber&apos;s emails allows you to contact them directly.</p><p>The intersection of portability and usability can be visualized on a spectrum, with companies frequently moving along the scale as they evolve and achieve product-market fit (or, if they simply change their mind). Mailchimp allows users to export their subscriber emails but later changed their rules, <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://decrypt.co/107099/intuit-owned-mailchimp-is-banning-crypto-content-creators">locking out several cryptocurrency newsletters</a> from accessing their subscriber list and abruptly shifting their position on the spectrum, moving from portable &amp; usable to unportable.</p><p>The concept of data ownership is also relevant here. On Mailchimp, users technically did not own their email lists, as access to them could be revoked at any time. Truly owned data would always be both portable and usable, with no possibility for companies to alter the rules and restrict access.</p><p>Generally, companies lack incentives to make their data both portable and usable, as some degree of lock-in benefits them. For example, Twitter&apos;s network effects would be weakened if users could seamlessly migrate to Mastodon with a single click, taking their audience with them.</p><h2>Interoperability</h2><p>If a platform provides both portable &amp; usable data, it&apos;s generally easy for users to migrate to competitors if they decide they dislike the platform. Though, why should leaving the platform be the user&apos;s only option if they dislike a particular feature or want a specific functionality not offered? Why should there not be some level of extensibility built in by default, letting developers customize to their liking and giving users more choice?</p><p>This is where <em>interoperability</em> comes into play. If data and functionality is <em>interoperable, </em>it can be extended and augmented and modified and built upon. Data isn&apos;t just portable anymore - it&apos;s composable. </p><p>Interoperability typically occurs using APIs: companies can expose core bits of their product through APIs, allowing other developers to interact with the underlying data or functionality.</p><p>Like portability and usability, interoperability exists on a spectrum, ranging from non-interoperable (no APIs) to partially interoperable (exposing a subset of functionality) to fully interoperable. Again, like portability and usability, companies can and often do move along this spectrum.</p><p>Substack data is currently portable - you can export your email subscribers - but they offer no APIs, and thus no ability to customize or extend the platform beyond what they offer. </p><p>Twitter, on the other hand, famously had a thriving developer ecosystem - they had nearly full interoperability, letting developers build whatever they wish. Users had an array of choice in how to interact with their followers - if they disliked the official Twitter client they were free to use an array of others.  Retweets and other core primitives came as a result of developers - not Twitter! - building 3rd party apps. Then, some of these apps emerged as competitors, so Twitter crippled API access and shut them off.</p><p>Striving for full interoperability can align platform owners&apos; incentives with those of their users, encouraging competition based on product quality rather than lock-in. Though, even with fully interoperable platforms, there&apos;s no guarantees that they&apos;ll <em>continue </em>to be fully interoperable in the future, as evident by Twitter.</p><h2>The future</h2><p>Users &amp; developers alike should strive for portability, usability, and interoperability on the far end of the spectrum:</p><ul><li><p>Fully portable. Users can export it and take it elsewhere if they wish.</p></li><li><p>Completely usable. Exporting the data actually allows the user to make use of it elsewhere.</p></li><li><p>Entirely interoperable. All data &amp; features are exposed via APIs, letting developers extend &amp; build upon functionality.</p></li></ul><p>Of course, this is not sufficient - we also need strong guarantees that the level of portability, usability and interoperability won&apos;t change. To make these guarantees, the data needs to be owned by the user that created it or governed by some code that can&apos;t change. There can&apos;t be a centralized entity determining what data users are allowed to export, or what functionality is exposed via APIs (and how), since we&apos;ve seen repeatedly that rules can be changed on a whim.</p><p>Building on top of sufficiently decentralized protocols and their associated primitives - not platforms - can help provide these guarantees. Networks like Ethereum, applications like Farcaster, and primitives like NFTs are making strides toward this future. For a developer building on top of Ethereum and using NFTs as a core primitive, there are protocol-level guarantees that rules won&apos;t abruptly change.  </p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
            <category>web3</category>
            <enclosure url="https://storage.googleapis.com/papyrus_images/e77ae33a84f091e45d7ed963b2bb8bb9.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Wallets instead of emails for identity]]></title>
            <link>https://paragraph.com/@colins-blog/identity-wallets-over-emails</link>
            <guid>qgbk0OA1X0g5ulLoaUn0</guid>
            <pubDate>Sat, 14 Jan 2023 17:51:00 GMT</pubDate>
            <description><![CDATA[Wallets and wallet-enabled social protocols unlock many identity improvements for users & developers alike.]]></description>
            <content:encoded><![CDATA[<h2>Email</h2><p>Most websites require your email address for creating an account. Email-based authentication allow the website to 1) contact you and 2) uniquely identify you. </p><p>Email does a good job at enabling contact - you can retrieve forgotten passwords just as easily as you can email your Grandmother - but it does a pretty poor job at identifying you. Given your email address, there&apos;s no understanding nor context <em>about you</em>, the user. Because of this, companies like Clearbit have built large businesses around enriching email addresses with data sourced from around the web, to make them more useful as identities.</p><h2>OAuth</h2><p>This lack of context &amp; understanding is in contrast to other common mechanisms of identifying users, such as OAuth. Login with Google, Twitter or Facebook are a few examples of OAuth-based logins that go beyond just an identity - they let 3rd party developers tap into the closed data these companies have (for better or for worse).</p><img src="https://storage.googleapis.com/papyrus_images/0e58b7ceb3356adde117f7073340b474.jpg" blurDataURL="data:image/jpeg;base64,/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAEAAIDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAdEAACAgIDAQAAAAAAAAAAAAABAgMEAAUGESFh/8QAFQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCwt6fQ0rc1WLjejaOB2iVnpqWIU9An75jGMoP/2Q==" width="344" float="none" class="image-node img-center embed"><p>This helps identifiers moves beyond <strong>just</strong> an identifier, and toward becoming a <strong>user</strong>, with interests, friends, contacts, followers, profile pictures, genders, birthdates, and more.</p><p>This is powerful. As a developer, supporting “Login with [social platform]” lets you tap into this enriched data for numerous things:</p><ul><li><p>Bootstrap network effects <em>(eg prompting users to subscribe to all their Twitter followers immediately after registration)</em></p></li><li><p>Provide mechanisms of virality <em>(eg automatically crosspost content they create to Facebook)</em></p></li><li><p>Provide better onboarding<em> (eg pre-populating user accounts with avatars, interests and more)</em></p></li></ul><p>There are several downsides to this method of OAuth based authentication, for both developers building atop these platforms and for users that authenticate with them: </p><ul><li><p><strong>Platforms can change the rules. </strong>Developers are constrained by what platforms allow. Google and Facebook are <em>not </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://nakamoto.com/credible-neutrality/">credibly neutral</a> open protocols - they&apos;re closed platforms with everchanging functionality. There have been <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://geoawesomeness.com/developers-up-in-arms-over-google-maps-api-insane-price-hike/">many</a> different <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://www.theregister.com/2012/08/17/twitter_api_rules/">instances</a> in the past where platforms changed the rules and crippled developers building atop of them.</p></li><li><p><strong>Developers get an incomplete picture. </strong>A user&apos;s audience is commonly split across multiple platforms. OAuth&apos;ing with Facebook isn’t very beneficial to myself or the developer&apos;s app if 90% of my social graph exists on Twitter. It&apos;s unrealistic for developers to request or expect users to manually link with every single social platform to get a full picture.</p></li><li><p><strong>User&apos;s can&apos;t exit with interoperability. </strong>If I decide I want to exit Twitter after the Elon Musk acquisition, it’s not possible to export my Twitter followers and use it elsewhere. Even worse - if Twitter decides to ban me, that’s it: there’s no way 3rd party developers building atop Twitter can make use of this data anymore. </p></li></ul><h2>Wallets</h2><p>Using cryptowallets alongside crypto-enabled social protocols are an alternative that I believe will bridge the gap between an <strong><em>identity</em></strong> and a <strong><em>user</em></strong> and improve upon the aforementioned issues:</p><ul><li><p>They are credibly neutral. Building atop <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://www.varunsrinivasan.com/2022/01/11/sufficient-decentralization-for-social-networks">sufficiently decentralized</a> <em>protocols, </em>not<em> platforms,</em> guarantee that the underlying functionality won&apos;t change after I, as a developer, built a sustainable business.</p></li><li><p>It&apos;s easier to get a full picture of a user&apos;s social graph. As a developer, I can permissionlessly ingest <em>the full social graphs </em>of all web3 social platforms, just given a user&apos;s wallet address with no intervention from the user needed. If a user has never used Farcaster but is active on Lens, no problem -- I can still programmatically ingest both to get the complete picture.</p></li><li><p>Users can exit with interoperability. If users dislike (or are banned from) a specific client built atop a certain social graph, they can move to another client and continue interacting with the followerbase they&apos;ve built at the protocol-level. Similarly, developers can continue making use of all the underlying data.</p></li></ul><p>Though, crypto wallets are not without downsides. Adoption is currently low - everyone has an email but not everyone has a crypto wallet. Additionally, emails allow for easy message exchange but wallets currently do not (though many protocols are trying to fix this), so it&apos;s challenging to reach users strictly by their wallets. Lastly, privacy controls are non-existent: if I <em>didn’t</em> want to share a list of my on-chain followers with a certain platform, there’s no current method of preventing this (in contrast to the granular, user-controlled permissions that OAuth uses).</p><p>At <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://paragraph.xyz">Paragraph</a>, we&apos;ve built <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://paragraph.xyz/@blog/discovery">several integrations</a> involving wallets-as-an-identity and it’s been a very positive experience. For example, when a user connects their wallet and signs in, we detect if they have a Faracaster account. If so, we permissionlessly pull in their avatar, name, &amp; users they’re following, and bootstrap their Paragraph account by prompting them to subscribe to their followers. No gatekeeping, no OAuth, no action needed from the user - nothing beyond just a wallet address &amp; credibly neutral social protocols.</p><p>Collect this post as an NFT:</p><div data-type="highlightEmbed" nftId="63c2e9fe3de4fce815d46692" imgUrl="https://highlight-creator-assets.highlight.xyz/main/image/6a0fc1e1-f184-4f58-9cd4-1301bcea3fea">
    <img src="https://highlight-creator-assets.highlight.xyz/main/image/6a0fc1e1-f184-4f58-9cd4-1301bcea3fea" 
    style="
    width: 100;
    margin-left: auto;
    margin-right; auto;
    "
    />
    <div style="text-align: center;">
        <a  style="
    display: inline-block;
    border-radius: 4px;
    margin-top: 4px;
    background-color: rgb(59, 130, 246);
    padding: 16px 24px;
    font-weight: 600;
    line-height: 100%;
    color: rgb(255, 255, 255);
    text-decoration: none;
    "
    href="https://mint.highlight.xyz/63c2e9fe3de4fce815d46692">
    Collect NFT
        </a>
      </div></div><p></p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
            <category>web3</category>
        </item>
        <item>
            <title><![CDATA[Spending time deliberately]]></title>
            <link>https://paragraph.com/@colins-blog/spending-time-deliberately</link>
            <guid>O9PaotreLmCkRcZXpY90</guid>
            <pubDate>Sun, 23 Oct 2022 22:16:09 GMT</pubDate>
            <description><![CDATA[Throughout any given day, my mood & state of mind fluctuates depending on many factors: quality of sleep, what I ate that day, how my personal relationships are going, how my company is doing, etc. Because of this, I try to avoid a fixed schedule as much as possible. I view my day as fluid: I hav...]]></description>
            <content:encoded><![CDATA[<p>Throughout any given day, my mood &amp; state of mind fluctuates depending on many factors: quality of sleep, what I ate that day, how my personal relationships are sgoing, how my company is doing, etc.</p><p>Because of this, I try to avoid a fixed schedule as much as possible. I view my day as fluid: I have a collection of different states of mind throughout the day, and I have a collection of work items that need to be done, so I try to match these up.</p><p>When I&apos;m feeling creative, I write code or do frontend design. When I&apos;m feeling insightful, I think about longer-term company strategy. When I&apos;m feeling extroverted, I focus on user outreach and customer conversations. Mapping my states of mind to the appropriate deliverable lends itself to my best work. The opposite is also true - forcing tasks in an improper state of mind often produces worse results.</p><p>This is a simplified view - it certainly won&apos;t be possible in all jobs or on all days - but I&apos;m fortunate enough right now that I&apos;m able to abide by this as much as possible, given that an early-stage startup has time spent mainly between building and talking to users (and both of these have a spectrum of sub-tasks that tap into different states of mind). This is in contrast to my time spent at Google, where I often had days filled with back-to-back meetings.</p><p>Deliberately <em>not </em>working is also important. If I&apos;m feeling awful and particularly unproductive, I prefer to make a conscious decision to step away and rest, in contrast to making little progress on something while beating myself up over the lack of productivity. </p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
        </item>
        <item>
            <title><![CDATA[Personal automation with Huginn using Slack, Docker and GCP]]></title>
            <link>https://paragraph.com/@colins-blog/personal-automation-with-huginn-using-slack-docker-and-gcp</link>
            <guid>gkvnjy0IJMVPtLbPAXnV</guid>
            <pubDate>Tue, 20 Sep 2022 20:52:20 GMT</pubDate>
            <description><![CDATA[Learn how to create an automated personal assistant with Huginn, and deploy it for free on GCP using Docker.]]></description>
            <content:encoded><![CDATA[<p><em>Paragraph is a blazing-fast, privacy-first, no-frills-attached blogging &amp; newsletter platform. </em><a target="_blank" rel="noopener noreferrer nofollow" href="https://paragraph.xyz?utm_source=papyrus&amp;utm_medium=colin_blogpost&amp;utm_campaign=huginn_blogpost"><em>Sign up</em></a><em> and </em>start<em> writing posts just like this one.</em></p><hr><p>Productivity &amp; automation tools can be powerful. I was delighted to come across a recent <a target="_blank" rel="noopener noreferrer nofollow" href="https://news.ycombinator.com/item?id=21772610">thread on Hacker News</a> discussing a supercharged automation tool: <a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/huginn/huginn">Huginn</a>. This open-source software performs automated tasks by using &apos;agents&apos; to watch for &apos;events&apos;, and triggering &apos;actions&apos; based on these events.</p><p>For example, if there&apos;s a sudden spike in discussion on Twitter with the terms &quot;San Francisco Earthquake&quot;, Huginn can send a text to my phone. Or, if a time-sensitive flight deal is posted on one of the many deal-finding websites out there, Huginn can send me an email with the price and a link to Google Flights.</p><p>Compared to other popular automation tools (IFTTT, Zapier), Huginn has the following benefits:</p><ul><li><p>Self-hosted &amp; completely private</p></li><li><p>Powerful data processing: write your own JS or use shell scripts</p></li><li><p>Liquid templating</p></li></ul><p>I wanted to go beyond just automation and introduce some organization - I wanted all notifications to be cataloged &amp; delivered in a centralized way. A personal Slack workspace seemed like the perfect solution for this - I can have a <code>#flights</code> channel for flight deals, or a <code>#trending</code> channel for the, er, pending San Francisco emergencies.</p><p>I also wanted all of this to be free. Huginn has pretty lax runtime resource requirements (even able to run on a <a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/huginn/huginn/wiki/Running-Huginn-on-minimal-systems-with-low-RAM-&amp;-CPU-e.g.-Raspberry-Pi">Raspberry Pi</a>, with some tweaking), so a free GCP micro tier instance was perfect for this.</p><h2>Automation Goals</h2><p>Let&apos;s formalize what I specifically wanted to accomplish with Huginn. Note that this is a small subset of the things possible with Huginn - check out the project&apos;s <a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/huginn/huginn#here-are-some-of-the-things-that-you-can-do-with-huginn">Github</a> for more inspiration.</p><ul><li><p><strong>Twitter notifications</strong>: whenever keywords of interest are tweeted (such as my projects or blog), I want to get notified immediately. Whenever a spike occurs for other keywords (&quot;San Francisco Emergency&quot;), notify me.</p></li><li><p><strong>Hacker news notifications</strong>: whenever an article hits the frontpage discussing something I&apos;m interested in, notify me.</p></li><li><p><strong>Flight deals</strong>: if a flight deal is posted online to one of the many websites I follow (Secret Flying, ThePointsGuy, FlyerTalk), and the flight originates from a nearby airport, notify me.</p></li><li><p><strong>Product deals</strong>: if a product I&apos;m interested in is posted on Slickdeals, notify me.</p></li><li><p><strong>Amazon price drops</strong>: if a product I&apos;m interested in drops below some predefined price threshold, notify me.</p></li></ul><p>I want all notifications to be sent to me via a personal Slack workspace, on different channels.</p><h2>Deploying Huginn</h2><h3>Prerequisites</h3><p>The easiest way to <a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/huginn/huginn/blob/master/doc/docker/install.md">install Huginn</a> is via Docker. Luckily, Google Compute Engine supports deploying Docker containers natively on a lean <a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.google.com/container-optimized-os/docs">container-optimized OS</a>.</p><p>There are a few key things we need to do in order to have a successful Huginn deploy on the f1-micro (free tier) instances.</p><p><strong>Enable and create a swap file</strong>.</p><p>f1-micro instances have 614MB of memory. This is not enough to run Huginn out of the box - doing so will cause Docker to encounter <code>Error Code 137</code> <a target="_blank" rel="noopener noreferrer nofollow" href="https://success.docker.com/article/what-causes-a-container-to-exit-with-code-137">(out of memory)</a> errors. To solve this, we need to create a swap file in the VM. Note that a swapfile will decrease the performance of Huginn - if you&apos;re interested in better performance for a price, consider deploying on a better VM.</p><p>Disk-based swap is <a target="_blank" rel="noopener noreferrer nofollow" href="https://stackoverflow.com/questions/58210222/how-to-enable-swap-swapfile-on-google-container-optimized-os-on-gce">disabled</a> by default in container-optimized OS. To enable and set the swap file every time the VM is booted, we can use a custom startup script (shown below).</p><p><strong>Mount the Huginn MySQL database to a directory on the host</strong>.</p><p>By default, Huginn creates a MySQL database inside the container. This is problematic, as the container now relies on <em>state</em>, and your database will <a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/huginn/huginn/blob/master/docker/multi-process/README.md">get deleted every Huginn upgrade</a>. We can use a volume mount to mount the database in the container to a directory in the host. Alternatively, you can mount a persistent disk and write the database to it.</p><h3>Deployment on GCP using Docker</h3><p>Head over to GCP, create a new project, and create a new instance.</p><p>On the instance creation page, use the following settings:</p><ul><li><p><code>f1-micro</code> machine type</p></li><li><p>Check &apos;Deploy a container image to this VM instance&apos;</p></li><li><p>Container image URL is <code>docker.io/huginn/huginn</code></p></li><li><p>Add a Directory volume mount. The mount and host paths should be <code>/var/lib/mysql</code></p></li></ul><p>We also need to add in a statup script. This script lets us 1) enable and turn on a swap file, and 2) change permissions of the volume mount on the host. The latter is required or MySQL won&apos;t be able to start.</p><pre><code>#! /bin/bash
sysctl vm.disk_based_swap=1
fallocate -l 2G /var/swapfile
chmod 600 /var/swapfile
mkswap /var/swapfile
swapon /var/swapfile
chmod 777 /var/lib/mysql</code></pre><p>After the VM is created, head to your VM&apos;s external URL (port 3000) and you should be greeted with the default Huginn login page!</p><p>I suggest <a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address">reserving a static external IP</a> for this VM, so the IP doesn&apos;t change. You can even take it a step further and associate this to a domain name - like <a target="_blank" rel="noopener noreferrer nofollow" href="http://automation.colinarms.com">automation.colinarms.com</a> - for ease of access.</p><p>Now, let&apos;s dive into Huginn.</p><h2>How Huginn Works: Agents &amp; Events</h2><p>At a high level, Huginn relies on two key things: agents and events. Agents are things that monitor for you and create events (possibly if some criteria is met). An example agent is an <code>RssAgent</code>, which monitors an RSS feed for new articles. Events created by the <code>RssAgent</code> can be passed to a <code>TriggerAgent</code>, which uses some regex filter to only listen to keywords of interest; and finally it emits a formatted message, perhaps to a <code>SlackAgent</code>, that finally sends a message to a Slack channel.</p><p>You can imagine how this works in practice. For the flight deals usecase, for example: we can create an <code>RssAgent</code> for the <a target="_blank" rel="noopener noreferrer nofollow" href="https://www.secretflying.com/feed/">Secret Flying RSS feed</a>. The <code>TriggerAgent</code> can listen to these events, filter for &quot;San Francisco Airport&quot;, and the <code>SlackAgent</code> can message my <code>#flights</code> channel when this happens</p><p>Multiple agents for a single usecase can be grouped into a <code>Scenario</code> - in the above example, a <code>Flight Deal Scenario</code> would make sense.</p><p>Let&apos;s walk through this example. If you want to get started immediately, you can <a target="_blank" rel="noopener noreferrer nofollow" href="https://gist.github.com/seeARMS/103b3399f3f925fb6c366600f0bad3c6">download my agents</a> and import them into Huginn directly.</p><h2>Creating your First Agent</h2><h3>1) Monitoring the RSS feed</h3><p>On Huginn, create a new RSS Agent. Configure the following params:</p><ul><li><p><strong>Name</strong> your agent something descriptive. I used &quot;Secret Flying RSS Agent&quot;.</p></li><li><p><strong>Schedule</strong> your agent for however frequently you&apos;d like it to check for updates. I used 30 mins.</p></li><li><p><strong>Keep events</strong> for some period of time. I used 7 days.</p></li></ul><p>Use the following JSON in the options:</p><pre><code>{
  &quot;expected_update_period_in_days&quot;: &quot;2&quot;,
  &quot;clean&quot;: &quot;true&quot;,
  &quot;url&quot;: &quot;https://www.secretflying.com/feed/&quot;
}
</code></pre><p>Expected update period is the period at which Huginn should expect the agent to be updated - if it doesn&apos;t happen, the agent is considered not working.</p><p>Save your agent, and give it a manual run - you should see events populate from the underlying feed.</p><h3>2) Filtering for nearby airports</h3><p>Now, create a <code>TriggerAgent</code>. We want to filter newly posted articles for only nearby airports - in my case, San Francisco or San Jose airport.</p><p>Fill it out similar to the first agent. But, this time select your RSS Agent as this agent&apos;s <code>source</code>. Events from the RSS Agent will be fed into this.</p><p>Use the following JSON in the options:</p><pre><code>{
  &quot;expected_receive_period_in_days&quot;: &quot;2&quot;,
  &quot;keep_event&quot;: &quot;false&quot;,
  &quot;rules&quot;: [
    {
      &quot;type&quot;: &quot;regex&quot;,
      &quot;value&quot;: &quot;(sfo|san francisco|sjc|san jose)&quot;,
      &quot;path&quot;: &quot;title&quot;
    }
  ],
  &quot;message&quot;: &quot;[Secret Flying] &lt;a href=\&quot;{{url}}\&quot;&gt;{{title}}&lt;\/a&gt; {{description}}&quot;
}
</code></pre><p>We&apos;re filtering the RSS feed&apos;s title to contain my nearby airports, and emitting a <code>message</code> with the URL, title and a description.</p><h3>3) Notifying on Slack</h3><p>Lastly, create a <code>SlackAgent</code>. After <a target="_blank" rel="noopener noreferrer nofollow" href="https://slack.com/get-started#/">registering a new Slack workspace</a> and <a target="_blank" rel="noopener noreferrer nofollow" href="https://my.slack.com/services/new/incoming-webhook">creating a new Slack webhook</a>, set the <code>source</code> to the Trigger Agent you just created.</p><p>Put the following JSON in the options:</p><pre><code>{
  &quot;webhook_url&quot;: &quot;https://hooks.slack.com/services/your-webhook-url&quot;,
  &quot;channel&quot;: &quot;#flights&quot;,
  &quot;username&quot;: &quot;Huginn&quot;,
  &quot;message&quot;: &quot;{{message}}&quot;,
  &quot;icon&quot;: &quot;&quot;
}
</code></pre><p>Save your agent, and eventually you should begin receiving flight deals!</p><div><div class="react-component" data-drag-handle="true" data-node-view-wrapper="" style="white-space:normal"><img src="https://storage.googleapis.com/papyrus_images/ee7b868109ff0eb7bb8dc89ed2920083" class="image-node img-center embed"/></div></div><h2>Wrapping it up</h2><p>This example describes a single usecase for what&apos;s possible with Huginn. If you&apos;re interested in the other usecases I described above, you can <a target="_blank" rel="noopener noreferrer nofollow" href="https://gist.github.com/seeARMS/103b3399f3f925fb6c366600f0bad3c6">download and import them</a> into your own installation.</p><p>This post just scratches the surface of what&apos;s possible. With Huginn, let your <code>Agents</code> monitor on your behalf and free up your time for more important things.</p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
            <category>tutorial</category>
            <category>automation</category>
        </item>
        <item>
            <title><![CDATA[NextJS: server-side and client-side mismatch]]></title>
            <link>https://paragraph.com/@colins-blog/nextjs:-server-side-and-client-side-mismatch</link>
            <guid>f46IGNuRHCoTlTXErJXJ</guid>
            <pubDate>Sat, 27 Nov 2021 04:24:25 GMT</pubDate>
            <description><![CDATA[Learn how to solve a mismatch between the server-side and client-side in NextJS.]]></description>
            <content:encoded><![CDATA[<p>NextJS is powerful: it brings together the best of server-side to the best of client-side. You can build powerful applications written in React, and produce a static website which has all the speed of a regular ol’ CDN-backed website. Despite the benefits, you may sometimes hit some challenges working with both server-side rendering (SSR) and client-side hydration. One of the more common errors is when the server-side and client-side DOM doesn’t match. NextJS might complain:</p><pre class="dont-break-out text-sm md:text-base"><code>Expected server HTML to contain a matching &lt;div&gt; in &lt;div&gt;
</code></pre><pre class="dont-break-out text-sm md:text-base"><code>Warning: Text content did not match. Server: &quot;Log in&quot; Client: &quot;Continue to dashboard&quot;
</code></pre><p>Additionally, the HTML (in particular, the DOM elements) may not render correctly when viewing the webpage.</p><h1>Why is this happening?</h1><p>NextJS uses both server-side and client-side rendering together. The server serves static HTML whenever possible, and the client hydrates it to give full interactivity. If you manipulate the DOM at any time between when the server-side HTML is served and the client-side is rendered, there will be a mismatch and React will not be able to hydrate the DOM successfully. Thus, <strong>the first render of any page must match the initial render of the server</strong>. This is explained more in-depth in <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out " href="https://github.com/vercel/next.js/discussions/17443">this Github issue.</a> I encountered this issue when relying on cookies. I was doing something like this:</p><pre class="dont-break-out text-sm md:text-base"><code>const user = Cookies.get(&apos;jwt&apos;)
if (user?.id) {
   return &lt;span&gt;User logged in!&lt;/span&gt;
}
return &lt;span&gt;User not logged in!&lt;/span&gt;
</code></pre><p>Cookies are only accessible in the browser, so when the server provides the static HTML the user would not be logged in, but when the client is rendered, the user would be logged in! Hence, there is a mismatch and NextJS will complain.</p><h1>How do I fix this?</h1><p>Put all browser-only code inside <code>useEffect</code>. This ensures that the client is rendered before the DOM is updated. This means the client-side and server-side DOM will match.</p><blockquote><p>JS Tip: <code>useEffect</code> is a <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out " href="https://reactjs.org/docs/hooks-effect.html">React hook</a> that lets you issue side effects - such as updating the DOM - after the page or component is mounted. The above example can be refactored:</p></blockquote><pre class="dont-break-out text-sm md:text-base"><code>const [isUserLoggedIn, setIsUserLoggedIn] = useState(false)
const user = Cookies.get(&apos;jwt&apos;)
useEffect(() =&gt; {
  setIsUserLoggedIn(!!user?.id)
}, [user])
if (isUserLoggedIn) {
  return &lt;span&gt;User logged in!&lt;/span&gt;
}
return &lt;span&gt;User not logged in!&lt;/span&gt;
</code></pre><p>The error goes away!</p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
            <category>quicktips</category>
            <category>react</category>
            <category>nextjs</category>
        </item>
        <item>
            <title><![CDATA[Photoshop Hijacks Your Cursor]]></title>
            <link>https://paragraph.com/@colins-blog/photoshop-hijacks-your-cursor</link>
            <guid>ayzl8kIQ1EGu3GBe7DRT</guid>
            <pubDate>Fri, 26 Nov 2021 03:26:14 GMT</pubDate>
            <description><![CDATA[I came across an interesting webdev bug today. For some reason, on my site, my cursor was not working correctly. When hovering over links or buttons or elements that set  cursor: pointer , my cursor did not turn into a pointer hand; instead, it stayed as a regular ol’ cursor. This was odd. I didn...]]></description>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
        </item>
        <item>
            <title><![CDATA[Automatically remove unused imports & variables in Vim using ALE and ESLint]]></title>
            <link>https://paragraph.com/@colins-blog/automatically-remove-unused-imports-and-variables-in-vim-using-ale-and-eslint</link>
            <guid>rMPCaS1q9DlE57kN2LOK</guid>
            <pubDate>Fri, 12 Nov 2021 00:27:30 GMT</pubDate>
            <description><![CDATA[Use the power of Vim, ALE and ESLint to automagically remove all unused imports from your Javascript files.]]></description>
            <content:encoded><![CDATA[<p><em>Paragraph is a blazing-fast, privacy-first, no-frills-attached blogging platform. </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://papyrus.dev?utm_source=papyrus&amp;utm_medium=blogpost&amp;utm_campaign=unused_imports_vim_ale"><em>Sign up</em></a><em> and start writing posts just like this one.</em></p><hr><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://github.com/eslint/eslint">ESLint</a> provides checks (and auto-fixes!) for a large list of Javascript and Typescript violations. Paired with a Vim plugin called <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://github.com/dense-analysis/ale">ALE</a>, these fixes can run on every save.</p><p>This blogpost details how to set up ESLint and ALE in Vim, and uses a single usecase - removing unused imports &amp; variables - as an illustration of how powerful these tools are.</p><img src="https://storage.googleapis.com/papyrus_images/d4746c5999e28bd839764a46e87ec096" alt="" float="none" class="image-node img-center embed"><h3>Unused Imports &amp; Variables</h3><p>At the start of a a new React project, I create many different components, and I bootstrap them by copying &amp; pasting component files. This can quickly lead to a large mess of unused imports &amp; variable declarations:</p><p>Let’s see how we can remove them - automatically - using the power of ESLint and Vim.</p><img src="https://storage.googleapis.com/papyrus_images/b927ecacf802db7ad5d5c9d2f8bbc057" alt="" float="none" class="image-node img-center embed"><h3>Configuring ESLint</h3><p>The core solution to this problem is a handy ESLint plugin called <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://www.npmjs.com/package/eslint-plugin-unused-imports">eslint-plugin-unused-imports</a>. (Other solutions I found online rely on TSList, which is deprecated, so an ESLint-based solution is preferred).</p><p>Let’s install ESLint, as well as the <code>eslint-plugin-unused-imports</code> plugin:</p><pre class="dont-break-out text-sm md:text-base"><code>yarn add -D eslint
yarn add -D eslint-plugin-unused-imports
</code></pre><p>Now, modify your <code>.eslintrc</code> to enable the plugin:</p><pre class="dont-break-out text-sm md:text-base"><code>// .eslintrc

{
	&quot;plugins&quot;: [&quot;unused-imports&quot;]
}
</code></pre><p>Configure your ESLint rules to error on unused imports or unused variables:</p><pre class="dont-break-out text-sm md:text-base"><code>// .eslintrc

{
	&quot;rules&quot;: {
		&quot;no-unused-vars&quot;: &quot;off&quot;, // or &quot;@typescript-eslint/no-unused-vars&quot;: &quot;off&quot;,
		&quot;unused-imports/no-unused-imports&quot;: &quot;error&quot;,
		&quot;unused-imports/no-unused-vars&quot;: [
			&quot;warn&quot;,
			{ &quot;vars&quot;: &quot;all&quot;, &quot;varsIgnorePattern&quot;: &quot;^_&quot;, &quot;args&quot;: &quot;after-used&quot;, &quot;argsIgnorePattern&quot;: &quot;^_&quot; }
		]
	}
}
</code></pre><p>Now, we should see <code>unused-imports/no-unused-imports</code> detecting the unused imports (instead of no-unused-vars, as in the screenshot above):</p><p>And running <code>eslint --fix</code> should automatically remove these imports!</p><p>We can do better, though - let’s configure Vim to auto-fix on every save.</p><h3>Setting up ALE to auto-fix on save</h3><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://github.com/dense-analysis/ale">ALE</a> is a plugin for Vim and NeoVim that lints as you type, and auto-fixes syntax and semantic errors. It uses ESLint (and many other extensible tools) underneath to perform the actual fixing logic.</p><p>Install ALE by <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out dont-break-out" href="https://github.com/dense-analysis/ale#3-installation">following the instructions</a> and using Pathogen, Vundle, Plug, or one of the other installation options.</p><p>After installing ALE, edit your <code>.vimrc</code> file set two options:</p><ol><li><p><code>let g:ale_fixers</code> - Run ESLint as a fixer in your relevant filetypes, which lets ALE tap into ESLint for fixing files</p></li><li><p><code>let g:ale_fix_on_save</code> - Automatically run all fixers on save</p></li></ol><p>It’ll look something like this:</p><pre class="dont-break-out text-sm md:text-base"><code>// .vimrc

let g:ale_fix_on_save = 1
let g:ale_fixers = {
\   &apos;javascript&apos;: [&apos;eslint&apos;],
\   &apos;typescript&apos;: [&apos;eslint&apos;],
\   &apos;typescriptreact&apos;: [&apos;eslint&apos;],
\}
</code></pre><p>Now, every time you save a <code>js</code>, <code>ts</code> or <code>tsx</code> file, <code>eslint --fix</code> will automatically run and clean up your imports &amp; unused variables!</p>]]></content:encoded>
            <author>colins-blog@newsletter.paragraph.com (Colin Armstrong)</author>
            <category>react</category>
            <category>javascript</category>
            <category>vim</category>
            <category>quicktips</category>
        </item>
    </channel>
</rss>