<?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: Steve Baker</title>
    <description>The latest articles on DEV Community by Steve Baker (@stebaker92).</description>
    <link>https://dev.to/stebaker92</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%2F8311%2F3b2cf7a5-2a29-4cae-8770-c2b32dae6d33.jpg</url>
      <title>DEV Community: Steve Baker</title>
      <link>https://dev.to/stebaker92</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stebaker92"/>
    <language>en</language>
    <item>
      <title>Using Ollama with VS Code for Local AI-Assisted Development</title>
      <dc:creator>Steve Baker</dc:creator>
      <pubDate>Sun, 08 Mar 2026 00:33:17 +0000</pubDate>
      <link>https://dev.to/stebaker92/using-ollama-with-vs-code-for-local-ai-assisted-development-5hmi</link>
      <guid>https://dev.to/stebaker92/using-ollama-with-vs-code-for-local-ai-assisted-development-5hmi</guid>
      <description>&lt;h1&gt;
  
  
  Using Ollama with VS Code
&lt;/h1&gt;

&lt;p&gt;If you want an AI coding assistant without sending your code to the cloud, &lt;strong&gt;Ollama&lt;/strong&gt; makes it easy to run an LLM locally and easily integrates with &lt;strong&gt;Visual Studio Code&lt;/strong&gt; and other IDEs.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install Ollama &amp;amp; Run Your Chosen Model
&lt;/h2&gt;

&lt;p&gt;Download and install Ollama from the official site.&lt;/p&gt;

&lt;p&gt;After installing, verify it works via your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ollama --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then select a model to run. You will need to choose a model, version and number of parameters based on your hardware (RAM/CPU/GPU specs). You may also need to limit the &lt;a href="https://docs.ollama.com/context-length" rel="noopener noreferrer"&gt;context length&lt;/a&gt; for the best performance. One of the models I tested for coding tasks was &lt;code&gt;qwen3-coder:7b&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama run qwen3-coder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model will download automatically when you run it.&lt;/p&gt;

&lt;p&gt;You can select &amp;amp; test this model out via the Ollama GUI. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Setup 'Continue' VS Code Extension
&lt;/h2&gt;

&lt;p&gt;To use Ollama inside VS Code, install an extension that supports it - a popular option is &lt;strong&gt;Continue&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Installation Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open VS Code&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Extensions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Search for &lt;strong&gt;Continue&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Install&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Configure Your VS Code Extension to Use Ollama
&lt;/h2&gt;

&lt;p&gt;Open the &lt;code&gt;Continue&lt;/code&gt; config file - it should be located in your profile: &lt;code&gt;~/.continue/config.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then add your local Ollama model(s):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"My Llama Model"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ollama"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"qwen3-coder:7b"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart VS Code after saving.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Start Using Local AI!
&lt;/h2&gt;

&lt;p&gt;You can now ask questions or give instructions directly in your IDE, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Explain this codebase"&lt;/li&gt;
&lt;li&gt;"Add the following feature [..]"&lt;/li&gt;
&lt;li&gt;"Write unit tests for the file &lt;code&gt;@UserService.cs&lt;/code&gt;"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All requests are handled locally through Ollama, using the model you previously setup&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using Ollama with VS Code gives you a private, offline AI coding assistant that can act as an alternative to ChatGPT, Claude and other popular AI tooling, especially if an AI provider has downtime, you run out of credits or you want a privacy focused, offline AI assistant! Ollama is simple to set up, free to run and works with many open-source models.&lt;/p&gt;

</description>
      <category>ollama</category>
      <category>ai</category>
    </item>
    <item>
      <title>Troubleshooting DefaultAzureCredential: Identifying Which Credential Is Used</title>
      <dc:creator>Steve Baker</dc:creator>
      <pubDate>Wed, 10 Dec 2025 14:09:04 +0000</pubDate>
      <link>https://dev.to/stebaker92/troubleshooting-defaultazurecredential-identifying-which-credential-is-used-1lgh</link>
      <guid>https://dev.to/stebaker92/troubleshooting-defaultazurecredential-identifying-which-credential-is-used-1lgh</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;When using the Azure Identity NuGet package, &lt;code&gt;DefaultAzureCredential&lt;/code&gt; attempts to load a range of credential types such as Environment Variables, Visual Studio, Azure Managed Identity and more. The &lt;a href="https://learn.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet" rel="noopener noreferrer"&gt;full list is documented on Microsoft Learn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Determining which credentials are being used can be tricky unless you manually enable logging. When doing this, the Microsoft recommended approach will give you a &lt;em&gt;very&lt;/em&gt; verbose output. To simplify the output, insert the below snippet into your applications startup.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Security note:&lt;/strong&gt; enabling &lt;code&gt;IsAccountIdentifierLoggingEnabled&lt;/code&gt; may &lt;br&gt;
include sensitive account information in your logs. Only use this during &lt;br&gt;
debugging and ensure these logs are not persisted or exposed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;var&lt;/span&gt; &lt;span class="n"&gt;listener&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureEventSourceListener&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventSource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"Azure-Identity"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// Alternatively, use _logger.LogInformation() if running in Azure&lt;/span&gt;
        &lt;span class="c1"&gt;// WARNING: These logs may include sensitive credentials&lt;/span&gt;
        &lt;span class="c1"&gt;// depending on the options selected below&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Diagnostics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tracing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EventLevel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LogAlways&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;DefaultAzureCredentialOptions&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Diagnostics&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;IsAccountIdentifierLoggingEnabled&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// Useful extra options for debugging&lt;/span&gt;
        &lt;span class="c1"&gt;// These act as a Whitelist of fields to log. By&lt;/span&gt;
        &lt;span class="c1"&gt;//LoggedHeaderNames = { "x-ms-request-id" },&lt;/span&gt;
        &lt;span class="c1"&gt;//LoggedQueryParameters = { "api-version" },&lt;/span&gt;
        &lt;span class="c1"&gt;// This enables logging the request or response body&lt;/span&gt;
        &lt;span class="c1"&gt;//IsLoggingContentEnabled = true&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;credential&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;DefaultAzureCredential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;AzureEventSourceListener&lt;/code&gt; will create a verbose logger. Adding that filter will remove a lot of noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sample Output
&lt;/h2&gt;

&lt;p&gt;You should get an output similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EnvironmentCredential.GetToken invoked
EnvironmentCredential.GetToken was unable to retrieve an access token
...
VisualStudioCredential.GetToken succeeded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This output makes it straightforward to identify exactly which credential type was successful (or unsuccessful).&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md#logging" rel="noopener noreferrer"&gt;Azure Identity logging documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Azure/azure-sdk-for-net/issues/27872" rel="noopener noreferrer"&gt;Related GitHub issue: verbose logging discussion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>azure</category>
      <category>activedirectory</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Speed up your Docker builds using layer caching (avoid reinstalling dependencies)</title>
      <dc:creator>Steve Baker</dc:creator>
      <pubDate>Sun, 11 Oct 2020 10:40:32 +0000</pubDate>
      <link>https://dev.to/stebaker92/docker-layers-and-optimizing-your-dockerfile-49g7</link>
      <guid>https://dev.to/stebaker92/docker-layers-and-optimizing-your-dockerfile-49g7</guid>
      <description>&lt;p&gt;A project I worked on recently had a ~7 minute Docker build time. Config changes required a rebuild, so 7 mins per change. Something i noticed was npm packages being installed for config changes and even HTML changes - why do I need to download 1000+ npm packages if i'm only changing HTML? Madness! There is a simple solution to this. &lt;/p&gt;

&lt;h2&gt;
  
  
  How Docker layer caching works
&lt;/h2&gt;

&lt;p&gt;Docker will cache commands but only if the Dockerfile is written in a certain way. Take the following scenario:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:9
COPY /src /src
RUN npm install
RUN npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker &lt;em&gt;can&lt;/em&gt; cache each command and create a &lt;a href="https://docs.docker.com/storage/storagedriver/#images-and-layers" rel="noopener noreferrer"&gt;Layer&lt;/a&gt;. Layers are cached if Docker detects that no files have been changed for that command. &lt;/p&gt;

&lt;p&gt;By splitting the COPY into 2 commands, we can utilize caching and speed up the build time for builds that haven't modified npm packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:22-alpine
COPY /src/package*.json /src
# Docker will cache these 2 layers if package.json and package.lock.json are unmodified
RUN npm install

# copy the rest of our code and run a fresh build
COPY /src /src
RUN npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;One extra line saved our team several minutes per build - in my scenario it was local builds and CI server builds (as npm packages rarely change in larger/mature project).&lt;/p&gt;

&lt;p&gt;This pattern also works for any package manager: swap &lt;code&gt;package.*json&lt;/code&gt; and &lt;code&gt;npm install&lt;/code&gt; to align with your package manager (&lt;code&gt;dotnet restore&lt;/code&gt;, &lt;code&gt;bundle install&lt;/code&gt;, &lt;code&gt;pip install&lt;/code&gt; etc)&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dockerfile</category>
      <category>performance</category>
    </item>
    <item>
      <title>Randomize your Windows desktop background with PowerShell</title>
      <dc:creator>Steve Baker</dc:creator>
      <pubDate>Mon, 14 Sep 2020 08:29:51 +0000</pubDate>
      <link>https://dev.to/stebaker92/randomizing-your-windows-desktop-background-using-powershell-8l5</link>
      <guid>https://dev.to/stebaker92/randomizing-your-windows-desktop-background-using-powershell-8l5</guid>
      <description>&lt;p&gt;Hi! &lt;/p&gt;

&lt;p&gt;Tired of the same desktop background? Here's a small PowerShell script that pulls a random wallpaper from WallHaven's free API and sets it every time Windows starts&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: this will only work on Windows.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are 2 files involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set-RandomBg.ps1 - downloads a random image using the WallHaven API&lt;/li&gt;
&lt;li&gt;Set-Wallpaper.ps1 - a reusable module to change the Windows wallpaper which requires an image file path&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Set-RandomBg script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# You can specify a search term here or leave it blank:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# $keyword=$null&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$keyword&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"nature"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Net.ServicePointManager&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;SecurityProtocol&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Net.SecurityProtocolType&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Tls12&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://wallhaven.cc/api/v1/search?sorting=random&amp;amp;q=&lt;/span&gt;&lt;span class="nv"&gt;${keyword}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# See full list of API options here:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# https://wallhaven.cc/help/api#search&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="s2"&gt;"Loading results from: &lt;/span&gt;&lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Invoke-RestMethod&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Uri&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Filter out landscape results&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dimension_y&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-le&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dimension_x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;length&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="s2"&gt;"Found &lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="s2"&gt; images"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$random&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Get-Random&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Minimum&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Maximum&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="s2"&gt;"Random id: &lt;/span&gt;&lt;span class="nv"&gt;$random&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$wallUrl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$random&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:\temp\bg.jpg"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="s2"&gt;"Downloading &lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;Invoke-WebRequest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$wallUrl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-OutFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# load the Set-Wallpaper module so we can execute it&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$PSScriptRoot&lt;/span&gt;&lt;span class="n"&gt;/Set-Wallpaper.ps1&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;Set-Wallpaper&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Image&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$filename&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# To debug any issues, uncomment the following line:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# pause&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Set-WallPaper script
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Set-WallPaper&lt;/code&gt; script looks a little scary at first but all it's doing is changing the Windows desktop wallpaper setting via C# (there's no PowerShell way and alternative methods like updating the Registry wouldn't work for me) &lt;/p&gt;

&lt;p&gt;The script can be found here:&lt;br&gt;
&lt;a href="https://www.joseespitia.com/2017/09/15/set-wallpaper-powershell-function/" rel="noopener noreferrer"&gt;https://www.joseespitia.com/2017/09/15/set-wallpaper-powershell-function/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Running via start-up
&lt;/h2&gt;

&lt;p&gt;To run this script on start-up, create a new Shortcut in your startup folder located at &lt;code&gt;shell:startup&lt;/code&gt; with the following &lt;code&gt;TargetPath&lt;/code&gt;&lt;br&gt;
&lt;code&gt;"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe " -file C:\MYSCRIPTSFOLDER\Set-RandomBg.ps1&lt;/code&gt;. Make sure to replace &lt;code&gt;MYSCRIPTSFOLDER&lt;/code&gt; with the location of the PowerShell scripts! &lt;/p&gt;

&lt;p&gt;Thanks for reading! If you know a better way to achieve this, or want to &lt;br&gt;
extend it (WallHavens API supports multiple filtering options), leave a comment below.&lt;/p&gt;

</description>
      <category>powershell</category>
      <category>scripting</category>
      <category>windows</category>
      <category>customization</category>
    </item>
    <item>
      <title>Creating a portfolio site using Gatsby &amp; Trello</title>
      <dc:creator>Steve Baker</dc:creator>
      <pubDate>Thu, 20 Aug 2020 22:18:09 +0000</pubDate>
      <link>https://dev.to/stebaker92/creating-a-portfolio-site-using-gatsby-trello-1p3d</link>
      <guid>https://dev.to/stebaker92/creating-a-portfolio-site-using-gatsby-trello-1p3d</guid>
      <description>&lt;p&gt;If you want a portfolio site that updates itself without managing a CMS, this might be the approach for you. I had all my project data already sitting in a Trello board - so instead of duplicating it somewhere else, I wired it directly into a Gatsby static site. Here's how it works and whether it's worth it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Gatsby?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Gatsby is a free and open source framework based on React that helps developers build blazing fast websites and apps&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.gatsbyjs.org/" rel="noopener noreferrer"&gt;https://www.gatsbyjs.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Gatsby allows you to build a static site, similar to Jekyll but with a lot more to offer - you can use a range of node packages &amp;amp; use React features such as Components etc. You will build a site using React but when built, a static site will be generated (with minimal JavaScript &amp;amp; dependencies - just good ol' HTML and CSS!)&lt;/p&gt;

&lt;h2&gt;
  
  
  My Trello 'Projects' board
&lt;/h2&gt;

&lt;p&gt;The idea for this project was to expose data from my personal Trello board &amp;amp; showcase some of the projects I've done in the past or am currently working on. The information was already in this board so why not expose it (as opposed to duplicating this data in a Content Management System)&lt;/p&gt;

&lt;h2&gt;
  
  
  Hooking it up to Trello
&lt;/h2&gt;

&lt;p&gt;This project was surprisingly simple in the end, I basically ended up with a handful of components - a ProjectList Component, ProjectItem Component and ProjectDetail Component ('Project' mapping to a single Trello Card).&lt;/p&gt;

&lt;p&gt;To scrape the data from Trello &amp;amp; dynamically generate a page per Trello Card (&amp;amp; also a Project List page), I used the &lt;a href="https://www.gatsbyjs.org/docs/node-apis/" rel="noopener noreferrer"&gt;gatsby node APIs&lt;/a&gt; and ended up with something 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;
...
// Use a Trello API to gather the data
const trelloCards = myTrelloHelper.getAllCards();
...

exports.createPages = ({ boundActionCreators }) =&amp;gt; {
  const { createPage } = boundActionCreators;

  // Page to list all projects
  createPage({
    path: `/`,
    component: require.resolve("./src/all-projects-template.js"),
    // Data for this page - we require all of the Trello Cards &amp;amp; Labels
    context: { trelloCards },
  })

  const cardTemplate = path.resolve(`src/card-template.js`);

  var showdown = require('showdown');
  var converter = new showdown.Converter();

  // Create a page for each Trello Card
  trelloCards.forEach((card) =&amp;gt; {
    const path = card.path;

    // Convert our Trello markdown to HTML
    card.details = converter.makeHtml(page.desc);

    createPage({
      path,
      component: cardTemplate,

      // Send the card data to this component so we can render the cards details
      context: {
        card
      }
    });
  });
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Benefits &amp;amp; Drawbacks
&lt;/h2&gt;

&lt;p&gt;Benefits&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; - The data source (Trello) isn't publicly available - only my CI and my local dev environment have access to the Trello API Key (although it's just a readonly key, I still wouldn't want users to access my other Trello boards or cards!)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; - Hosting a static site is cheap / free as there is very little architecture - no API's to host &amp;amp; using Trello means no cost for data storage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stability&lt;/strong&gt; - As this is a static site with no JavaScript, no API's and no database, there's less points of failure. No worries of unhealthy API's or databases having issues etc. If the API being consumed does have performance issues or is down, the end user won't see this - the generated content will just be slightly outdated. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed&lt;/strong&gt; - Static content means there's very little / no JavaScript (bulky front end frameworks can drastically reduce page load and render speeds, especially when not configured properly or minified) &amp;amp; everything can be cached via a Content Delivery Network. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effort&lt;/strong&gt; - I don't have to duplicate my content! As long as I add the correct tags &amp;amp; readable content on my private Trello board, it will get transformed into a readable web page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main drawback I found was: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No real-time updates&lt;/strong&gt;: It currently doesn't update in real time though I have my project set to rebuild &amp;amp; redeploy on a regular schedule along with any git commits. I could also use Trello web-hooks to trigger a build which seemed a little overkill for my needs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This approach is quite flexible - swapping in another data source (CMS, API or even a different Trello board!) would take minimal effort. &lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>trello</category>
      <category>staticsitegenerator</category>
      <category>ssg</category>
    </item>
  </channel>
</rss>
