<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nelson Figueroa</title>
    <description>The latest articles on DEV Community by Nelson Figueroa (@nelsonfigueroa).</description>
    <link>https://dev.to/nelsonfigueroa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F924322%2F83739220-86e7-4bde-997d-68de51010e3d.jpg</url>
      <title>DEV Community: Nelson Figueroa</title>
      <link>https://dev.to/nelsonfigueroa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nelsonfigueroa"/>
    <language>en</language>
    <item>
      <title>I Created My First AI-assisted Pull Request and I Feel Like a Fraud</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Mon, 23 Mar 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/i-created-my-first-ai-assisted-pull-request-and-i-feel-like-a-fraud-1moj</link>
      <guid>https://dev.to/nelsonfigueroa/i-created-my-first-ai-assisted-pull-request-and-i-feel-like-a-fraud-1moj</guid>
      <description>&lt;p&gt;I created &lt;a href="https://github.com/alecthomas/chroma/pull/1228" rel="noopener noreferrer"&gt;my first AI pull request&lt;/a&gt; for &lt;a href="https://github.com/alecthomas/chroma" rel="noopener noreferrer"&gt;Chroma&lt;/a&gt;, which is the default syntax highlighter used in &lt;a href="https://github.com/gohugoio/hugo" rel="noopener noreferrer"&gt;Hugo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I used Claude Code for that PR. I didn’t learn anything. I felt like I was flinging slop over the wall to an open-source maintainer. I felt like a fraud and my impostor syndrome got worse.&lt;/p&gt;

&lt;p&gt;But here’s the thing, I still contributed something of value. It’s something I have been wanting in hugo for a long time to syntax highlight &lt;a href="https://github.com/ruby/erb" rel="noopener noreferrer"&gt;ERB&lt;/a&gt; snippets in my posts. It was approved and merged by the maintainer (thanks for dealing with my slop, &lt;a href="https://github.com/alecthomas" rel="noopener noreferrer"&gt;Alec&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It just feels odd. I know there are many people that are excited this new era of writing code. But to me this has sucked out all of the fun. I have never felt like a bigger fraud in this field. I’ve always thought that I’m privileged that I get to have fun at all in my line of work. As Ori Bernstein says: &lt;a href="https://orib.dev/nofun.html" rel="noopener noreferrer"&gt;“using LLMs to write code is as fun as hiring a taskrabbit to solve my jigsaw puzzles”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But then again, I know that realistically I would not have the mental capacity or skill to create a pull request like that without AI tooling. My brain is already fried from work on most days. I don’t think I would have been able to learn the codebase and get enough context to make that PR all by myself. It’s a lot. I just wanted some ERB syntax highlighting for my little blog.&lt;/p&gt;

&lt;p&gt;Even at work I’ve used Claude Code and other AI tooling to deliver fixes and improvements that have real customer impact. But no matter how big the impact, I feel empty. I agree with Xe Iaso in the first sentence of their post: &lt;a href="https://xeiaso.net/blog/2026/ai-abstraction/" rel="noopener noreferrer"&gt;“Whenever I have Claude do something for me, I feel nothing about the results”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now that using AI is a normal expectation at work and how I’m evaluated in performance reviews, I suspect that this fraud feeling will only grow. The industry as a whole is incentivizing delivering code/features/fixes at a quick pace even if it’s all just slop.&lt;/p&gt;

&lt;p&gt;I keep thinking a lot about how I perhaps tied my identity too much to my career. I’m not the greatest engineer, but I’ve always worked hard to deliver good work and learn as much as possible. I care a lot about understanding underlying systems as much as possible. I care about the craftsmanship of my code (to the best of my abilities). Unlike me, AI tools don’t care about any of these values.&lt;/p&gt;

&lt;p&gt;At the end of the day, the shareholders care about delivering features, gaining customers, and making money. They don’t care how software is built.&lt;/p&gt;

&lt;p&gt;I don’t know what to make of this.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Adding Headers to HTTP Requests in Go</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Fri, 30 Jan 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/adding-headers-to-http-requests-in-go-1k5n</link>
      <guid>https://dev.to/nelsonfigueroa/adding-headers-to-http-requests-in-go-1k5n</guid>
      <description>&lt;p&gt;Go has several ways of sending requests, including some convenient methods such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http.Get()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http.Head()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http.Post()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http.PostForm()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, these don’t let you add headers to requests! If you need customization of the HTTP method or headers, you need to use &lt;code&gt;http.NewRequest()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There are three parts to this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a request using &lt;code&gt;http.NewRequest()&lt;/code&gt; where you specify the HTTP method and URL&lt;/li&gt;
&lt;li&gt;Add headers to the request with &lt;code&gt;Header.Set()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Send the request using &lt;code&gt;http.Client{}&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s a full example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// create the client that will send the request later&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;

    &lt;span class="c"&gt;// create a request with NewRequest, specifying HTTP method and URL&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"https://example.com/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// handle any errors however you'd like&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// add headers to the request&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"User-Agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Accept-Language"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"en-US,en;q=0.9"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Accept-Encoding"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"gzip, deflate"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Sec-GPC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Connection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"keep-alive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;// use the client to actually send the request&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// handle any errors however you'd like&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;req.Header.Set()&lt;/code&gt; can be used to set a header but will _ &lt;strong&gt;overwrite&lt;/strong&gt; _ any existing value for that header.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;req.Header.Add()&lt;/code&gt; can be used to add a value to a header and will &lt;strong&gt;append&lt;/strong&gt; to any existing value for that header.&lt;/p&gt;

&lt;p&gt;For the purposes of this blog post we only need to worry about setting the header once, hence the usage of &lt;code&gt;req.Header.Set()&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Similar to my &lt;a href="https://nelson.cloud/using-time.sleep-in-go/" rel="noopener noreferrer"&gt;“Using time.Sleep() in Go”&lt;/a&gt; post, I wrote this up because the Go docs are too dense and I just needed one full example to understand it and get going.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pkg.go.dev/net/http" rel="noopener noreferrer"&gt;https://pkg.go.dev/net/http&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>go</category>
    </item>
    <item>
      <title>Using time.Sleep() in Go</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Thu, 29 Jan 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/using-timesleep-in-go-3jn</link>
      <guid>https://dev.to/nelsonfigueroa/using-timesleep-in-go-3jn</guid>
      <description>&lt;h2&gt;
  
  
  Basic Usage of &lt;code&gt;time.Sleep()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;You can use &lt;code&gt;time.Sleep()&lt;/code&gt; to pause your program for a predetermined amount of time, similar to most programming languages.&lt;/p&gt;

&lt;p&gt;First, you should know that the &lt;code&gt;time&lt;/code&gt; package has useful constants that allow you to conveniently specify time in units.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;Nanosecond&lt;/span&gt; &lt;span class="n"&gt;Duration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;Microsecond&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;Nanosecond&lt;/span&gt;
    &lt;span class="n"&gt;Millisecond&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;Microsecond&lt;/span&gt;
    &lt;span class="n"&gt;Second&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;Millisecond&lt;/span&gt;
    &lt;span class="n"&gt;Minute&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;Second&lt;/span&gt;
    &lt;span class="n"&gt;Hour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;Minute&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They’re accessed with the &lt;code&gt;time.&amp;lt;Constant&amp;gt;&lt;/code&gt; notation. (e.g. &lt;code&gt;time.Second&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;You can use these constants with the &lt;code&gt;time.Sleep()&lt;/code&gt; function. For example, if we want to pause execution for 1 second, we can write the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"one second will pass between this message..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"...and this message"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can do some multiplication with &lt;code&gt;time.Second&lt;/code&gt; to pause a program for 30 seconds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"30 seconds will pass between this message..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"...and this message"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can do multiplication with all of the other constants mentioned as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;p&gt;Here are some more examples using the other constants.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sleep for 500 milliseconds
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Millisecond&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sleep for 10 seconds
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sleep for 5 minutes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Minute&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sleep for 2 hours
&lt;/h3&gt;

&lt;p&gt;Not really sure why you would use this, but just know it’s possible.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Hour&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pkg.go.dev/time" rel="noopener noreferrer"&gt;https://pkg.go.dev/time&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My main motivation for writing this is that I think the official documentation is way too dense and doesn’t show several examples of &lt;code&gt;time.Sleep()&lt;/code&gt;. I just needed some examples to understand the syntax and move on with my day.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>go</category>
    </item>
    <item>
      <title>What I Actually Want To Say in Tech Interviews</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Mon, 29 Dec 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/what-i-actually-want-to-say-in-tech-interviews-48m9</link>
      <guid>https://dev.to/nelsonfigueroa/what-i-actually-want-to-say-in-tech-interviews-48m9</guid>
      <description>&lt;p&gt;&lt;strong&gt;&amp;gt; “Why do you want to work for our company?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your company has an opening that I believe I am qualified for that also pays more than my current position. I also need money to pay for bills, groceries, rent, and the overall cost of being alive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; “Why are you leaving your current company?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I found a job opening at your company that pays more than my current role.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; “What are you looking for in the next role?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A big pay bump. Opportunities to become better at software engineering would be cool too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; “What excites you about this role?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;This position at your company pays more than my current role.&lt;/li&gt;
&lt;li&gt;There may be more opportunities to grow as a software engineer. But mostly the first reason.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; “What are your salary expectations?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whatever the maximum of the salary range is for this position.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; “Where do you see yourself in 5 years?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the compensation for this position increases year to year and is in line with other top paying companies, I see myself staying at your company. It also helps if there are growth opportunities for me as a software engineer.&lt;/p&gt;

&lt;p&gt;Otherwise, I see myself at a different company from yours that pays more.&lt;/p&gt;




&lt;p&gt;On a more serious note…&lt;/p&gt;

&lt;p&gt;Don’t get me wrong, growing as a software engineer is still important to me. I want to work with great people and build cool things. It just sucks that I have to lie during interviews because honesty would get me disqualified. Doing 4+ rounds of interviews is already exhausting enough.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>GitHub Actions for Pulumi with an AWS S3 Backend</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Thu, 11 Dec 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/github-actions-for-pulumi-with-an-aws-s3-backend-467e</link>
      <guid>https://dev.to/nelsonfigueroa/github-actions-for-pulumi-with-an-aws-s3-backend-467e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a quick guide to set up GitHub Actions for Pulumi with an &lt;a href="https://aws.amazon.com/s3/" rel="noopener noreferrer"&gt;AWS S3&lt;/a&gt; Backend. There are some differences compared to running &lt;code&gt;pulumi&lt;/code&gt; commands locally. This guide assumes you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS S3 Bucket created and ready to be used with Pulumi&lt;/li&gt;
&lt;li&gt;An IAM User that has permissions to read/write to the S3 bucket&lt;/li&gt;
&lt;li&gt;The Access Key and Secret Access Key for the IAM User to use for authenticating to AWS within GitHub Actions&lt;/li&gt;
&lt;li&gt;A passphrase of your choosing that will be used to encrypt secrets in the pulumi stack&lt;/li&gt;
&lt;li&gt;A GitHub repository&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up Repository Secrets
&lt;/h2&gt;

&lt;p&gt;First, set up secrets on your GitHub repository. These will be filled in by GitHub Actions once we create a workflow YAML. You’ll need to create 3 secrets. You can name them whatever you want, but I’ll be naming them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PULUMI_CONFIG_PASSPHRASE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can create these by browsing to your GitHub repository &amp;gt; Settings &amp;gt; Secrets and variables &amp;gt; Actions. There are “Environment secrets” and “Repository secrets”. In this case go with “Repository secrets”.&lt;/p&gt;

&lt;p&gt;Create the three secrets and fill in their respective values. &lt;code&gt;PULUMI_CONFIG_PASSPHRASE&lt;/code&gt; can be whatever you want and doesn’t come from AWS. &lt;strong&gt;Make sure you don’t change this after the fact though, or your Pulumi state may break&lt;/strong&gt;. The end result should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsikluxa0aivnp6bbhqhc.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsikluxa0aivnp6bbhqhc.webp" alt="GitHub repository secrets showing AWS credentials and Pulumi passphrase" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining the GitHub Actions Workflow
&lt;/h2&gt;

&lt;p&gt;Next, clone the repository locally with &lt;code&gt;git clone&lt;/code&gt;. We’ll need to create a few files for a minimum viable Pulumi program. Run &lt;code&gt;pulumi new&lt;/code&gt; and it’ll guide you through the creation of a basic Pulumi program. The language you choose doesn’t matter.&lt;/p&gt;

&lt;p&gt;Then we can create the YAML file to set up GitHub Actions. Create a YAML file under &lt;code&gt;&amp;lt;your-repository-name&amp;gt;/.github/workflows/&lt;/code&gt;. I’ll call it &lt;code&gt;preview.yml&lt;/code&gt; in my example. Fill it in with the following YAML, changing values as needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pulumi&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt; &lt;span class="c1"&gt;# change this if you're using a different branch name&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;preview&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Preview&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pulumi Preview&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pulumi/actions@v6.6.1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;preview&lt;/span&gt;
          &lt;span class="na"&gt;stack-name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dev&lt;/span&gt; &lt;span class="c1"&gt;# change this to your stack's name (or whatever you want it to be if it doesn't exist)&lt;/span&gt;
          &lt;span class="na"&gt;cloud-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;s3://nelson-test-bucket-for-github-actions&lt;/span&gt; &lt;span class="c1"&gt;# change this to your bucket name to be used as a pulumi backend&lt;/span&gt;
          &lt;span class="na"&gt;upsert&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# creates a stack if it doesn't exist (along with Pulumi.&amp;lt;stack&amp;gt;.yaml)&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;AWS_ACCESS_KEY_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AWS_ACCESS_KEY_ID }}&lt;/span&gt;
          &lt;span class="na"&gt;AWS_SECRET_ACCESS_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AWS_SECRET_ACCESS_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;PULUMI_CONFIG_PASSPHRASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.PULUMI_CONFIG_PASSPHRASE }}&lt;/span&gt;
          &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt; &lt;span class="c1"&gt;# change the region as needed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This runs a &lt;code&gt;pulumi preview&lt;/code&gt; so it’ll veryify that everything is set up correctly without actually deplpoying anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the Workflow
&lt;/h2&gt;

&lt;p&gt;Now push your code to GitHub and see if the GitHub Action workflow ran successfully. You should see output from a successful &lt;code&gt;pulumi preview&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx20mqja14y0qy77g8izg.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx20mqja14y0qy77g8izg.webp" alt="GitHub Actions workflow logs showing successful Pulumi preview" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If this works, you should be good to go. You can update your Pulumi code and, change &lt;code&gt;command: preview&lt;/code&gt; to &lt;code&gt;command: up&lt;/code&gt; in the GitHub Actions YAML file and run it again to actually deploy some infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/pulumi/actions" rel="noopener noreferrer"&gt;https://github.com/pulumi/actions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>pulumi</category>
    </item>
    <item>
      <title>How to Actually Copy a List in Python</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Fri, 14 Nov 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/how-to-actually-copy-a-list-in-python-5g7j</link>
      <guid>https://dev.to/nelsonfigueroa/how-to-actually-copy-a-list-in-python-5g7j</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;tl;dr: use the &lt;code&gt;copy()&lt;/code&gt; method.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Say we have two Python lists – &lt;code&gt;list_a&lt;/code&gt; and &lt;code&gt;list_b&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If we try to make a copy of &lt;code&gt;list_a&lt;/code&gt; and assign it to &lt;code&gt;list_b&lt;/code&gt; using the assignment operator &lt;code&gt;=&lt;/code&gt;, what really happens is that both &lt;code&gt;list_a&lt;/code&gt; and &lt;code&gt;list_b&lt;/code&gt; point to the same memory address.&lt;/p&gt;

&lt;p&gt;That means that any list-manipulating actions that are done on either &lt;code&gt;list_a&lt;/code&gt; or &lt;code&gt;list_b&lt;/code&gt; will affect the same list in memory. We don’t have actually have two separate lists we can act upon.&lt;/p&gt;

&lt;p&gt;In the example below, although we append the integer &lt;code&gt;4&lt;/code&gt; to &lt;code&gt;list_a&lt;/code&gt;, we can see that printing out &lt;code&gt;list_b&lt;/code&gt; shows the newly added element. That’s because both list variables point to the same memory address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;list_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;list_a&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [1, 2, 3]
&lt;/span&gt;
&lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [1, 2, 3, 4]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output of the program above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1, 2, 3]
[1, 2, 3, 4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make an actual copy, use the &lt;code&gt;copy()&lt;/code&gt; method. Then, when &lt;code&gt;list_a&lt;/code&gt; is modified, it is independent of &lt;code&gt;list_b&lt;/code&gt;, because &lt;code&gt;list_b&lt;/code&gt; is stored in a separate memory address.&lt;/p&gt;

&lt;p&gt;Now if we append the same integer &lt;code&gt;4&lt;/code&gt; to &lt;code&gt;list_a&lt;/code&gt;, &lt;code&gt;list_b&lt;/code&gt; will be completely unaffected.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;list_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# using copy()
&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [1, 2, 3]
&lt;/span&gt;
&lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [1, 2, 3, 4]
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [1, 2, 3]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output of the program above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[1, 2, 3]
[1, 2, 3, 4]
[1, 2, 3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s more proof. We can print out the memory address of each variable to see when they’re the same and when they differ. We can do this using the &lt;code&gt;id()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;Here are the same lists from above but this time with their unique identifiers printed out. In this case, the IDs match because both &lt;code&gt;list_a&lt;/code&gt; and &lt;code&gt;list_b&lt;/code&gt; point to the same memory address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;list_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;list_a&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list_a address: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list_b address: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program above outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list_a address: 140226819497536
list_b address: 140226819497536
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The memory addresses are the same.&lt;/p&gt;

&lt;p&gt;Now let’s try the same thing but using the &lt;code&gt;copy()&lt;/code&gt; method instead of just an assignment operation with &lt;code&gt;=&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;list_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="n"&gt;list_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list_a address: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;list_b address: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program above outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list_a address: 140264515620480
list_b address: 140264514892160
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see the memory addresses are different (most obvious due to the ending digits).&lt;/p&gt;

&lt;p&gt;Although I’ve been in the field for some time, I still have my smooth brain moments. This is a reminder to myself (and whoever reads this) to remember the basics!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/python/python-list-copy-method/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/python/python-list-copy-method/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/python/id-function-python/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/python/id-function-python/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Creating High Quality GIFs from Asciinema Recordings</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Sat, 04 Oct 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/creating-high-quality-gifs-from-asciinema-recordings-4091</link>
      <guid>https://dev.to/nelsonfigueroa/creating-high-quality-gifs-from-asciinema-recordings-4091</guid>
      <description>&lt;p&gt;Say you have a recording created with &lt;a href="https://asciinema.org/?ref=nelson.cloud" rel="noopener noreferrer"&gt;Asciinema&lt;/a&gt; named &lt;code&gt;recording.cast&lt;/code&gt; and now you want to convert that into a GIF. You can use the &lt;code&gt;agg&lt;/code&gt; command (which is a &lt;a href="https://docs.asciinema.org/manual/agg/installation/" rel="noopener noreferrer"&gt;separate installation&lt;/a&gt; to convert it like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;agg recording.cast recording.gif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, if you run &lt;code&gt;agg&lt;/code&gt; with the default settings the resulting GIF won’t be high quality and it’ll look a little fuzzy.&lt;/p&gt;

&lt;p&gt;To get a high quality GIF you need to specify a big font size with the &lt;code&gt;--font-size&lt;/code&gt; option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;agg &lt;span class="nt"&gt;--font-size&lt;/span&gt; 64 recording.cast recording.gif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are two GIFs you can compare. The top one was created with the default &lt;code&gt;agg&lt;/code&gt; settings. The bottom one was created with &lt;code&gt;--font-size 64&lt;/code&gt;. Depending on your display, you may need to zoom in a bit to see the difference.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(Note: dev.to compresses gifs, you may need to do the comparison on the original link: &lt;a href="https://nelson.cloud/creating-high-quality-gifs-from-asciinema-recordings/" rel="noopener noreferrer"&gt;https://nelson.cloud/creating-high-quality-gifs-from-asciinema-recordings/&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7jboehyuvbi8kjo5gnd2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7jboehyuvbi8kjo5gnd2.gif" alt="pulumi up gif" width="772" height="509"&gt;&lt;/a&gt; &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flajuy8klkipk58k66p4s.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flajuy8klkipk58k66p4s.gif" alt="pulumi up gif in hd" width="3532" height="2329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s a noticeable difference. The trade-off here is that the higher quality GIF will be a bigger filesize, so be mindful of that. Try experimenting with different font sizes.&lt;/p&gt;

&lt;p&gt;I was expecting there to be some sort of &lt;code&gt;--size&lt;/code&gt; or &lt;code&gt;--quality&lt;/code&gt; option, but you just need to increase the font to get higher quality GIFs with &lt;code&gt;agg&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.asciinema.org/manual/agg/" rel="noopener noreferrer"&gt;https://docs.asciinema.org/manual/agg/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.asciinema.org/manual/agg/installation/" rel="noopener noreferrer"&gt;https://docs.asciinema.org/manual/agg/installation/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.asciinema.org/manual/agg/usage/" rel="noopener noreferrer"&gt;https://docs.asciinema.org/manual/agg/usage/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Quick Tip: Mute the Terminal Login Message with A .hushlogin File</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Sun, 28 Sep 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/quick-tip-mute-the-terminal-login-message-with-a-hushlogin-file-1jm9</link>
      <guid>https://dev.to/nelsonfigueroa/quick-tip-mute-the-terminal-login-message-with-a-hushlogin-file-1jm9</guid>
      <description>&lt;p&gt;Today I learned that you can create an empty &lt;code&gt;.hushlogin&lt;/code&gt; file in your home directory on macOS and Linux to hide the login message you get when starting up a new terminal window or tab.&lt;/p&gt;

&lt;p&gt;I tried this on macOS but it should work on Linux too.&lt;/p&gt;

&lt;p&gt;For example, when I start up a new terminal window/tab I see the following message:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyun31r3kjldya6woc4lf.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyun31r3kjldya6woc4lf.webp" alt="terminal with login message" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After I create the &lt;code&gt;.hushlogin&lt;/code&gt; file in my home directory, the login message goes away. First I created the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch ~/.hushlogin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I opened a new terminal window to verify that the message no longer shows up:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpiwpsuahi1enrg4u8wrj.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpiwpsuahi1enrg4u8wrj.webp" alt="terminal without login message after creating .hushlogin file" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/15769615/remove-last-login-message-for-new-tabs-in-terminal?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://stackoverflow.com/questions/15769615/remove-last-login-message-for-new-tabs-in-terminal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cyberciti.biz/howto/turn-off-the-login-banner-in-linux-unix-with-hushlogin-file/?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://www.cyberciti.biz/howto/turn-off-the-login-banner-in-linux-unix-with-hushlogin-file/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>How to Use an AWS S3 Bucket as a Pulumi State Backend</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Sat, 20 Sep 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/how-to-use-an-aws-s3-bucket-as-a-pulumi-state-backend-3bpk</link>
      <guid>https://dev.to/nelsonfigueroa/how-to-use-an-aws-s3-bucket-as-a-pulumi-state-backend-3bpk</guid>
      <description>&lt;p&gt;I’ll be starting from scratch and creating an IAM user with access to an S3 bucket that will be used to store the Pulumi state file. If you’re working in an enterprise setting, your authentication methods may vary.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The TL;DR is that you can run this if you already have an S3 bucket and AWS credentials configured on your machine:&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pulumi login 's3://&amp;lt;bucket-name&amp;gt;?region=&amp;lt;region&amp;gt;&amp;amp;awssdk=v2&amp;amp;profile=&amp;lt;aws-profile-name&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;This post assumes you have the Pulumi CLI installed. Check out the following guide if you don’t have it installed: &lt;a href="https://www.pulumi.com/docs/iac/download-install/?ref=nelson.cloud" rel="noopener noreferrer"&gt;Download &amp;amp; install Pulumi&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an S3 Bucket
&lt;/h2&gt;

&lt;p&gt;First, we need to create the S3 bucket where the Pulumi state file will be stored. I created a bucket called &lt;code&gt;nelsons-pulumi-state-backend&lt;/code&gt; and left all the default settings as-is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2wdc1omm6j6o4js4k6h.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2wdc1omm6j6o4js4k6h.webp" alt="S3 Bucket naming" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an IAM User
&lt;/h2&gt;

&lt;p&gt;Then we need to create an IAM user in AWS that the Pulumi CLI can use. This IAM user needs permissions to access the S3 bucket we just created.&lt;/p&gt;

&lt;p&gt;I go to IAM and create a new user. I just called it &lt;code&gt;pulumi&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetojv1xlhluaoch0e2n3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetojv1xlhluaoch0e2n3.webp" alt="Creating an IAM user" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then in the next step, I selected "Attach policies directly" and selected the AWS-managed “AdministratorAccess” policy just to keep things simple. You can provide more fine-grained access depending on your needs. Then click “Next” at the bottom.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r2rbplwzma94qv2bw1i.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r2rbplwzma94qv2bw1i.webp" alt="IAM permissions" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, double check everything and then click on “Create user”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zpuwdjfuhcgr2slt6kk.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zpuwdjfuhcgr2slt6kk.webp" alt="Reviewing IAM user" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we have a user with the appropriate permissions, we’ll need to get an AWS access key and secret to use with the Pulumi CLI.&lt;/p&gt;

&lt;p&gt;Go to your IAM user and click on "Create access key" on the right side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhgynsehpdsipyqbaxwl.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhgynsehpdsipyqbaxwl.webp" alt="The new IAM user" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, select “Command Line Interface (CLI)”. Check the box at the bottom, then click “Next”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2q308o4k82f4l1koncy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2q308o4k82f4l1koncy.webp" alt="Creating an access key" width="800" height="667"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next screen will ask for setting a description tag. This is optional. I chose to skip it and clicked on “Create access key”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3gsk80w4mj62e0upims.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3gsk80w4mj62e0upims.webp" alt="Access key description tag" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We finally have our Access key and Secret access key. Save these somewhere safe and click “Done”. (Don’t worry, the credentials in the screenshot are fake.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8roic8p8y1pff4or97q.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8roic8p8y1pff4or97q.webp" alt="Retrieving AWS access keys" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up AWS Credentials for the Pulumi CLI
&lt;/h2&gt;

&lt;p&gt;Now we can try using these credentials to tell the Pulumi CLI to use the S3 bucket as a backend.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that you do NOT need the &lt;a href="https://aws.amazon.com/cli/" rel="noopener noreferrer"&gt;AWS CLI&lt;/a&gt; installed. Pulumi just needs the AWS credentials.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Create the file &lt;code&gt;~/.aws/credentials&lt;/code&gt; if you don’t have it. Then add in your credentials there under the &lt;code&gt;[default]&lt;/code&gt; profile. (You can add more profiles, but this is beyond the scope of this post.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[default]
aws_access_key_id = &amp;lt;key_id&amp;gt;
aws_secret_access_key = &amp;lt;access_key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll need the bucket’s region and your local AWS profile name to use S3 as a backend.&lt;/p&gt;

&lt;p&gt;The command formula looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pulumi login 's3://&amp;lt;bucket-name&amp;gt;?region=&amp;lt;region&amp;gt;&amp;amp;awssdk=v2&amp;amp;profile=&amp;lt;aws-profile-name&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, the command looks like this (make sure to edit for your needs):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pulumi login 's3://nelsons-pulumi-state-backend?region=us-west-1&amp;amp;awssdk=v2&amp;amp;profile=default'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successful login shows the following message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Logged in to 0x6E.local as nelson (s3://nelsons-pulumi-state-backend?region=us-west-1&amp;amp;awssdk=v2&amp;amp;profile=default)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can add your backend to your &lt;code&gt;Pulumi.yaml&lt;/code&gt; file. This is useful if you're working on multiple Pulumi projects that each have different backends. You won't need to run &lt;code&gt;pulumi login&lt;/code&gt; all the time. Just add a &lt;code&gt;backend&lt;/code&gt; key and a nested &lt;code&gt;url&lt;/code&gt; key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-pulumi-project&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;a pulumi project for testing&lt;/span&gt;
&lt;span class="na"&gt;runtime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodejs&lt;/span&gt;

&lt;span class="c1"&gt;# add this section&lt;/span&gt;
&lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;s3://nelsons-pulumi-state-backend?region=us-west-1&amp;amp;awssdk=v2&amp;amp;profile=default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More information here: &lt;a href="https://www.pulumi.com/docs/iac/concepts/projects/project-file/" rel="noopener noreferrer"&gt;Pulumi project file reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing The Setup
&lt;/h2&gt;

&lt;p&gt;Finally, it’s time to test this out.&lt;/p&gt;

&lt;p&gt;To demonstrate, I created a simple Pulumi program by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pulumi new aws-python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can choose whatever language you want though.&lt;/p&gt;

&lt;p&gt;This is the main Pulumi code that is generated. It’s code for creating an S3 bucket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;An AWS Python Pulumi program&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pulumi&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pulumi_aws&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;

&lt;span class="c1"&gt;# Create an AWS resource (S3 Bucket)
&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Bucket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;my-bucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Export the name of the bucket
&lt;/span&gt;&lt;span class="n"&gt;pulumi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;export&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bucket_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I ran &lt;code&gt;pulumi up -y&lt;/code&gt; and it worked!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mkm5xcoe5l1fnioj0cf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mkm5xcoe5l1fnioj0cf.gif" alt="terminal output when running pulumi up -y" width="3532" height="2329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And just to double check, I can see that my previously empty S3 bucket now has contents created by the Pulumi CLI:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9ji9vqord4ni8w3wyyb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9ji9vqord4ni8w3wyyb.webp" alt="S3 Bucket with Pulumi state contents" width="800" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pulumi.com/docs/iac/download-install/?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://www.pulumi.com/docs/iac/download-install/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pulumi.com/registry/packages/aws/installation-configuration/?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://www.pulumi.com/registry/packages/aws/installation-configuration/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pulumi.com/docs/iac/concepts/state-and-backends/#aws-s3" rel="noopener noreferrer"&gt;https://www.pulumi.com/docs/iac/concepts/state-and-backends/#aws-s3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ashoksubburaj.medium.com/pulumi-with-aws-s3-as-backend-ac79533820f1?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://ashoksubburaj.medium.com/pulumi-with-aws-s3-as-backend-ac79533820f1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>devops</category>
      <category>pulumi</category>
    </item>
    <item>
      <title>It’s 2025, Why Aren’t You Using an Ad Blocker?</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Mon, 02 Jun 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/its-2025-why-arent-you-using-an-ad-blocker-1ema</link>
      <guid>https://dev.to/nelsonfigueroa/its-2025-why-arent-you-using-an-ad-blocker-1ema</guid>
      <description>&lt;p&gt;I find myself asking this any time I discover that someone uses a web browser with no ad blocking solution. More specifically, it blows my mind when tech-savvy people that work in software development (and related roles) don’t use ad blockers. I don’t understand why.&lt;/p&gt;

&lt;p&gt;The “main” web is a terrible experience when browsing without ad blockers.&lt;/p&gt;

&lt;p&gt;If you’re one of those people that doesn’t have an ad blocker here are some links to improve your web browsing experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Browser Extensions to Block Ads
&lt;/h2&gt;

&lt;p&gt;The best and arguably only ad blocker you’ll need for your browser is &lt;a href="https://github.com/gorhill/uBlock" rel="noopener noreferrer"&gt;uBlock Origin&lt;/a&gt;. It has worked consistently for me on Firefox and Chrome for many, many years.&lt;/p&gt;

&lt;p&gt;Here are some convenient links to get uBlock Origin:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://addons.mozilla.org/firefox/addon/ublock-origin/" rel="noopener noreferrer"&gt;Get the uBlock Origin Firefox extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chromewebstore.google.com/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm" rel="noopener noreferrer"&gt;Get the uBlock Origin Chrome extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://microsoftedge.microsoft.com/addons/detail/ublock-origin/odfafepnkmbhccpbejgmiehpchacaeak" rel="noopener noreferrer"&gt;Get the uBlock Origin Microsoft Edge extension&lt;/a&gt; (if you use Edge for some reason)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  For Safari Users
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.apple.com/safari/" rel="noopener noreferrer"&gt;Safari&lt;/a&gt; doesn’t support extensions like other browsers. While there is some tracking protection out of the box it doesn’t compare to uBlock Origin. If you REALLY want to keep using Safari then check out &lt;a href="https://adguard.com/adguard-mac/overview.html" rel="noopener noreferrer"&gt;AdGuard for Mac&lt;/a&gt;. It blocks ads system-wide on macOS and not just in Safari.&lt;/p&gt;

&lt;p&gt;If you like the Safari aesthetic but don’t want to install AdGuard, check out &lt;a href="https://kagi.com/orion/" rel="noopener noreferrer"&gt;Orion Browser&lt;/a&gt;. It comes with ad blocking out of the box. It’s based on &lt;a href="https://webkit.org/" rel="noopener noreferrer"&gt;WebKit&lt;/a&gt; just like Safari. There’s even an iOS app available.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kagi.com/orion/#download_sec" rel="noopener noreferrer"&gt;Get Orion for macOS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apps.apple.com/us/app/orion-browser-by-kagi/id1484498200" rel="noopener noreferrer"&gt;Get Orion for iOS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Brave Browser
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://brave.com/" rel="noopener noreferrer"&gt;Brave Browser&lt;/a&gt; is also a great browser if you want an ad-free web experience. It’s available on all major platforms (Windows, Android, Linux, macOS, iOS) and it comes with ad blocking built in. I hesitate a bit to recommend Brave because it comes with some optional &lt;a href="https://brave.com/brave-rewards/" rel="noopener noreferrer"&gt;crypto BS&lt;/a&gt; called &lt;a href="https://basicattentiontoken.org/" rel="noopener noreferrer"&gt;Basic Attention Token&lt;/a&gt;, but you don’t have to opt into that.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://brave.com/download/" rel="noopener noreferrer"&gt;Get Brave Browser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Start Browsing the Web with Ad Blockers
&lt;/h2&gt;

&lt;p&gt;There are many options for blocking ads regardless of the device you’re using. Start browsing the web with an ad blocker and you’ll never go back to browsing the normal ad-infested web.&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Validate HTTP Status Codes in Go Using Built-in Constants</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Sat, 24 May 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/validate-http-status-codes-in-go-using-built-in-constants-bdd</link>
      <guid>https://dev.to/nelsonfigueroa/validate-http-status-codes-in-go-using-built-in-constants-bdd</guid>
      <description>&lt;h2&gt;
  
  
  Constants to Use When Checking for HTTP Status Codes
&lt;/h2&gt;

&lt;p&gt;Go has useful &lt;a href="https://pkg.go.dev/net/http#pkg-constants" rel="noopener noreferrer"&gt;constants in the net/http package&lt;/a&gt; that can make your code more readable when checking for status codes in responses.&lt;/p&gt;

&lt;p&gt;For example, instead of writing something like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// do something if the status code is 200&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can write&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// do something if the status code is 200&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unfortunately the the link doesn’t show any any full, working examples. So here’s an example covering some of the more common http status codes that you can use and modify as needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"log"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatalf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"error: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 200&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ok!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 301&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusMovedPermanently&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"moved permanently"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 403&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusForbidden&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"forbidden"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 404&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusNotFound&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"not found"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 429&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusTooManyRequests&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"too many requests"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 500&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusInternalServerError&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"internal server error"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Status code 502&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadGateway&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"bad gateway"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Turning Http Status Codes into Messsages with &lt;code&gt;Statustext()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;There’s also &lt;a href="https://pkg.go.dev/net/http#StatusText" rel="noopener noreferrer"&gt;a function &lt;code&gt;http.StatusText()&lt;/code&gt;&lt;/a&gt; that allows you to pass in status codes and get a message for logging purposes or displaying to users. You can see all the responses in &lt;a href="https://go.dev/src/net/http/status.go" rel="noopener noreferrer"&gt;the source code here&lt;/a&gt;, it’s a bunch of &lt;code&gt;case&lt;/code&gt; statements.&lt;/p&gt;

&lt;p&gt;For example, lets say we want to display a message if we don’t get a 200 status code. Instead of writing code to print out a different message depending on the status code value, we can use the &lt;code&gt;http.StatusText()&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"log"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://example.com/404"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c"&gt;// this URL returns a 404 status code&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatalf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"error: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusOK&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;// if it's not 200, print out a message depending on the status code&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c"&gt;// http.StatusText() is called here&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go run example.go

Not Found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Super convenient.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pkg.go.dev/net/http" rel="noopener noreferrer"&gt;https://pkg.go.dev/net/http&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://go.dev/src/net/http/status.go" rel="noopener noreferrer"&gt;https://go.dev/src/net/http/status.go&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>go</category>
    </item>
    <item>
      <title>How to Clone a Specific Git Branch Without Other Branches</title>
      <dc:creator>Nelson Figueroa</dc:creator>
      <pubDate>Thu, 27 Feb 2025 00:00:00 +0000</pubDate>
      <link>https://dev.to/nelsonfigueroa/how-to-clone-a-specific-git-branch-without-other-branches-2a6</link>
      <guid>https://dev.to/nelsonfigueroa/how-to-clone-a-specific-git-branch-without-other-branches-2a6</guid>
      <description>&lt;h2&gt;
  
  
  Cloning a Specific Branch
&lt;/h2&gt;

&lt;p&gt;To clone a specific branch of a git repository without cloning all other branches, use the following command formula:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --single-branch --branch &amp;lt;branch_name&amp;gt; &amp;lt;repo_URL.git&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, if you want to clone the &lt;code&gt;release-1.28&lt;/code&gt; branch of the &lt;a href="https://github.com/kubernetes/kubernetes/tree/release-1.28?ref=nelson.cloud" rel="noopener noreferrer"&gt;Kubernetes GitHub repository&lt;/a&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --single-branch --branch release-1.28 https://github.com/kubernetes/kubernetes.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cloning the Latest Commit of a Specific Branch
&lt;/h2&gt;

&lt;p&gt;If you only want to clone the latest commit of a specific branch (which results in a faster and smaller cloning operation) use &lt;code&gt;--depth 1&lt;/code&gt;. The command formula looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --single-branch --branch &amp;lt;branch_name&amp;gt; --depth 1 &amp;lt;repo_URL.git&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is another example using the &lt;code&gt;release-1.28&lt;/code&gt; branch of the &lt;a href="https://github.com/kubernetes/kubernetes/tree/release-1.28?ref=nelson.cloud" rel="noopener noreferrer"&gt;Kubernetes GitHub repository&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --single-branch --branch release-1.28 --depth 1 https://github.com/kubernetes/kubernetes.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-clone?ref=nelson.cloud" rel="noopener noreferrer"&gt;https://git-scm.com/docs/git-clone&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
