<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Codewalker</title><link>https://www.codewalker.co.uk/</link><description>Recent content on Codewalker</description><generator>Hugo</generator><language>en-GB</language><copyright>Codewalker</copyright><lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="https://www.codewalker.co.uk/index.xml" rel="self" type="application/rss+xml"/><item><title>Basics</title><link>https://www.codewalker.co.uk/notes/golang/web-apps/basics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/web-apps/basics/</guid><description>&lt;ul&gt;&#10;&lt;li&gt;A handler in Golang acts as a controller in the common Model View Controller (MVC) pattern.&lt;/li&gt;&#10;&lt;li&gt;A router (or servemux in Go terminology) keeps the mapping between URL patterns and their handlers.&lt;/li&gt;&#10;&lt;li&gt;A web server, unlike in most other languages, for example Python you need something like Gunicorn or Uvicorn, Go can establish a web server and listen for incoming requests as part of the application itself.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="new-project"&gt;New Project&lt;a class="heading-anchor" href="#new-project" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/Golang/projects/newsfeeder &amp;amp;&amp;amp; cd ~/Golang/projects/newsfeeder&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go mod init newsfeeder.example.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="getting-started"&gt;Getting Started&lt;a class="heading-anchor" href="#getting-started" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Create the following file:&lt;/p&gt;</description></item><item><title>Installation</title><link>https://www.codewalker.co.uk/notes/fastapi/getting-started/installation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/getting-started/installation/</guid><description>&lt;p&gt;This page demonstrate how to install Python and configure a Python development project.&lt;/p&gt;&#10;&lt;h2 id="install-python"&gt;Install Python&lt;a class="heading-anchor" href="#install-python" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All instructions on this website assume using Fedora Linux. At time of writing that was Fedora 41 which shipped with &lt;code&gt;Python 3.13.1&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;However, it can be useful to install specific and multiple version of Python on you client.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="./notes/toolbox/python/"&gt;Please refer to this appendix for installing Python from source&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="project-directory"&gt;Project Directory&lt;a class="heading-anchor" href="#project-directory" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First, create a suitable working directory for your project, for example:&lt;/p&gt;</description></item><item><title>Installation</title><link>https://www.codewalker.co.uk/notes/golang/getting-started/installation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/getting-started/installation/</guid><description>&lt;p&gt;Check the current releases &lt;a href="https://go.dev/dl/" rel="noopener"&gt;https://go.dev/dl/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Download a version for Linux:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://go.dev/dl/go1.22.4.linux-amd64.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Extract the archive:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Include the export in you &lt;code&gt;PATH&lt;/code&gt; environment variable:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export PATH=$PATH:/usr/local/go/bin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;You can make this persistent by adding it to your &lt;code&gt;.bash_profile&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;~/.bash_profile&lt;/span&gt;&lt;span class="lang"&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;:/usr/local/go/bin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;This will load when you log into you system, however you can always use &lt;code&gt;source&lt;/code&gt; to reload the exports:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;source ~/.bash_profile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;You can validate the install version of &lt;code&gt;go&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Installation</title><link>https://www.codewalker.co.uk/notes/linux/client/install/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/client/install/</guid><description>&lt;p&gt;Boot you PC, laptop of virtual machine from the ISO:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_01.png" alt="GRUB"&gt;&lt;/p&gt;&#10;&lt;p&gt;The Fedora ISO is a live image, so it will boot up the operating system into memory and give you an option to try it or install it. Click install to hard drive:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_02.png" alt="Fedora"&gt;&lt;/p&gt;&#10;&lt;p&gt;Select a language:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_03.png" alt="Language"&gt;&lt;/p&gt;&#10;&lt;p&gt;Select an installation destination:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_04.png" alt="Hard disk"&gt;&lt;/p&gt;&#10;&lt;p&gt;And get it installed:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_05.png" alt="Install"&gt;&lt;/p&gt;&#10;&lt;p&gt;When the installation progress has finished click complete, and reboot.&lt;/p&gt;</description></item><item><title>Installation</title><link>https://www.codewalker.co.uk/notes/linux/server/install/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/server/install/</guid><description>&lt;p&gt;The process of installing Alma Linux 8 is similar to Fedora, except this is only installation media. Always use the minimal install, server should be only installed and configured explicitly.&lt;/p&gt;&#10;&lt;p&gt;Boot off the ISO image, you see GRUB:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/server/images/grub.png" alt="GRUB"&gt;&lt;/p&gt;&#10;&lt;p&gt;You first need to select a language:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/server/images/lang.png" alt="Language"&gt;&lt;/p&gt;&#10;&lt;p&gt;The, go through the various options, notably the network configuration:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/server/images/nic.png" alt="Network"&gt;&lt;/p&gt;&#10;&lt;p&gt;And adding a user:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/server/images/user.png" alt="User"&gt;&lt;/p&gt;&#10;&lt;p&gt;Here is an example ready to install:&lt;/p&gt;</description></item><item><title>Installing Python</title><link>https://www.codewalker.co.uk/notes/toolbox/python/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/toolbox/python/</guid><description>&lt;p&gt;To get the latest version you can visiting the official Python web site:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.python.org/downloads/" rel="noopener"&gt;https://www.python.org/downloads/&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Then download and extract the Python archive via the command line:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/Python &amp;amp;&amp;amp; cd ~/Python&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tar.xz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tar -xvf Python-3.11.9.tar.xz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Changing into the Python directory ready to compile:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cd Python-3.11.9&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;If you experience issues with sudo with a message such as &lt;code&gt;user is not in the sudoers file&lt;/code&gt;, as root you need to add your user to the &lt;code&gt;sudo&lt;/code&gt; group, for example:&lt;/p&gt;</description></item><item><title>Introduction</title><link>https://www.codewalker.co.uk/notes/ansible/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/ansible/introduction/</guid><description>&lt;p&gt;Ansible is a simple automation engine that automates cloud provisioning, configuration management, and application deployments. At this point, you should have an excellent FastAPI example application and some clean Terraform for provisioning an EC2 instance and all the necessary cloud infrastructure to make it accessible and ready for configuration and the deployment of an application.&lt;/p&gt;&#10;&lt;p&gt;This section will get us up and running with working with Ansible, firstly to do some traditional system administration, secondly to manage the deployment of an application.&lt;/p&gt;</description></item><item><title>OpenShift Local</title><link>https://www.codewalker.co.uk/notes/openshift/openshift-local/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/openshift/openshift-local/</guid><description>&lt;p&gt;Assuming you have a Red Hat developer account, head to &lt;a href="https://console.redhat.com/openshift/create/local" rel="noopener"&gt;https://console.redhat.com/openshift/create/local&lt;/a&gt; and download &lt;code&gt;crc&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;Extract the archive:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tar xvf crc-linux-amd64.tar.xz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Ensure you have a binary path in your home directory:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir -p ~/local/bin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Move the &lt;code&gt;crc&lt;/code&gt; binary:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mv crc-linux-*-amd64/crc ~/local/bin/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Export the new PATH:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;export PATH=$HOME/local/bin:$PATH&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Check that &lt;code&gt;crc&lt;/code&gt; is now in your PATH and working:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crc version&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Example output:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;CRC version: 2.16.0+05b62a75&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;OpenShift version: 4.12.9&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Podman version: 4.4.1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Ensure you PATH is persistent to survive reboots:&lt;/p&gt;</description></item><item><title>Parameters</title><link>https://www.codewalker.co.uk/notes/fastapi/crud-apis/parameters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/crud-apis/parameters/</guid><description>&lt;p&gt;At this stage, you should have a well-structured base project and a database&#10;configured with a table to keep blog post records.&lt;/p&gt;&#10;&lt;p&gt;Before writing code, it&amp;rsquo;s worth understanding the difference between Path&#10;Parameters and Query Parameters.&lt;/p&gt;&#10;&lt;h2 id="path-parameters"&gt;Path Parameters&lt;a class="heading-anchor" href="#path-parameters" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Path parameters are parameters that get included in the context path of a URL.&#10;For example, the unique ID of each blog post gets appended to the URL providing&#10;a link to individual posts.&lt;/p&gt;</description></item><item><title>Podman</title><link>https://www.codewalker.co.uk/notes/containers/podman/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/containers/podman/</guid><description>&lt;p&gt;With a simple example application, the next step is to run the code using a container. Docker is the most common tool&#10;however, Podman is Red Hat’s open source equivalent. It’s so similar you can even install a package that allows you to&#10;invoke Podman commands using a &lt;code&gt;docker&lt;/code&gt; alias command. Use &lt;code&gt;dnf install podman-docker&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="fedora-and-rhel"&gt;Fedora and RHEL&lt;a class="heading-anchor" href="#fedora-and-rhel" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Install Podman:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo dnf install podman buildah -y&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>RHEL AI fundamentals</title><link>https://www.codewalker.co.uk/notes/ai/rhel-ai-fundamentals/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/ai/rhel-ai-fundamentals/</guid><description>&lt;h2 id="introduction-to-generative-ai"&gt;Introduction to Generative AI&lt;a class="heading-anchor" href="#introduction-to-generative-ai" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;img src="https://huggingface.co/" alt="https://huggingface.co/"&gt;&lt;/p&gt;&#10;&lt;p&gt;GenAI presents a wide range of applications, which are broadly categorized into the following categories:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Text generation&lt;/li&gt;&#10;&lt;li&gt;Image and video generation&lt;/li&gt;&#10;&lt;li&gt;Audio transcription and generation&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="use-cases"&gt;Use Cases&lt;a class="heading-anchor" href="#use-cases" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;General-purpose content generation&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;Generating documents, articles, images, videos, audio, or music from a prompt. For multimodal models, the prompt might consist of different media types.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Conversational systems&lt;/strong&gt;&#10;This is a subtype of language generation, focused on conversational human-computer interactions through either text or voice. Chat bots are a common use case in this category.&lt;/p&gt;</description></item><item><title>Simple data types</title><link>https://www.codewalker.co.uk/notes/golang/fundamentals/simple-data-types/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/fundamentals/simple-data-types/</guid><description>&lt;p&gt;Simple data types means they only store one, that is a single value, there are four:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Strings&lt;/li&gt;&#10;&lt;li&gt;Numbers&lt;/li&gt;&#10;&lt;li&gt;Booleans&lt;/li&gt;&#10;&lt;li&gt;Errors&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;See the Standard Library docs here: &lt;a href="https://pkg.go.dev/std" rel="noopener"&gt;https://pkg.go.dev/std&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="strings"&gt;Strings&lt;a class="heading-anchor" href="#strings" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Strings in Go represent one or more characters.&lt;/p&gt;&#10;&lt;p&gt;Interpreted use double quotes strings will honour the escape character:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;interpreted string&lt;/span&gt;&lt;span class="lang"&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;this is an example \n of a string&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Raw strings don&amp;rsquo;t:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;raw string&lt;/span&gt;&lt;span class="lang"&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;`this is an example \n of a string`&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Nor to raw string care about white space, so they can do multiple lines, for example:&lt;/p&gt;</description></item><item><title>SQLModel</title><link>https://www.codewalker.co.uk/notes/fastapi/databases/sqlmodel/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/databases/sqlmodel/</guid><description>&lt;p&gt;As already touched on, SQLModel is a library for interacting with SQL databases from Python code with Python objects. SQLModel is intuitive, easy to use, highly compatible, and robust. From my adventures, this library seems the most logical approach for working with databases in FastAPI.&lt;/p&gt;&#10;&lt;p&gt;See &lt;a href="https://sqlmodel.tiangolo.com/" rel="noopener"&gt;https://sqlmodel.tiangolo.com/&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="install"&gt;Install&lt;a class="heading-anchor" href="#install" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Install &lt;code&gt;sqlmodel&lt;/code&gt; using &lt;code&gt;pip&lt;/code&gt; and remember to freeze this to the requirements files.&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install sqlmodel&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Add it to the &lt;code&gt;non_ver_reqs.txt&lt;/code&gt; file:&lt;/p&gt;</description></item><item><title>Why Linux</title><link>https://www.codewalker.co.uk/notes/linux/why-linux/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/why-linux/</guid><description>&lt;p&gt;It feels like a long time ago. Well, I guess it was a long time ago that I nearly walked away from my career in IT.&#10;Then, in 2008, I remembered feeling utterly at a loss working as a hardware and Microsoft centric second line support&#10;engineer. Everything was so opinionated, hardware was hardware, and as is to this day, it&amp;rsquo;s one Microsoft way or the&#10;highway.&lt;/p&gt;&#10;&lt;p&gt;Luckily for me, I changed roles by moving companies and was exposed to UNIX, Sun Solaris at the time and Red Hat Linux.&#10;As a result, my enthusiasm got reignited for computing, and I never looked back. Linux was to be my thing, and&#10;throughout my thirties, I lived and breathed Linux.&lt;/p&gt;</description></item><item><title>A FastAPI image</title><link>https://www.codewalker.co.uk/notes/containers/fastapi-image/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/containers/fastapi-image/</guid><description>&lt;p&gt;The following example steps through the process of building a container image and running the application using Podman.&lt;/p&gt;&#10;&lt;p&gt;A good simple example is the single file FastAPI application which serve static web pages:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="./notes/fastapi/serve-static-site/"&gt;Single file FastAPI application&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;We&amp;rsquo;ll be using the following image:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;podman pull registry.access.redhat.com/ubi9/python-312:latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Examine the &lt;code&gt;Containerfile&lt;/code&gt;&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;Containerfile&lt;/span&gt;&lt;span class="lang"&gt;dockerfile&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;registry.access.redhat.com/ubi9/python-312:latest&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;LABEL&lt;/span&gt; &lt;span class="nv"&gt;maintainer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Richard Walker&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;ENV&lt;/span&gt; &lt;span class="nv"&gt;PYTHONUNBUFFERED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;PYTHONIOENCODING&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;UTF-8&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/opt/app-root/src&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;COPY&lt;/span&gt; . /opt/app-root/src&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; pip install --upgrade pip&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; pip install -r requirements.txt&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;root&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; chown -R 1001:1001 /opt/app-root/src&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; chmod -R &lt;span class="m"&gt;775&lt;/span&gt; /opt/app-root/src&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;8080&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;1001&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;CMD&lt;/span&gt; python main.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Build a container image:&lt;/p&gt;</description></item><item><title>A first application</title><link>https://www.codewalker.co.uk/notes/fastapi/getting-started/first-app/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/getting-started/first-app/</guid><description>&lt;p&gt;We’re now ready to start writing code and build a FastAPI application.&lt;/p&gt;&#10;&lt;h2 id="first-application"&gt;First Application&lt;a class="heading-anchor" href="#first-application" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First, create a file called &lt;code&gt;main.py&lt;/code&gt; in the root of your project directory. This is the most basic example, a basic health check:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;main.py&lt;/span&gt;&lt;span class="lang"&gt;python&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;uvicorn&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Response&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;main_app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@main_app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/health&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HTTP_200_OK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;health_check_api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;X-Health-Check&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ok&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;health&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ok&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vm"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;__main__&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;uvicorn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;main_app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;0.0.0.0&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Running through this project several times, it became apparent to name things&#10;explicitly to avoid confusion and conflicts in the future. Here, I&amp;rsquo;m naming API functions with&#10;a tailing &lt;code&gt;_api&lt;/code&gt;, for example &lt;code&gt;health_check_api&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>A first project</title><link>https://www.codewalker.co.uk/notes/golang/getting-started/first-project/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/getting-started/first-project/</guid><description>&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/Golang/projects/hello &amp;amp;&amp;amp; cd ~/Golang/projects/hello&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="create-module"&gt;Create Module&lt;a class="heading-anchor" href="#create-module" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A Go module or module path as a canonical name or identifier for your project and need to be unique.&lt;/p&gt;&#10;&lt;p&gt;For example initialize a module:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go mod init hello.example.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Which creates a file &lt;code&gt;go.mod&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-ini" data-lang="ini"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;module hello.example.com&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;go 1.22.4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="hello-world"&gt;Hello World&lt;a class="heading-anchor" href="#hello-world" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Create the following &lt;code&gt;main.go&lt;/code&gt; file:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;main.go&lt;/span&gt;&lt;span class="lang"&gt;go&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Hello world!&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Run the program:&lt;/p&gt;</description></item><item><title>Client config</title><link>https://www.codewalker.co.uk/notes/linux/client/config/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/client/config/</guid><description>&lt;p&gt;The only thing now a little setup.&lt;/p&gt;&#10;&lt;h2 id="hostname"&gt;Hostname&lt;a class="heading-anchor" href="#hostname" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First bit of system administration might be to set the hostname, for example:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo hostnamectl set-hostname fedora&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Then, notice with this version of Python the version of Fedora, good to go:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="./img/notes/linux/client/images/fedora_install_11.png" alt="Complete"&gt;&lt;/p&gt;&#10;&lt;p&gt;Great!&lt;/p&gt;&#10;&lt;h2 id="vscode"&gt;VSCode&lt;a class="heading-anchor" href="#vscode" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I user PyCharm and VSCode, but VSCode does seem to be the most popular editor, it&amp;rsquo;s free after all and has great plugins for just about everything.&lt;/p&gt;</description></item><item><title>Date &amp; time</title><link>https://www.codewalker.co.uk/notes/linux/server/date-time/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/server/date-time/</guid><description>&lt;p&gt;The Network Time Protocol ( NTP ) is a standard way for machines to provide and obtain correct time information on the Internet.&lt;/p&gt;&#10;&lt;p&gt;Use the &lt;code&gt;timedatectl&lt;/code&gt; command to show an overview of the current time-related system settings.&lt;/p&gt;&#10;&lt;p&gt;Use the &lt;code&gt;timedatectl list-timezones&lt;/code&gt; to list the available time zones.&lt;/p&gt;&#10;&lt;p&gt;The following &lt;code&gt;timedatectl&lt;/code&gt; command updates the current time zone:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;timedatectl set-timezone Europe/London&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;The &lt;code&gt;timedatectl set-ntp&lt;/code&gt; command enables or disables NTP synchronization.&lt;/p&gt;&#10;&lt;p&gt;The &lt;code&gt;chronyd&lt;/code&gt; service keeps the usually-inaccurate local hardware clock (RTC) on track by synchronizing it to the configured NTP servers.&lt;/p&gt;</description></item><item><title>Health check</title><link>https://www.codewalker.co.uk/notes/golang/web-apps/health-check/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/web-apps/health-check/</guid><description>&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;log&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;net/http&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Health&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;Health&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;health&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;health&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;wtr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Request&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;wtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Content-Type&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;application/json; charset=utf-8&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;wtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;X-Health-Check&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ok&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;wtr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="nb"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;`{&amp;#34;health&amp;#34;: &amp;#34;ok&amp;#34;}`&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;router&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="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;/&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;health&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;log&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="s"&gt;&amp;#34;starting server on :8080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;err&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="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ListenAndServe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;:8080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="gorilla-mux"&gt;Gorilla Mux&lt;a class="heading-anchor" href="#gorilla-mux" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A great getting started exercise is to begin a new web application project which starts life with health endpoint.&lt;/p&gt;</description></item><item><title>PostgreSQL</title><link>https://www.codewalker.co.uk/notes/toolbox/postgresql/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/toolbox/postgresql/</guid><description>&lt;p&gt;PostgreSQL is a powerful, open-source object-relational database system that has earned a strong reputation for&#10;reliability, feature robustness, and performance. In many cases, databases are external entities. Many cloud providers&#10;now provide PostgreSQL-as-a-service or project may opt for standing up a dedicated instance or instances in a highly&#10;available configuration. It may be therefore preferable to host PostgresSQL in a virtual machine locally to replicate&#10;such environments.&lt;/p&gt;&#10;&lt;p&gt;For best results, deploy a local Virtual Machine using &lt;a href="https://almalinux.org/" rel="noopener"&gt;Alma Linux&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Prerequisites</title><link>https://www.codewalker.co.uk/notes/ansible/prerequisites/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/ansible/prerequisites/</guid><description>&lt;p&gt;It&amp;rsquo;s up to you how to install and work with Ansible, but in this theme for this documentation we&amp;rsquo;re in Python world. (Ansible is written in Python). A tried and test method is to create a Python virtual environment and install Ansible wusing &lt;code&gt;pip&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;You may wish to include this Ansible work along side you application code, or have a separate standalone repository. My instinct is to keep things separate, breaking anything into small, manageable chunks always make life easier!&lt;/p&gt;</description></item><item><title>Pydantic</title><link>https://www.codewalker.co.uk/notes/fastapi/databases/pydantic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/databases/pydantic/</guid><description>&lt;p&gt;So far, most of the work has been building up and structuring the base project,&#10;moving forward, in this guide, we&amp;rsquo;ll get into the fundamental coding aspect of&#10;FastAPI. The example will begin with APIs for a blog application and transition&#10;into serving HTML responses.&lt;/p&gt;&#10;&lt;p&gt;Introducing basic Pydantic schema types here, but there are many more specific&#10;types as documented here:&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://docs.pydantic.dev/1.10/" rel="noopener"&gt;https://docs.pydantic.dev/1.10/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Remember since starting this project Pydantic Version 2 has been released, for now I&amp;rsquo;m sticking with v1 and&#10;will either update at a later date or publish a whole new v2 version of this content, but I need SQLModel to&#10;catch up! As always, these the world of software development is a moving target.&lt;/p&gt;</description></item><item><title>RHEL AI and Granite models</title><link>https://www.codewalker.co.uk/notes/ai/rhel-ai-granite/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/ai/rhel-ai-granite/</guid><description>&lt;h2 id="requirements-for-using-large-language-models-in-enterprise-environments"&gt;Requirements for Using Large Language Models in Enterprise Environments&lt;a class="heading-anchor" href="#requirements-for-using-large-language-models-in-enterprise-environments" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;The non-deterministic nature of LLMs, which can cause trust issues in enterprise use cases.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Sending data to 3rd party LLMs can expose sensitive information.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Legal risks due to lack of transparency in training processes and data origins.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Privacy&lt;/strong&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Transparency and Compliance&lt;/strong&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="privacy"&gt;Privacy&lt;a class="heading-anchor" href="#privacy" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;&lt;strong&gt;Data Isolation&lt;/strong&gt;: Ensuring proprietary data (PII, trade secrets) never leaves the corporate perimeter or enters a model&amp;rsquo;s public training set.&lt;/p&gt;</description></item><item><title>The APIs</title><link>https://www.codewalker.co.uk/notes/fastapi/crud-apis/apis/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/crud-apis/apis/</guid><description>&lt;p&gt;When you boil down what any web application does, it can be said that most of the&#10;time it is performing either Create, Read, Update and Delete (CRUD) operations.&lt;/p&gt;&#10;&lt;p&gt;It&amp;rsquo;s always best to begin with the Create function, to get an initial record&#10;added. Notice this function uses the &lt;strong&gt;POST&lt;/strong&gt; method.&lt;/p&gt;&#10;&lt;h2 id="create"&gt;Create&lt;a class="heading-anchor" href="#create" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Create a new file that will house the APIs for the blog part of the project. Here&#10;starting with adding the API for creating new blog posts.&lt;/p&gt;</description></item><item><title>Variables</title><link>https://www.codewalker.co.uk/notes/golang/fundamentals/variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/fundamentals/variables/</guid><description>&lt;p&gt;All variables in Go are strongly typed meaning you have to declare the data type, for example:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&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="s"&gt;&amp;#34;Richard&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;The shorthand version of the above is to let Go infer the type, and use the &lt;code&gt;:=&lt;/code&gt; syntax to declare and set the value of a variable:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;firstName&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="s"&gt;&amp;#34;Richard&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="type-conversion"&gt;Type Conversion&lt;a class="heading-anchor" href="#type-conversion" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Be clear over being cleaver!&lt;/p&gt;&#10;&lt;p&gt;In Go you need to explicitly convert types, for example:&lt;/p&gt;</description></item><item><title>Working with the image registry</title><link>https://www.codewalker.co.uk/notes/openshift/image-registry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/openshift/image-registry/</guid><description>&lt;p&gt;It&amp;rsquo;s one thing building container images and running them locally but the core reason for working with containers is to&#10;ship them around. This is done by tagging images and pushing them to image registries. Then other users can pull&#10;application container images and run them on other platforms such as OpenShift.&lt;/p&gt;&#10;&lt;div class="alert alert-note" role="note"&gt;&#10; &lt;div class="alert-title"&gt;note&lt;/div&gt;&#10; &lt;p&gt;This guide was down using OpenShift Local, see &lt;a href="./notes/openshift/openshift-local/"&gt;OpenShift Local&lt;/a&gt;&lt;/p&gt;&#10;&lt;/div&gt;&lt;h2 id="openshift-registry"&gt;OpenShift Registry&lt;a class="heading-anchor" href="#openshift-registry" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As &lt;code&gt;kubeadmin&lt;/code&gt; you can use this command to extract the register route:&lt;/p&gt;</description></item><item><title>Ad hoc commands</title><link>https://www.codewalker.co.uk/notes/linux/client/adhoc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/linux/client/adhoc/</guid><description>&lt;p&gt;This page includes a bunch of useful adhoc commands and tricks.&lt;/p&gt;&#10;&lt;h2 id="create-a-large-file"&gt;Create a large file&lt;a class="heading-anchor" href="#create-a-large-file" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dd if=/dev/urandom of=/var/log bs=1M count=2048&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="write-iso-to-device"&gt;Write ISO to device&lt;a class="heading-anchor" href="#write-iso-to-device" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dd if=image.iso of=/dev/sda status=progress&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="remove-password-from-protected-pdf"&gt;Remove Password from protected PDF&lt;a class="heading-anchor" href="#remove-password-from-protected-pdf" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dnf install qpdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;qpdf --password=changeme --decrypt secure.pdf unsecure.pdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="generate-a-uuid"&gt;Generate a UUID&lt;a class="heading-anchor" href="#generate-a-uuid" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uuidgen&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="find-files-modified-in-the-past-x-days"&gt;Find files modified in the past X days&lt;a class="heading-anchor" href="#find-files-modified-in-the-past-x-days" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find /dir -mtime -X &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="remove-comments-and-blank-lines-from-a-file"&gt;Remove comments and blank lines from a file&lt;a class="heading-anchor" href="#remove-comments-and-blank-lines-from-a-file" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep -v -e &amp;#39;^#&amp;#39; -e &amp;#39;^$&amp;#39; /etc/sysconfig/sshd &amp;gt; /var/tmp/sshd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="find-lines-starting-with-string"&gt;Find lines starting with string&lt;a class="heading-anchor" href="#find-lines-starting-with-string" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep -R ^root /etc/ 2&amp;gt; /dev/null &amp;gt; /var/tmp/results.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="run-in-background-and-redirect-the-output-to-file"&gt;Run in background and redirect the output to file&lt;a class="heading-anchor" href="#run-in-background-and-redirect-the-output-to-file" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nohup command &amp;amp;&amp;gt; output.out &amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="wait-for-all-systemd-udevd-events-to-finish"&gt;Wait for all &lt;code&gt;systemd-udevd&lt;/code&gt; events to finish&lt;a class="heading-anchor" href="#wait-for-all-systemd-udevd-events-to-finish" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;udevadm settle&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>Alembic</title><link>https://www.codewalker.co.uk/notes/fastapi/databases/alembic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/fastapi/databases/alembic/</guid><description>&lt;p&gt;Firing up the application with SQLModel models defined and imported will create initial&#10;tables, but as projects grow and refactoring takes place, managing databases&#10;needs handling with a migrations tool.&lt;/p&gt;&#10;&lt;h2 id="install-alembic"&gt;Install Alembic&lt;a class="heading-anchor" href="#install-alembic" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Install Alembic:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install alembic&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;And include it in the &lt;code&gt;non_ver_reqs.txt&lt;/code&gt; file:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fastapi&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uvicorn[standard]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pydantic-settings&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sqlmodel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;alembic&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;Freeze the requirements:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip freeze &amp;gt; requirements.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="configure"&gt;Configure&lt;a class="heading-anchor" href="#configure" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First, run the &lt;code&gt;init&lt;/code&gt; command to initialize Alembic:&lt;/p&gt;</description></item><item><title>Arrays</title><link>https://www.codewalker.co.uk/notes/golang/fundamentals/arrays/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.codewalker.co.uk/notes/golang/fundamentals/arrays/</guid><description>&lt;p&gt;As always, arrays start a position zero. They are also fixed in size, the length cannot be modified once an array is declared. For more flexibility see slices in the next section.&lt;/p&gt;&#10;&lt;h2 id="initialize-array"&gt;Initialize array&lt;a class="heading-anchor" href="#initialize-array" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Define an array declaring the number of elements and the data element, for example:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;If you print this out as-is, Go will initialize each element to zero:&lt;/p&gt;&#10;&lt;div class="code-block has-title"&gt;&lt;div class="code-title"&gt;&lt;span&gt;main.go&lt;/span&gt;&lt;span class="lang"&gt;go&lt;/span&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#9;&lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myArray&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go run .&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;div class="code-block"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[0 0 0 0 0]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;h2 id="populating-array"&gt;Populating array&lt;a class="heading-anchor" href="#populating-array" aria-label="Link to this section" data-pagefind-ignore&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You can define the initial values using the following syntax, remember we can omit the &lt;code&gt;var&lt;/code&gt; syntax and use colon/equals &lt;code&gt;:=&lt;/code&gt;:&lt;/p&gt;</description></item></channel></rss>