<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Development on Wimpy's World</title><link>https://blog.wimpys.world/categories/development/</link><description>Recent content in Development on Wimpy's World</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>martin@wimpress.com (Martin Wimpress)</managingEditor><webMaster>martin@wimpress.com (Martin Wimpress)</webMaster><lastBuildDate>Thu, 15 May 2025 13:37:42 +0100</lastBuildDate><atom:link href="https://blog.wimpys.world/categories/development/rss.xml" rel="self" type="application/rss+xml"/><item><title>Nothing but Nix</title><link>https://blog.wimpys.world/posts/nothing-but-nix-github-actions/</link><pubDate>Thu, 15 May 2025 13:37:42 +0100</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/nothing-but-nix-github-actions/</guid><description>&lt;p&gt;Have you ever tried to build a complex &lt;a href="https://nixos.org/"&gt;NixOS&lt;/a&gt; ️❄️ configuration in GitHub Actions only to be greeted by the dreaded &lt;em&gt;&amp;ldquo;no space left on device&amp;rdquo;&lt;/em&gt; error? I certainly have, and it&amp;rsquo;s been driving me bonkers for quite some time! 😖&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories"&gt;Standard GitHub Actions runners&lt;/a&gt; come with a paltry ~20GB of free disk space, or so it would seem. Which sounds decent until you try to build sophisticated NixOS or &lt;a href="https://nix-community.github.io/home-manager/"&gt;Home Manager&lt;/a&gt; configurations. A comprehensive workstation or home lab server setup can consume 10-15GB due to all the included packages and dependencies, leaving precious little headroom for anything else 🤏&lt;/p&gt;
&lt;p&gt;This space limitation effectively meant I couldn&amp;rsquo;t build my full workstation and server configurations in CI. So annoying! 😠 I wanted my CI to cache complete builds to &lt;a href="https://flakehub.com/"&gt;FlakeHub Cache&lt;/a&gt;, but was forever stuck with only partial builds or individual packages that wouldn&amp;rsquo;t properly test the complete configurations. This meant that each configuration change on my workstations and servers required frustrating additional compilation time for things like 3rd party kernel modules, &lt;a href="https://ollama.com/"&gt;Ollama&lt;/a&gt;, custom package overrides, and more - all because I couldn&amp;rsquo;t get full builds cached through CI ️🥺&lt;/p&gt;
&lt;p&gt;Well, I&amp;rsquo;d had enough of that nonsense and decided to solve the problem once and for all 🧠&lt;/p&gt;
&lt;h2 id="introducing-nothing-but-nix-"&gt;Introducing &lt;em&gt;Nothing but Nix&lt;/em&gt; ️❄️&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m chuffed to bits to announce &lt;a href="https://github.com/marketplace/actions/nothing-but-nix"&gt;&lt;em&gt;Nothing but Nix&lt;/em&gt;&lt;/a&gt;, a GitHub Action that &lt;strong&gt;brutally reclaims&lt;/strong&gt; disk space 🪓 on runners and transforms them into Nix powerhouses!&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s what it does in a nutshell:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/checkout@v4&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;wimpysworld/nothing-but-nix@main&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;DeterminateSystems/determinate-nix-action@main&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- &lt;span class="nt"&gt;run&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="sd"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; nix flake check&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result? Instead of ~20GB for your &lt;a href="https://zero-to-nix.com/concepts/nix-store/"&gt;Nix store&lt;/a&gt;, you get &lt;strong&gt;65GB to 130GB&lt;/strong&gt; of sweet, glorious Nix-dedicated space. That&amp;rsquo;s enough to build even the chonkiest of configurations! 🪨&lt;/p&gt;
&lt;h2 id="space-the-final-frontier-"&gt;Space, the Final Frontier 🌌&lt;/h2&gt;
&lt;p&gt;Working at &lt;a href="https://determinate.systems"&gt;Determinate Systems&lt;/a&gt;, I get to see firsthand how powerful Nix can be when properly cached. Our &lt;a href="https://flakehub.com"&gt;FlakeHub Cache&lt;/a&gt; makes system updates lightning fast ⚡ but I couldn&amp;rsquo;t fully leverage it in CI because my builds kept running out of space.&lt;/p&gt;
&lt;p&gt;I wanted to be able to &lt;strong&gt;build and test all my configurations&lt;/strong&gt; in CI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;💁 &lt;strong&gt;Servers:&lt;/strong&gt; media services, local LLMs, website, fediverse services, distributed storage, backup&lt;/li&gt;
&lt;li&gt;️🖥️ &lt;strong&gt;Workstations:&lt;/strong&gt; dual GPU, loaded with dev tools, content creation apps and local LLMs&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;Laptops:&lt;/strong&gt; optimized for travel, media on the go, presentations and development&lt;/li&gt;
&lt;li&gt;👻 &lt;strong&gt;VMs:&lt;/strong&gt; for &lt;a href="https://ubuntu-mate.org"&gt;Linux desktop development&lt;/a&gt; and testing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But GitHub&amp;rsquo;s ~20GB limitation kept getting in the way 🙅 Sure, I could have paid GitHub for their larger runners with more disk space, but being both cheap and stubborn, I wasn&amp;rsquo;t having any of that! 💸❌ Instead, I started thinking, &lt;em&gt;&amp;ldquo;Hang on a minute, those free runners must have more space somewhere - I just need to find it and claim it!&amp;rdquo;&lt;/em&gt; 🤔💭&lt;/p&gt;
&lt;p&gt;After digging through the runner specs and file system layout, I discovered that &lt;strong&gt;GitHub Actions runners have a large chunk of free space on the &lt;code&gt;/mnt&lt;/code&gt; filesystem that&amp;rsquo;s barely used&lt;/strong&gt; 🤯 There was also the possibility to reclaim significant space by purging pre-installed software that Nix users don&amp;rsquo;t need anyway 😈&lt;/p&gt;
&lt;h2 id="the-slightly-mad-science-bit-"&gt;The Slightly Mad Science Bit ‍🧑‍🔬&lt;/h2&gt;
&lt;p&gt;At its core, &lt;em&gt;Nothing but Nix&lt;/em&gt; uses a two-pronged attack:&lt;/p&gt;
&lt;h3 id="1-the-initial-slash-instant-volume-creation"&gt;1. The Initial Slash: Instant Volume Creation&lt;/h3&gt;
&lt;p&gt;First, the action creates a large loop device from free space on &lt;code&gt;/mnt&lt;/code&gt; and sets up a properly tuned BTRFS filesystem:&lt;/p&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="c1"&gt;# Create a large disk image in the free space&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;free_space&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;df -m --output&lt;span class="o"&gt;=&lt;/span&gt;avail /mnt &lt;span class="p"&gt;|&lt;/span&gt; tail -n &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; tr -d &lt;span class="s1"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;loop_dev&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;sudo losetup --find&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo fallocate -l &lt;span class="k"&gt;$((&lt;/span&gt;free_space &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1024&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;M &lt;span class="s2"&gt;&amp;#34;/mnt/disk0.img&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo losetup &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;loop_dev&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/mnt/disk0.img&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Set up an optimized BTRFS filesystem&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkfs.btrfs -L nix -d raid0 -m raid0 --nodiscard &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;loop_dev&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mount &lt;span class="nv"&gt;LABEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nix /nix -o noatime,nobarrier,nodiscard,compress&lt;span class="o"&gt;=&lt;/span&gt;zstd:1,space_cache&lt;span class="o"&gt;=&lt;/span&gt;v2,commit&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;120&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;This immediately provides around 65GB of Nix-ready space before your workflow even gets going!&lt;/strong&gt; 💪
I could have stopped here, but did I mention beging stubborn yet? 🫏&lt;/p&gt;
&lt;h3 id="2-the-background-purge-merciless-space-reclamation"&gt;2. The Background Purge: Merciless Space Reclamation&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;While your workflow continues&lt;/strong&gt;, &lt;em&gt;Nothing but Nix&lt;/em&gt; starts a background process to ruthlessly eliminate unnecessary software:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Docker images? Gone! 🗑️&lt;/li&gt;
&lt;li&gt;Language runtimes? Obliterated! 💥&lt;/li&gt;
&lt;li&gt;Package managers? Annihilated! 💣&lt;/li&gt;
&lt;li&gt;Documentation? Vaporized! 🔥&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As space is reclaimed, it creates a second disk image on the root file system and adds it to the BTRFS pool, &lt;strong&gt;dynamically growing your Nix volume up to around 130GB.&lt;/strong&gt; 🚀&lt;/p&gt;
&lt;p&gt;The file system purge is powered by &lt;code&gt;rmz&lt;/code&gt; (from the &lt;a href="https://github.com/SUPERCILEX/fuc"&gt;Fast Unix Commands (FUC)&lt;/a&gt; project) - a high-performance alternative to &lt;code&gt;rm&lt;/code&gt; that makes deletion blazingly fast. &lt;strong&gt;Using traditional &lt;code&gt;rm&lt;/code&gt; a full file system purge took ~11 minutes ⏳😞 &lt;code&gt;rmz&lt;/code&gt; cut that to under 60 seconds!&lt;/strong&gt; ️⏱️😀&lt;/p&gt;
&lt;h3 id="btrfs-with-nodiscard"&gt;BTRFS with &lt;code&gt;nodiscard&lt;/code&gt;?&lt;/h3&gt;
&lt;p&gt;I&amp;rsquo;m using &lt;a href="https://btrfs.readthedocs.io/en/latest/"&gt;BTRFS&lt;/a&gt; for the volume because it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Supports dynamic device addition&lt;/li&gt;
&lt;li&gt;Has built-in compression to save even more space&lt;/li&gt;
&lt;li&gt;Allows optimal space utilization with RAID0 layout&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The &lt;strong&gt;&lt;code&gt;nodiscard&lt;/code&gt; mount option is absolutely essential&lt;/strong&gt; because we&amp;rsquo;re using loop devices backed by &lt;a href="https://en.wikipedia.org/wiki/Sparse_file"&gt;sparse files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Without it, BTRFS would try to issue &lt;a href="https://btrfs.readthedocs.io/en/latest/Trim.html"&gt;TRIM/discard&lt;/a&gt; commands that cause allocation size to be misreported when using loop devices. This misreporting would result in inaccurate space accounting. The &lt;code&gt;nodiscard&lt;/code&gt; option ensures the filesystem maintains an accurate picture of its available storage.&lt;/p&gt;
&lt;h2 id="choose-your-weapon-the-hatchet-protocol-"&gt;Choose Your Weapon: The Hatchet Protocol 🪓&lt;/h2&gt;
&lt;p&gt;Not everyone needs the same level of space reclamation, so I&amp;rsquo;ve added different &lt;em&gt;&amp;ldquo;Hatchet Protocol&amp;rdquo;&lt;/em&gt; levels to control how aggressive the action is:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;wimpysworld/nothing-but-nix@main&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;hatchet-protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;cleave&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Options: holster, carve, cleave (default), rampage&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;&lt;code&gt;/nix&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Holster&lt;/td&gt;
&lt;td&gt;~65GB&lt;/td&gt;
&lt;td&gt;Keep the hatchet sheathed, use space from &lt;code&gt;/mnt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carve&lt;/td&gt;
&lt;td&gt;~85GB&lt;/td&gt;
&lt;td&gt;Craft and combine free space from &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;/mnt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cleave&lt;/td&gt;
&lt;td&gt;~115GB&lt;/td&gt;
&lt;td&gt;Make decisive cuts to large packages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rampage&lt;/td&gt;
&lt;td&gt;~130GB&lt;/td&gt;
&lt;td&gt;Relentless elimination of all bloat&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I recommend &lt;strong&gt;Cleave&lt;/strong&gt; for most users, which is the default setting. It strikes a good balance between reclaiming space and keeping some useful tools around. But if you&amp;rsquo;re a proper Nix enthusiast who believes that &lt;code&gt;#nix-is-life&lt;/code&gt;, the Rampage protocol will squeeze out every last byte of space for your Nix store ️️❄️&lt;/p&gt;
&lt;h2 id="from-frustration-to-freedom-"&gt;From Frustration to Freedom ️🕊️&lt;/h2&gt;
&lt;p&gt;Since implementing &lt;em&gt;Nothing but Nix&lt;/em&gt;, I&amp;rsquo;ve been able to build &lt;strong&gt;all&lt;/strong&gt; my NixOS and Home Manager configurations in CI. This means:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;🔒 Every &lt;code&gt;flake.lock&lt;/code&gt; update is fully tested against my complete configuration set&lt;/li&gt;
&lt;li&gt;✅ All successful builds are cached to FlakeHub Cache&lt;/li&gt;
&lt;li&gt;⚡ System updates are lightning-fast&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This has been an absolute game-changer for my workflow. Now when I apply updates to any of my devices, everything is delivered directly from &lt;code&gt;cache.flakehub.com&lt;/code&gt; with zero local compilation time! 🚀 All packages have been pre-built and verified in CI, meaning updates that would have taken ages to compile (&lt;em&gt;looking at you &lt;code&gt;ollama&lt;/code&gt;&lt;/em&gt; 👀) locally now complete in seconds. It&amp;rsquo;s the difference between waiting for a coffee break and a blink-and-you&amp;rsquo;ll-miss-it experience 🤩&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s what the build times look like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;💁 2x Servers: ~5-10 minutes&lt;/li&gt;
&lt;li&gt;️🖥️ 2x Workstations: ~6-13 minutes&lt;/li&gt;
&lt;li&gt;💻 4x Laptops: ~7-10 minutes&lt;/li&gt;
&lt;li&gt;👻 2x Virutal Manachines: ~4-10 minutes&lt;/li&gt;
&lt;li&gt;📦 59x Local packages: ~5-14 minutes&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="getting-started-with-nothing-but-nix-"&gt;Getting Started with &lt;em&gt;Nothing but Nix&lt;/em&gt; ✨&lt;/h2&gt;
&lt;p&gt;Ready to give it a go? Here&amp;rsquo;s how to use it in your GitHub Actions workflow:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Test Nix Flake&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;branches&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="l"&gt;main ]&lt;/span&gt;&lt;span class="w"&gt;
&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&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;tests&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ubuntu-latest&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;id-token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;write&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;read&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/checkout@v4 &lt;/span&gt;&lt;span class="w"&gt;
&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="c"&gt;# 👇 Add this before installing Nix&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;wimpysworld/nothing-but-nix@main &lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;DeterminateSystems/determinate-nix-action@main&lt;/span&gt;&lt;span class="w"&gt;
&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="nt"&gt;run&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="sd"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; # Now you have 100+ GB for your Nix builds!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; nix build . -L
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; nix flake check&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For FlakeHub users, make sure you add the &lt;code&gt;permissions&lt;/code&gt; block as shown above. This allows &lt;a href="https://determinate.systems/nix/"&gt;Determinate Nix&lt;/a&gt; to authenticate with FlakeHub and FlakeHub Cache.&lt;/p&gt;
&lt;h2 id="beyond-storage-to-virtual-machines-"&gt;Beyond Storage to Virtual Machines? 🔮&lt;/h2&gt;
&lt;p&gt;Now that I&amp;rsquo;ve proven large volumes can be dynamically constructed in GitHub runners, I&amp;rsquo;m starting to think about what else might be possible. A GitHub action that implements something like &lt;a href="https://github.com/quickemu-project/quickemu"&gt;Quickemu&lt;/a&gt; (&lt;em&gt;another project of mine&lt;/em&gt;), to standup KVM-accelerated VMs inside a GitHub runner is my favourite idea 💡&lt;/p&gt;
&lt;p&gt;GitHub has &lt;a href="https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-host"&gt;recently announced&lt;/a&gt; hardware acceleration for Android virtualization on Linux runners, which means the KVM infrastructure is already there and avilable for open source projects and larger runners 😯 All we need to do is leverage it for our own VMs.&lt;/p&gt;
&lt;p&gt;Imagine being able to run a full VM of your validated build environment inside GitHub Actions! It would be like having a self-hosted runner, but without the self-hosting 😏 And it just so happens that the &lt;a href="https://github.com/DeterminateSystems/determinate-nix-action"&gt;Determinate Nix Action&lt;/a&gt; enables KVM in GitHub runners. Coincidence? 😉&lt;/p&gt;
&lt;h2 id="build-something-massive-"&gt;Build Something Massive ️🏗️&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Nothing but Nix&lt;/em&gt; removes one of the most frustrating limitations for Nix users in GitHub Actions. No more trimming your configurations to fit into tiny spaces - now you can build and test your full NixOS fleet with confidence 🤓&lt;/p&gt;
&lt;p&gt;Give it a try, and let me know what you think!&lt;/p&gt;
&lt;p&gt;The action is available at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/wimpysworld/nothing-but-nix"&gt;wimpysworld/nothing-but-nix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Marketplace: &lt;a href="https://github.com/marketplace/actions/nothing-but-nix"&gt;&lt;em&gt;Nothing but Nix&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you run into any issues or have ideas for improvements, please open an issue on GitHub. And if this tool saves your CI builds, consider giving the repo a star! ⭐&lt;/p&gt;
&lt;p&gt;Happy Nixing! ❄️&lt;/p&gt;</description><summary>The Nix Space Heist: Reclaiming 130GB in GitHub Actions</summary></item><item><title>Fuzzel Colour Picker</title><link>https://blog.wimpys.world/posts/fuzzel-hyprpicker/</link><pubDate>Tue, 15 Apr 2025 13:37:42 +0100</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/fuzzel-hyprpicker/</guid><description>&lt;p&gt;We&amp;rsquo;ve all been there - you&amp;rsquo;re knee-deep in customizing your desktop, tweaking configs, perfecting that theme, and suddenly you need to grab a specific colour from somewhere on screen.
If you&amp;rsquo;re like me and recently made the jump to &lt;a href="https://hyprland.org/"&gt;Hyprland&lt;/a&gt; (or other contemporary Wayland compositor), you might have found yourself missing some of those handy X11 utilities that &lt;em&gt;&amp;ldquo;just worked&amp;rdquo;&lt;/em&gt; ️™️&lt;/p&gt;
&lt;h2 id="the-wayland-colour-picker-problem"&gt;The Wayland Colour Picker Problem&lt;/h2&gt;
&lt;p&gt;When I switched my daily driver to Hyprland back in August 2024, I was chuffed with the smooth animations, efficient tiling, and general polish.
But as with any big change, there were a few splinters in my workflow that needed sorting.&lt;/p&gt;
&lt;p&gt;One particular rough edge was the lack of a proper GUI colour picker.
On X11, I&amp;rsquo;d been spoiled by my mate &lt;a href="https://mastodon.social/@sil"&gt;Stuart Langridge&lt;/a&gt;&amp;rsquo;s excellent tool &lt;strong&gt;&lt;a href="https://www.kryogenix.org/code/pick/"&gt;Pick&lt;/a&gt;&lt;/strong&gt; - a proper colour picker that did exactly what it said on the tin.
But in Wayland? Well, I was left running &lt;a href="https://github.com/hyprwm/hyprpicker"&gt;&lt;code&gt;hyprpicker&lt;/code&gt;&lt;/a&gt; from the terminal like some kind of savage! 😅&lt;/p&gt;
&lt;p class="text-center"&gt;
&lt;img src="./hyprpicker.png" class="img-fluid" alt="hyprpicker in the terminal "/&gt;
&lt;br /&gt;
&lt;em&gt;hyprpicker in the terminal&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;Don&amp;rsquo;t get me wrong - &lt;code&gt;hyprpicker&lt;/code&gt; works brilliantly for what it is.
But after seeing how well my recent integrations of &lt;a href="https://github.com/e-tho/bzmenu"&gt;&lt;strong&gt;bzmenu&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://github.com/e-tho/iwmenu"&gt;&lt;strong&gt;iwmenu&lt;/strong&gt;&lt;/a&gt; worked with &lt;a href="https://codeberg.org/dnkl/fuzzel"&gt;Fuzzel&lt;/a&gt;, a lightbulb moment hit me: why not create a proper Fuzzel-based front-end for &lt;code&gt;hyprpicker&lt;/code&gt;? 💡&lt;/p&gt;
&lt;h2 id="birth-of-fuzzel-hyprpicker"&gt;Birth of fuzzel-hyprpicker&lt;/h2&gt;
&lt;p&gt;After my second coffee one morning (the optimal programming fuel ☕💪), I decided to tackle this problem head-on.
If I was going to spend hours staring at my &lt;a href="https://catppuccin.com/"&gt;Catppuccin Mocha&lt;/a&gt; themed desktop, I needed proper tools to maintain it! ‍🐈‍⬛🎨&lt;/p&gt;
&lt;p&gt;The goal was simple:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a Fuzzel-based UI for &lt;code&gt;hyprpicker&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Maintain persistent colour history&lt;/li&gt;
&lt;li&gt;Make it keyboard-friendly&lt;/li&gt;
&lt;li&gt;Automatcially copy selected colours to clipboard&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The result is &lt;a href="https://github.com/wimpysworld/nix-config/blob/main/home-manager/_mixins/desktop/hyprland/fuzzel/fuzzel-hyprpicker.sh"&gt;&lt;code&gt;fuzzel-hyprpicker.sh&lt;/code&gt;&lt;/a&gt; - a little script that brings together the power of &lt;code&gt;hyprpicker&lt;/code&gt; with the elegant UI of Fuzzel.&lt;/p&gt;
&lt;p class="text-center"&gt;
&lt;img src="./fuzzel-hyprpicker.png" class="img-fluid" alt="fuzzel-hyprpicker colour selection menu "/&gt;
&lt;br /&gt;
&lt;em&gt;fuzzel-hyprpicker showing the colour selection menu&lt;/em&gt;
&lt;/p&gt;
&lt;h2 id="how-it-works"&gt;How It Works&lt;/h2&gt;
&lt;p&gt;The magic behind &lt;code&gt;fuzzel-hyprpicker.sh&lt;/code&gt; is surprisingly straightforward.
Let me walk you through the key bits:&lt;/p&gt;
&lt;h3 id="setting-up-the-basics"&gt;Setting Up the Basics&lt;/h3&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="cp"&gt;#!/usr/bin/env bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# A tool to pick colours from the screen using hyprpicker and fuzzel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;set&lt;/span&gt; +u &lt;span class="c1"&gt;# Disable nounset&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;APP_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;fuzzel-hyprpicker&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;NOTIFY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;notify-desktop --app-name=&lt;/span&gt;&lt;span class="nv"&gt;$APP_NAME&lt;/span&gt;&lt;span class="s2"&gt; --icon=org.gnome.design.Palette&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Set up the storage directory and file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CONFIG_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;XDG_CONFIG_HOME&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="p"&gt;/.config&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$APP_NAME&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;HISTORY_FILE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$CONFIG_DIR&lt;/span&gt;&lt;span class="s2"&gt;/colours.txt&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;ICONS_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$CONFIG_DIR&lt;/span&gt;&lt;span class="s2"&gt;/icons&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nothing fancy here - we&amp;rsquo;re just setting up our environment, defining where we&amp;rsquo;ll store our colour history, and setting up notifications.
Note that I properly follow the XDG spec here - it&amp;rsquo;s the little things! 😉&lt;/p&gt;
&lt;h3 id="the-clever-bit-svg-icons"&gt;The Clever Bit: SVG Icons&lt;/h3&gt;
&lt;p&gt;Here&amp;rsquo;s where things get interesting.
Fuzzel supports icons in its menus, but I needed a way to show colour swatches.
The solution? Dynamically generated SVG files:&lt;/p&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="k"&gt;function&lt;/span&gt; generate_svg_icon&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;colour&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;icon_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$ICONS_DIR&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$colour&lt;/span&gt;&lt;span class="s2"&gt;.svg&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Create an SVG for the colour if it doesn&amp;#39;t exist&lt;/span&gt;
&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="o"&gt;[&lt;/span&gt; ! -f &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$icon_path&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; cat &amp;gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$icon_path&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;&amp;lt;EOF
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;&amp;lt;svg width=&amp;#34;128&amp;#34; height=&amp;#34;128&amp;#34; xmlns=&amp;#34;http://www.w3.org/2000/svg&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; &amp;lt;rect width=&amp;#34;128&amp;#34; height=&amp;#34;128&amp;#34; fill=&amp;#34;#$colour&amp;#34; /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;&amp;lt;/svg&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m rather pleased with myself for this solution.
Each time you pick a colour, it generates a tiny SVG file that&amp;rsquo;s just a coloured square.
Fuzzel then displays this next to the hex code in the menu. Well done brain! 🧠&lt;/p&gt;
&lt;h3 id="menu-building"&gt;Menu Building&lt;/h3&gt;
&lt;p&gt;The menu itself is built dynamically, showing an eyedropper icon for picking a new colour followed by your colour history:&lt;/p&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="k"&gt;function&lt;/span&gt; build_menu&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; -e &lt;span class="s2"&gt;&amp;#34;Pick a colour\0icon\x1f&lt;/span&gt;&lt;span class="nv"&gt;$ICONS_DIR&lt;/span&gt;&lt;span class="s2"&gt;/eyedropper.svg&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Add history items if they exist&lt;/span&gt;
&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="o"&gt;[&lt;/span&gt; -s &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$HISTORY_FILE&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; -r colour&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# If the preview icon doesn&amp;#39;t exist, generate it&lt;/span&gt;
&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="o"&gt;[&lt;/span&gt; ! -e &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$ICONS_DIR&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$colour&lt;/span&gt;&lt;span class="s2"&gt;.svg&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; generate_svg_icon &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$colour&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Display the colour with a preview&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; -e &lt;span class="s2"&gt;&amp;#34;#&lt;/span&gt;&lt;span class="nv"&gt;$colour&lt;/span&gt;&lt;span class="s2"&gt;\0icon\x1f&lt;/span&gt;&lt;span class="nv"&gt;$ICONS_DIR&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$colour&lt;/span&gt;&lt;span class="s2"&gt;.svg&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;done&lt;/span&gt; &amp;lt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$HISTORY_FILE&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This uses the &lt;a href="https://github.com/davatorium/rofi"&gt;&lt;code&gt;rofi&lt;/code&gt;&lt;/a&gt; &amp;ldquo;protocol&amp;rdquo; for menu items, something Fuzzel has built-in support for 💖
The &lt;code&gt;\0icon\x1f&lt;/code&gt; bit is how you tell Fuzzel &lt;em&gt;&amp;ldquo;hey, use this icon for this menu item&amp;rdquo;&lt;/em&gt;.&lt;/p&gt;
&lt;h3 id="putting-it-all-together"&gt;Putting It All Together&lt;/h3&gt;
&lt;p&gt;The full workflow goes like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press &lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;Alt&lt;/kbd&gt; + &lt;kbd&gt;K&lt;/kbd&gt; to open the picker&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;&amp;ldquo;Pick a colour&amp;rdquo;&lt;/strong&gt; or choose one from your history&lt;/li&gt;
&lt;li&gt;If picking a new colour, &lt;code&gt;hyprpicker&lt;/code&gt; does it&amp;rsquo;s thing and click anywhere on screen&lt;/li&gt;
&lt;li&gt;The colour gets automatically copied to your clipboard&lt;/li&gt;
&lt;li&gt;A notification appears showing the selected colour&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="text-center"&gt;
&lt;img src="./hyprpicker-select.png" class="img-fluid" alt="hyprpicker colour selection "/&gt;
&lt;br /&gt;
&lt;em&gt;hyprpicker colour selection&lt;/em&gt;
&lt;/p&gt;
&lt;h2 id="integrating-it-with-your-setup"&gt;Integrating It With Your Setup&lt;/h2&gt;
&lt;p&gt;Want to give this a try yourself?
Here&amp;rsquo;s how to adapt it to your wlroots-compatible desktop:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First, make sure you have the following installed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hyprpicker&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fuzzel&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/bugaevc/wl-clipboard"&gt;&lt;code&gt;wl-clipboard&lt;/code&gt;&lt;/a&gt; (for clipboard management)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nowrep/notify-desktop"&gt;&lt;code&gt;notify-desktop&lt;/code&gt;&lt;/a&gt; (for notifications)
&lt;ul&gt;
&lt;li&gt;Although I&amp;rsquo;m planning on switching to &lt;a href="https://codeberg.org/dnkl/fyi"&gt;&lt;code&gt;fyi&lt;/code&gt;&lt;/a&gt; soon&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save the script somewhere in your path (I&amp;rsquo;ve got mine as part of &lt;a href="https://github.com/wimpysworld/nix-config"&gt;my Nix configuration&lt;/a&gt;) ️❄️&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make it executable:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&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;chmod +x fuzzel-hyprpicker.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="4"&gt;
&lt;li&gt;Bind it to a keyboard shortcut in your Hyprland config:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;bind = CTRL ALT, K, exec, fuzzel-hyprpicker.sh
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="5"&gt;
&lt;li&gt;Give it a whirl!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It should work with any wlroots-compatible compositor, not just Hyprland.&lt;/p&gt;
&lt;h2 id="possible-enhancements"&gt;Possible Enhancements&lt;/h2&gt;
&lt;p&gt;This is very much a v1 and there&amp;rsquo;s plenty of room for improvement:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add support for different colour formats (RGB, HSL, etc.)&lt;/li&gt;
&lt;li&gt;Implement colour name lookup&lt;/li&gt;
&lt;li&gt;Create a proper project rather than just a script wedged in my Nix configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But for a morning hack, it&amp;rsquo;s been surprisingly useful!
Reaching for &lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;Alt&lt;/kbd&gt; + &lt;kbd&gt;K&lt;/kbd&gt; brings a smile to my face 😀&lt;/p&gt;
&lt;h2 id="the-joy-of-keyboard-driven-workflows"&gt;The Joy of Keyboard-Driven Workflows&lt;/h2&gt;
&lt;p&gt;What I love about tools like this is how they contribute to a cohesive, keyboard-driven workflow.
Between Hyprland&amp;rsquo;s tiling, Waybar&amp;rsquo;s status info, and Fuzzel-based menus for everything from launching apps to picking colours, my fingers rarely stray from the keyboard these days.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s something deeply satisfying about crafting your own tools to scratch your own itches.
It&amp;rsquo;s a long held Linux desktop tradition, isn&amp;rsquo;t it?
Taking what works, improving what doesn&amp;rsquo;t, and sharing the results with others.&lt;/p&gt;
&lt;p class="text-center"&gt;
&lt;a href="https://linuxmatters.sh" target="_blank"&gt;&lt;img src="./hyprland-desktop.png" class="img-fluid" alt="hyprland desktop with fuzzel-hyprpicker "/&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;em&gt;My hyprland desktop with fuzzel-hyprpicker in action&lt;/em&gt;
&lt;/p&gt;
&lt;h2 id="more-fuzzel-based-tools"&gt;More Fuzzel-Based Tools?&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve created several other Fuzzel menus that integrate with my Hyprland desktop.
I should probably post about those as well - emoji picker and screenshot and screen recording being among my most useful.
Let me know in the comments if you&amp;rsquo;d be interested in seeing those! 👇&lt;/p&gt;
&lt;p&gt;In the meantime, give &lt;code&gt;fuzzel-hyprpicker.sh&lt;/code&gt; a try and let me know what you think.
&lt;strong&gt;And if you improve upon it, &lt;em&gt;please do share your changes!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The full script is available in my Nix config repository: &lt;a href="https://github.com/wimpysworld/nix-config/blob/main/home-manager/_mixins/desktop/hyprland/fuzzel/fuzzel-hyprpicker.sh"&gt;fuzzel-hyprpicker.sh&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Happy colour picking! 🎨🤏&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Have you created any custom tools for your Wayland desktop? Are there any X11 utilities you miss since switching? Let me know in the comments below!&lt;/em&gt;&lt;/p&gt;</description><summary>Creating a Proper Colour Picker for Hyprland with Fuzzel</summary></item><item><title>Creating Production-Ready Containers - Advanced Techniques</title><link>https://blog.wimpys.world/posts/creating-production-ready-containers-advanced-techniques/</link><pubDate>Fri, 18 Jun 2021 12:18:15 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/creating-production-ready-containers-advanced-techniques/</guid><description>&lt;p&gt;Creating production-ready containers for use in commercial-grade apps can be a far cry from the &amp;ldquo;get started with Node.js and Docker&amp;rdquo;-type of tutorials that are common around the Internet. Those guides are great for introducing all the advantages of Docker containers in modern cloud-native development, but creating a container that passes muster in a large-scale application in production is a different story.&lt;/p&gt;
&lt;p&gt;For production-ready containers, there are three key things you want to optimise for when creating a container:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Image Size 📦&lt;/li&gt;
&lt;li&gt;Build Speed 🐢&lt;/li&gt;
&lt;li&gt;Security 🔐&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Image size and build speed ensure that your containers can move through CI/CD and test pipelines easily and efficiently. Security is critical in today&amp;rsquo;s software supply chain, and containers have their own set of security issues. Thankfully, reducing container image size actually can alleviate some security issues in containers.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.wimpys.world/posts/creating-production-ready-containers-the-basics"&gt;In my Basics article&lt;/a&gt;, I showed you some easy techniques to improve your &lt;code&gt;Dockerfile&lt;/code&gt; using a sample &amp;ldquo;Hello World&amp;rdquo; Node.js application.&lt;/p&gt;
&lt;p&gt;These basics address all three optimisations, though they only scratch the surface.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at some more advanced techniques for Container Optimisation.&lt;/p&gt;
&lt;h2 id="alpine-images"&gt;Alpine Images&lt;/h2&gt;
&lt;p&gt;The very first thing you&amp;rsquo;ll encounter when looking for techniques to create smaller containers is &lt;a href="https://alpinelinux.org/"&gt;Alpine Linux&lt;/a&gt;. Alpine Linux is an open-source project whose goal is to create a bare-bones 🦴 version of Linux that lets developers &amp;ldquo;build from the ground up.&amp;rdquo;&lt;/p&gt;
&lt;h3 id="pros-transitioning-to-alpine-can-be-an-easy-way-to-get-a-smaller-container"&gt;Pros: Transitioning to Alpine can be an easy way to get a smaller container&lt;/h3&gt;
&lt;p&gt;Reducing image size with Alpine can be incredibly simple - under the right circumstances. For some apps, it&amp;rsquo;s as easy as changing the base image in your &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;/p&gt;
&lt;h4 id="from"&gt;FROM&lt;/h4&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;node:16.2.0&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="to"&gt;TO&lt;/h4&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;node:16.2.0-alpine&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When we build the new image, we see that the old image was 856MB and the new one is 114MB 🎉&lt;/p&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;REPOSITORY TAG IMAGE ID CREATED SIZE
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cotw-node-alpine latest 2cc7b4a7b09c 2 minutes ago 114MB
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cotw-node latest 873fb9fca53a 3 days ago 856MB
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Easy, right? Not so fast.&lt;/p&gt;
&lt;h3 id="cons-using-alpine-images-can-lead-to-build-problems-now-and-in-the-future"&gt;Cons: Using Alpine images can lead to build problems, now and in the future&lt;/h3&gt;
&lt;p&gt;There are some not-so-obvious gotchas with using Alpine images that don&amp;rsquo;t crop up in our super simple example application, such as:&lt;/p&gt;
&lt;h4 id="you-have-to-install-everything"&gt;You have to install everything&lt;/h4&gt;
&lt;p&gt;Those tiny base images have to sacrifice something, right? Alpine users will be installing everything they need, right down to time-zone data or development tools. You won&amp;rsquo;t need your development tools for your production image, most likely, but for most developers, the thought of a server without &lt;code&gt;curl&lt;/code&gt; or &lt;code&gt;vim&lt;/code&gt; is a bridge too far.&lt;/p&gt;
&lt;h4 id="different-compilers-and-package-managers"&gt;Different compilers and package managers&lt;/h4&gt;
&lt;p&gt;You&amp;rsquo;ll also be installing any dependencies with the Alpine Package Keeper tool (&lt;code&gt;apk&lt;/code&gt;) instead of the more familiar &lt;code&gt;apt&lt;/code&gt; or &lt;code&gt;rpm&lt;/code&gt;. The differences are small but can trip up unsuspecting developers.&lt;/p&gt;
&lt;h4 id="fewer-examples-less-documentation"&gt;Fewer examples; less documentation&lt;/h4&gt;
&lt;p&gt;Finally, while Alpine has been around for nine-plus years, it is and likely always will be a smaller and more specialised user base than established Linux distributions such as Ubuntu and Debian. To wit, at the time of this writing the &lt;code&gt;alpine&lt;/code&gt; tag on StackOverflow has just &lt;a href="https://stackoverflow.com/questions/tagged/alpine"&gt;1,280 questions&lt;/a&gt;, compared with &lt;a href="https://stackoverflow.com/questions/tagged/ubuntu"&gt;over 54,000 for Ubuntu&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="multi-stage-builds"&gt;Multi-stage builds&lt;/h2&gt;
&lt;p&gt;The next tactic you are likely to encounter when searching for ways to reduce Docker image sizes is multi-stage 🏗 builds. This tactic, &lt;a href="https://docs.docker.com/develop/develop-images/multistage-build/"&gt;recommended by Docker and many in the Docker community&lt;/a&gt;, is essentially building the image twice. The first set of commands builds your base application image, all things included. The second set of commands builds an image off of that base image, taking only what&amp;rsquo;s needed and leaving out anything that&amp;rsquo;s not.&lt;/p&gt;
&lt;p&gt;With a multi-stage build, our &lt;code&gt;Dockerfile&lt;/code&gt; would look like this. Notice the two &lt;code&gt;FROM&lt;/code&gt; statements. The first builds the application image; the second copies the necessary files from that image into the second, more production-ready version.&lt;/p&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;node:16.2.0-alpine&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;builder&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&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; package*.json ./&lt;span class="err"&gt;
&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; npm ci&lt;span class="err"&gt;
&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; app.js ./&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&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;node:16.2.0-alpine&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&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; --from&lt;span class="o"&gt;=&lt;/span&gt;builder /usr/src/app .&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&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;node&lt;/span&gt;&lt;span class="err"&gt;
&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; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="pros-dev-and-prod-images-can-be-built-separately"&gt;Pros: Dev and Prod images can be built separately&lt;/h3&gt;
&lt;p&gt;When combined with &lt;a href="https://docs.docker.com/compose/"&gt;Docker Compose&lt;/a&gt;, this approach gives developers a flexible development environment while reducing bloat in the production images. You can simply use your initial image for dev/test and the final version for production. Multi-stage builds work especially well for Go containers, significantly reducing image size, but also work well for static Node.js and React-type applications.&lt;/p&gt;
&lt;h3 id="cons-added-complexity-use-case-specific"&gt;Cons: Added complexity; use-case specific&lt;/h3&gt;
&lt;p&gt;Multi-stage builds are still relatively new 🌱 on the scene. For most developers still new to containers, knowing what to copy over to the final production image and what to leave behind is a major barrier to entry. Further, this pattern can run into challenges.&lt;/p&gt;
&lt;p&gt;Since we&amp;rsquo;re already using an Alpine image, the size savings are relatively minor for our &amp;ldquo;Hello World&amp;rdquo; example. You&amp;rsquo;d expect to see greater gains in a full-blown React or Vue application.&lt;/p&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;REPOSITORY TAG IMAGE ID CREATED SIZE
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cotw-node-multistage latest 52bc33d14a87 3 minutes ago 114MB
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cotw-node-alpine latest 2cc7b4a7b09c 4 days ago 114MB
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cotw-node latest 873fb9fca53a 7 days ago 856MB
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="development-tools-and-distroless"&gt;Development tools and Distroless&lt;/h2&gt;
&lt;p&gt;There are several tools - and new ones emerging every day - that look to bypass or automate &lt;code&gt;Dockerfile&lt;/code&gt; authoring to make image creation easier. &lt;a href="https://buildpacks.io/"&gt;&lt;em&gt;Buildpacks&lt;/em&gt;&lt;/a&gt; are the most mature of these technologies and can be used through tools like &lt;a href="https://buildpacks.io/docs/tools/pack/"&gt;Pack&lt;/a&gt; or &lt;a href="https://www.waypointproject.io/plugins/pack"&gt;Waypoint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are builder options from multiple sources - Heroku, Google, and Paketo are common favourites - and each gives you a slightly different developer experience and final image when used.&lt;/p&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;$ pack build cotw-node-bp-google --builder gcr.io/buildpacks/builder:v1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ pack build cotw-node-bp-heroku --builder heroku/buildpacks:18
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ pack build cotw-node-bp-pb-base --builder paketobuildpacks/builder:base
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ pack build cotw-node-bp-pb-full --builder paketobuildpacks/builder:full
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="pros-when-they-work-they-work"&gt;Pros: When they work, they work&lt;/h3&gt;
&lt;p&gt;In certain instances, Buildpacks can take the pain out of &lt;code&gt;Dockerfile&lt;/code&gt; authoring and just create container images of your application with no fuss. The pack tool is looking for &amp;ldquo;app-like&amp;rdquo; files in your source directory, and automatically figuring out what kind of application is there and how to containerize it. In the case of our Node sample, it sees &lt;code&gt;package.json&lt;/code&gt; and correctly assumes we have a Node.js application.&lt;/p&gt;
&lt;h3 id="cons-when-they-dont"&gt;Cons: When they don&amp;rsquo;t…&lt;/h3&gt;
&lt;p&gt;Given the relative newness of this approach for Docker containers, there are a lot of gotchas with Buildpacks. Non-standard applications or operating systems can struggle, and we&amp;rsquo;ve had issues running them successfully on the new Silicon Macbook Pros. The resulting images vary a lot - we saw a range of 200MB to 800MB in our examples - and the results tend to be lower than what you&amp;rsquo;d get with other techniques.&lt;/p&gt;
&lt;h2 id="automate-it-with-slimtoolkit"&gt;Automate it with SlimToolKit&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://slimtoolkit.org/"&gt;SlimToolKit&lt;/a&gt; (&lt;em&gt;formerly DockerSlim&lt;/em&gt;) open-source project was created by &lt;a href="https://slim.ai"&gt;Slim.AI&lt;/a&gt; CTO &lt;a href="https://twitter.com/kcqon"&gt;Kyle Quest&lt;/a&gt; in 2015 as a way to automate container optimisation. Simply download and run &lt;code&gt;slim build &amp;lt;myimage&amp;gt;&lt;/code&gt; and SlimToolKit will examine the image, rebuild it with only the required dependencies, and give you a new image that can be run just like the original.&lt;/p&gt;
&lt;h3 id="pros-its-automatic"&gt;Pros: It&amp;rsquo;s automatic&lt;/h3&gt;
&lt;p&gt;SlimToolKit means you can work with whatever base image you&amp;rsquo;d like (say, Ubuntu or Debian) and let SlimToolKit worry about removing unnecessary tools and files en route to production. The best part is that SlimToolKit can be used alongside any of these other techniques. Once tested, it can be integrated into your CI/CD pipeline for automatic container minification, and the reduction in size leads to faster build times and better security.&lt;/p&gt;
&lt;h3 id="cons-steep-learning-curve"&gt;Cons: Steep learning curve&lt;/h3&gt;
&lt;p&gt;As with any open-source software, SlimToolKit can take some time to get working, especially for non-trivial applications. It works best for web-style applications, micro-services and APIs that have defined HTTP/HTTPS ports which the sensor can find and use to observe the container internals.&lt;/p&gt;
&lt;p&gt;For best results, spend some time getting to know the various command flags available to tune your image, and &lt;a href="https://github.com/slimtoolkit/examples"&gt;take a look at the examples for whatever framework you&amp;rsquo;re using&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="connecting-with-slimtoolkit"&gt;Connecting with SlimToolKit&lt;/h2&gt;
&lt;p&gt;There&amp;rsquo;s an &lt;a href="https://discord.gg/uBttmfyYNB"&gt;active Slim.AI Discord channel&lt;/a&gt; full of experts who can help you triage issues as they arise.&lt;/p&gt;</description><summary>Advanced techniques for production-ready container best practice</summary></item><item><title>Creating Production-Ready Containers - The Basics</title><link>https://blog.wimpys.world/posts/creating-production-ready-containers-the-basics/</link><pubDate>Thu, 03 Jun 2021 12:18:15 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/creating-production-ready-containers-the-basics/</guid><description>&lt;p&gt;So you&amp;rsquo;ve coded an awesome app and you are ready to deploy it to the cloud. You&amp;rsquo;ve heard a lot about &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt; and completed a few online tutorials to containerise your app. All set, right? But what do you need to know if you&amp;rsquo;re going to move that app to a production environment on the public Internet? What if you&amp;rsquo;re using it for your job and need to pass security scans and DevOps checks?&lt;/p&gt;
&lt;p&gt;In this series, I introduce some basic concepts for making production-ready containers. I also introduce the concept of &amp;ldquo;slimming&amp;rdquo; a container. &lt;strong&gt;Slimming&lt;/strong&gt; refers to both optimising and minifying your Docker containers, reducing them in size by up to 80-percent while also making them more secure by decreasing the attack surface. Slimming your container is also a great way to implement &lt;a href="https://www.slim.ai/blog/why-dont-we-practice-container-best-practices"&gt;container best practices&lt;/a&gt; without re-engineering your entire workflow.&lt;/p&gt;
&lt;p&gt;There are many ways to slim a container, from basic security to fully automated open-source tools like &lt;a href="https://slimtoolkit.org/"&gt;SlimToolKit&lt;/a&gt; (formerly &lt;a href="https://dockersl.im/"&gt;DockerSlim&lt;/a&gt;). &lt;em&gt;Full disclosure&lt;/em&gt;: I used work for &lt;a href="https://slim.ai"&gt;Slim.AI&lt;/a&gt;, a company founded on the SlimToolKit open source project. Let&amp;rsquo;s look at some of the common ways developers create production-ready container images today.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll explore each of these in a separate article using a simple &amp;ldquo;Hello World&amp;rdquo; Node.js example that can be found in many online tutorials.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;express&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kr"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&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&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Hello World!&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&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;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&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&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Example app listening at http://localhost:&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&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;p&gt;Let&amp;rsquo;s get started by simply improving your &lt;code&gt;Dockerfile&lt;/code&gt; to build a better Docker image.&lt;/p&gt;
&lt;h2 id="creating-a-better-dockerfile"&gt;Creating a Better Dockerfile&lt;/h2&gt;
&lt;p&gt;Most &lt;code&gt;Dockerfile&lt;/code&gt; examples you&amp;rsquo;ll find are not &amp;ldquo;production ready&amp;rdquo; and they aren&amp;rsquo;t meant to be. They are for instructional purposes to help developers successfully build an image. But when one gets into production scenarios, there are several &amp;ldquo;good-to-know&amp;rdquo; and a few &amp;ldquo;have-to-know&amp;rdquo; techniques that will improve build times, security, and reliability.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look at a typical example that you might run into if you&amp;rsquo;re a Node.js developer looking to get &amp;ldquo;Hello World&amp;rdquo; running with Docker. I won&amp;rsquo;t go through building an actual app - there are a lot of great examples out there to show you how to do this - but rather focus on what to do if you were going to ship this to production.&lt;/p&gt;
&lt;p&gt;The typical &lt;code&gt;Dockerfile&lt;/code&gt; in a &amp;ldquo;Hello World&amp;rdquo; example might look something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:latest&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&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; package*.json app.js ./&lt;span class="err"&gt;
&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; npm install&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&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; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It uses the latest version of the official Node.js image, sets a directory and copies your app into the container image, installs dependencies, exposes port 3000, and runs the app via &lt;code&gt;CMD&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;While this will run no problem on your local machine, and is great for learning the ropes, this approach is almost certainly going to run into issues when you ship it to production. Let&amp;rsquo;s take a look at some of these in order of severity.&lt;/p&gt;
&lt;h3 id="major-issues"&gt;Major issues&lt;/h3&gt;
&lt;h4 id="running-as-root"&gt;Running as Root&lt;/h4&gt;
&lt;p&gt;Since this example doesn&amp;rsquo;t set a &lt;code&gt;USER&lt;/code&gt; explicitly in the &lt;code&gt;Dockerfile&lt;/code&gt;, Docker runs the build and all commands as the &lt;code&gt;root&lt;/code&gt; user. While not an issue for local development, your friendly neighbourhood SysAdmin will tell you the myriad of issues that come with running applications as root on a server in production. And with Docker, a &lt;a href="https://medium.com/jobteaser-dev-team/docker-user-best-practices-a8d2ca5205f4"&gt;new set of attack methods&lt;/a&gt; can arise.&lt;/p&gt;
&lt;p&gt;Thankfully, most major languages and frameworks have a predefined user for running applications. In Node.js, the user is just &lt;code&gt;node&lt;/code&gt; and can be invoked in the &lt;code&gt;Dockerfile&lt;/code&gt; explicitly.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:latest&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&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; package*.json app.js ./&lt;span class="err"&gt;
&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; npm install&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;node&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&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; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="using-latest-version"&gt;Using &lt;code&gt;latest&lt;/code&gt; version&lt;/h4&gt;
&lt;p&gt;Choosing a version number for your container is often called &lt;em&gt;pinning&lt;/em&gt;. While many tutorials - and even some experts - will counsel newcomers to pin their images to the &lt;code&gt;latest&lt;/code&gt; tag, which means you get whatever the most recently updated version is, using the &lt;code&gt;latest&lt;/code&gt; tag can cause issues in production.&lt;/p&gt;
&lt;p&gt;Containers are meant to be ephemeral, meaning they can be created, destroyed, started, stopped, and reproduced with ease and &lt;em&gt;reliability&lt;/em&gt;. Using the &lt;code&gt;latest&lt;/code&gt; tag means there isn&amp;rsquo;t a single source of truth for your container&amp;rsquo;s &amp;ldquo;bill of materials&amp;rdquo;. A new version or update of a dependency could introduce a breaking change, which may cause the build to fail somewhere in your CI/CD pipeline.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example &lt;code&gt;Dockerfile&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:latest&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Production &lt;code&gt;Dockerfile&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:16.2.0&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Other tutorials I&amp;rsquo;ve seen pin only the major version. For example, using &lt;code&gt;node:14&lt;/code&gt;. This carries the same risks as using &lt;code&gt;latest&lt;/code&gt;, as minor versions can change dependencies as well.&lt;/p&gt;
&lt;p&gt;Now, pinning a specific major and minor version in your &lt;code&gt;Dockerfile&lt;/code&gt; is a trade-off decision - you&amp;rsquo;re choosing to not automatically receive security, fixes or performance improvements that come via new updates - but most DevSecOps teams prefer to employ security scanning and container management software as a way to control updates rather than dealing with the unpredictability that comes with container build failures in production CI/CD pipelines.&lt;/p&gt;
&lt;h3 id="performance-improvements"&gt;Performance improvements&lt;/h3&gt;
&lt;h4 id="better-layer-caching"&gt;Better layer caching&lt;/h4&gt;
&lt;p&gt;Docker works on the concept of &lt;em&gt;layer caching&lt;/em&gt;. It builds images sequentially. Layering dependencies on top of each other and only rebuilding them when something in the layer has changed.&lt;/p&gt;
&lt;p&gt;Layer 0 in a Docker image is often the base operating system, which rarely changes significantly; although commercial Linux vendors often publish new base images to incorporate security fixes.&lt;/p&gt;
&lt;p&gt;Application code, however, is highly likely to change during the software development cycle, as you iterate on features, refactor, and fix bugs. Dependencies in our core system, installed here by &lt;code&gt;npm install&lt;/code&gt;, change more often than the base OS, but less often than the application code.&lt;/p&gt;
&lt;p&gt;In our example &lt;code&gt;Dockerfile&lt;/code&gt;, we simply need to break the installation of the dependencies into separate instructions on their own lines.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:16.0.2&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; package*.json ./&lt;span class="err"&gt;
&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; npm ci&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;node&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; app.js ./&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&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; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We actually end up creating another layer by now having two &lt;code&gt;COPY&lt;/code&gt; commands. While adding layers is typically a no-no for build times and image sizes, the tax we pay on this optimisation is going to save us in the long run as we cycle through the QA process, since we aren&amp;rsquo;t reinstalling dependencies if we don’t have to.&lt;/p&gt;
&lt;p&gt;We also opt for the &lt;code&gt;npm ci&lt;/code&gt; command instead of &lt;code&gt;npm install&lt;/code&gt;, which is preferred for automated environments, such as CI/CD, and will help prevent breaking changes from dependencies. Read &lt;a href="https://docs.npmjs.com/cli/v7/commands/npm-ci"&gt;more about &lt;code&gt;npm ci&lt;/code&gt; here&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="use-entrypoint-instead-of-cmd"&gt;Use &lt;code&gt;ENTRYPOINT&lt;/code&gt; instead of &lt;code&gt;CMD&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;At a surface level, there isn&amp;rsquo;t a big difference between using &lt;code&gt;ENTRYPOINT&lt;/code&gt; with your app file versus running &lt;code&gt;CMD&lt;/code&gt; using the shell plus your app file. However, web- and API-type containers like Node.js applications are often running as executables in production, and there, proper signal handling - such as graceful shutdowns - are important.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CMD&lt;/code&gt; provides some flexibility for calling executables with flags or overwriting them, which is common in development. But that generally won&amp;rsquo;t be relevant to production instances and &lt;code&gt;ENTRYPOINT&lt;/code&gt; will likely provide better signal processing.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:16.0.2&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; package*.json ./&lt;span class="err"&gt;
&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; npm ci&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;node&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; app.js ./&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="cleaning-up-cached-files"&gt;Cleaning up cached files&lt;/h3&gt;
&lt;p&gt;Most package managers have the ability to clean up their own cache. If you don’t do this, you&amp;rsquo;ll just be moving a bunch of unused files into your container for no reason. It might not save a lot of space depending on your application, but think of it as dropping your unused items at the charity shop &lt;em&gt;before&lt;/em&gt; you move rather than loading them in the moving van. It&amp;rsquo;s not a lot of effort and it&amp;rsquo;s the right thing to do. We do this by adding &lt;code&gt;&amp;amp;&amp;amp; npm cache clean --force&lt;/code&gt; to our &lt;code&gt;RUN&lt;/code&gt; instruction.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-docker" data-lang="docker"&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;node:16.0.2&lt;/span&gt;&lt;span class="err"&gt;
&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;/usr/src/app&lt;/span&gt;&lt;span class="err"&gt;
&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; package*.json ./&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; npm ci &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm cache clean --force&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;node&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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; app.js ./&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&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;3000&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app.js&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="conclusions"&gt;Conclusions&lt;/h3&gt;
&lt;p&gt;Improving your &lt;code&gt;Dockerfile&lt;/code&gt; is the first step towards creating a slimmed and optimised container. It closes some major security loopholes that are likely to raise flags with downstream checks and adds baseline optimisations for build time and docker image size.&lt;/p&gt;
&lt;p&gt;If this is all you do to improve your containers prior to shipping to production, you won&amp;rsquo;t be in a bad spot, but there&amp;rsquo;s more - &lt;em&gt;way more&lt;/em&gt; - that you can do to optimise images. We&amp;rsquo;ll &lt;a href="https://blog.wimpys.world/posts/creating-production-ready-containers-advanced-techniques/"&gt;explore those techniques in the next article&lt;/a&gt;.&lt;/p&gt;</description><summary>Beginners guide to container best practices</summary></item><item><title>Python Distributions</title><link>https://blog.wimpys.world/posts/python-distributions/</link><pubDate>Mon, 24 Jun 2013 13:11:43 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/python-distributions/</guid><description>&lt;p&gt;At &lt;a href="http://www.flightdataservices.com"&gt;work&lt;/a&gt; I maintain the
&lt;a href="http://http://jenkins-ci.org/"&gt;Jenkins&lt;/a&gt; test and build servers. I&amp;rsquo;m just about
to update our Windows build servers and thought I&amp;rsquo;d better check the available
&amp;ldquo;Python Distributions&amp;rdquo; to see if our current choice (the brilliant
&lt;a href="https://code.google.com/p/pythonxy/"&gt;Python(x,y)&lt;/a&gt; is still the most suitable for
our needs.&lt;/p&gt;
&lt;p&gt;Our &lt;a href="http://github.com/FlightDataServices"&gt;Flight Data Analyzer&lt;/a&gt; makes extensive
use of &lt;a href="http://www.numpy.org/"&gt;Numpy&lt;/a&gt;, &lt;a href="http://www.scipy.org/"&gt;Scipy&lt;/a&gt;,
&lt;a href="http://code.google.com/p/h5py/"&gt;h5py&lt;/a&gt; and other analysis tools. So, pre-built
Python distributions on Windows save me a lot of &lt;del&gt;pain&lt;/del&gt; time. On Linux we roll
our own of course.&lt;/p&gt;
&lt;p&gt;What follows is a list of Python Distributions that include Python and the essential
modules we require.&lt;/p&gt;
&lt;h2 id="anaconda"&gt;Anaconda&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Completely free enterprise-ready Python distribution for large-scale data
processing, predictive analytics, and scientific computing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://store.continuum.io/cshop/anaconda/"&gt;https://store.continuum.io/cshop/anaconda/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Heard about this for the first time a couple of days ago. It looks very promising
with 32-bit and 64-bit flavours and MKL optimised modules are available from the
reasonably priced Anaconda Accelerate. While I roll my own Python Distribution for
our Linux build servers, I am rather taken with the idea of using Anaconda on Linux
and Windows to provide a consistent platform everywhere. I&amp;rsquo;m looking forward to
testing Anaconda this week.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.continuum.io"&gt;Continuum&lt;/a&gt; appear to be taking on Enthought at their
own game, and good luck to them as they have some really interesting projects
on the go.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.continuum.io/developer-resources"&gt;http://www.continuum.io/developer-resources&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="enthought-canopy"&gt;Enthought Canopy&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Enthought Canopy is a comprehensive Python analysis environment with easy
installation &amp;amp; updates of the proven Enthought Python distribution - all part
of a robust platform you can explore, develop and visualize on.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.enthought.com/products/canopy/"&gt;https://www.enthought.com/products/canopy/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We used to use Entought EPD and Canopy builds on EPD. However, we decided to
switch from EPD and consolidate analyst workstation and build server deployments
around Python(x,y).&lt;/p&gt;
&lt;p&gt;There were several factors to this decision, but the main issue was that updates
to the EPD package repositories were slow for some essential modules we use. Canopy
seems to have inherited package latency from EPD as Numpy is still at 1.6.1 while
we now require Numpy 1.7.&lt;/p&gt;
&lt;p&gt;Paid versions of Canopy have MKL optimizations and 64-bit platform support.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.enthought.com/products/canopy/compare-subscriptions/"&gt;https://www.enthought.com/products/canopy/compare-subscriptions/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="pythonxy"&gt;Python(x,y)&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Scientific-oriented Python Distribution based on Qt and Spyder.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.google.com/p/pythonxy/"&gt;https://code.google.com/p/pythonxy/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is what we currently use for Windows build servers and analyst workstations.
The only reason I&amp;rsquo;m conisdering switching is that is it 32-bit only. Other than
that, I love it and highly recommend it. Python(x,y) doesn&amp;rsquo;t offer MKL optimisations.&lt;/p&gt;
&lt;h2 id="winpython"&gt;WinPython&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;WinPython is a portable scientific Python 2/3 32/64bit distribution for Windows&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/winpython/"&gt;http://code.google.com/p/winpython/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From the same stable as Python(x,y) but has 32-bit and 64-bit flavours, yummy.
WinPython includes everything I need so will definately get fully tested this week.&lt;/p&gt;
&lt;h2 id="portable-python"&gt;Portable Python&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Portable Python is a Python programming language pre-configured to run directly
from any USB storage device, enabling you to have, at any time, a portable
programming environment.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://portablepython.com/"&gt;http://portablepython.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Not looked at this in any real detail. Appears to be 32-bit only but does include
a number of essential packages.&lt;/p&gt;
&lt;h2 id="unofficial-windows-binaries-for-python-extension-packages"&gt;Unofficial Windows Binaries for Python Extension Packages&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Provides 32- and 64-bit Windows binaries of many scientific open-source extension
packages for the official CPython distribution of the Python programming language.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/"&gt;http://www.lfd.uci.edu/~gohlke/pythonlibs/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;OK, so this is not a Python distribution but it is compelling. 32-bit and 64-bit
platforms are catered for and MKL optimizations are available at no cost. Each
package needs to be installed individually, which can be seen as both good and bad.
Good because you only install what you actually require and bad because the initial
installation is protracted. That said, it is on my evaluation list for this week.&lt;/p&gt;
&lt;h2 id="anymore"&gt;Anymore?&lt;/h2&gt;
&lt;p&gt;Those are the Python Distributions I&amp;rsquo;m aware of. Are there any others I should
consider?&lt;/p&gt;</description><summary>A selection of Python distributions for data analysis</summary></item><item><title>Python and virtualenv on Arch Linux and Ubuntu</title><link>https://blog.wimpys.world/posts/python-and-virtualenv-on-arch-linux-and-ubuntu/</link><pubDate>Tue, 11 Dec 2012 20:38:50 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/python-and-virtualenv-on-arch-linux-and-ubuntu/</guid><description>&lt;p&gt;We use &lt;a href="http://www.python.org"&gt;Python&lt;/a&gt; for pretty much all our software
development at &lt;a href="http://www.flightdataservices.com/"&gt;work&lt;/a&gt;. We also use
&lt;a href="http://www.virtualenv.org"&gt;virtualenv&lt;/a&gt; and
&lt;a href="http://www.doughellmann.com/projects/virtualenvwrapper/"&gt;virtualenvwrapper&lt;/a&gt;
extensively, both for development &lt;em&gt;and&lt;/em&gt; deployment.&lt;/p&gt;
&lt;h2 id="why-is-virtualenv-so-great"&gt;Why is virtualenv so great?&lt;/h2&gt;
&lt;p&gt;It just is. Read the &lt;a href="http://www.virtualenv.org/en/latest/"&gt;virtualenv documentation&lt;/a&gt;.
If you&amp;rsquo;re a Python developer you need &lt;code&gt;virtualenv&lt;/code&gt; in your life. You also need
&lt;code&gt;virtualenvwrapper&lt;/code&gt; too.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool
for creating isolated Python development environments.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="installing-python-and-virtualenvwrapper"&gt;Installing Python and virtualenvwrapper&lt;/h2&gt;
&lt;p&gt;Outlined below is how I install Python and &lt;code&gt;virtualenvwrapper&lt;/code&gt;. We have not
yet made the jump to Python 3 at work, hence the references to Python 2.6 and
2.7. Some of us develop on Arch Linux, but all deployments are on Ubuntu.&lt;/p&gt;
&lt;h3 id="arch-linux"&gt;Arch Linux&lt;/h3&gt;
&lt;p&gt;As Arch Linux is a rolling release we can simply install everything via
&lt;code&gt;pacman&lt;/code&gt;.&lt;/p&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;sudo pacman -Syy
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pacman -S --needed --noconfirm python-pip python-setuptools python-virtualenv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pacman -S --needed --noconfirm python2-pip python2-setuptools python2-virtualenv python-virtualenvwrapper&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Simple.&lt;/p&gt;
&lt;h3 id="ubuntu"&gt;Ubuntu&lt;/h3&gt;
&lt;p&gt;The following was done on Ubuntu Lucid 10.04 LTS.&lt;/p&gt;
&lt;p&gt;Add some essential PPAs.&lt;/p&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;sudo apt-add-repository ppa:bzr/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:git-core/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:fkrull/deadsnakes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Update the system and install Python 2.6 and 2.7.&lt;/p&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;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install libpython2.6 python2.6 python2.6-dev python2.6-minimal
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install libpython2.7 python2.7 python2.7-dev python2.7-minimal
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Remove any &lt;code&gt;apt&lt;/code&gt; installed Python packages that we are about to repalce. The
versions of these packages in the Ubuntu repos and PPAs are too old.&lt;/p&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;sudo apt-get purge python-setuptools python-virtualenv python-pip python-profiler
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install &lt;code&gt;distribute&lt;/code&gt;.&lt;/p&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;curl -O http://python-distribute.org/distribute_setup.py
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo python2.6 distribute_setup.py
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo python2.7 distribute_setup.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install &lt;code&gt;pip&lt;/code&gt;.&lt;/p&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;curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo python2.6 get-pip.py
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo python2.7 get-pip.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use &lt;code&gt;pip&lt;/code&gt; to install &lt;code&gt;virtualenv&lt;/code&gt; and &lt;code&gt;virtualenv&lt;/code&gt; wrapper.&lt;/p&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;sudo pip-2.6 install virtualenv --upgrade
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pip-2.7 install virtualenv --upgrade
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo pip install virtualenvwrapper
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fairly simple.&lt;/p&gt;
&lt;h3 id="the-snakepit"&gt;The Snakepit&lt;/h3&gt;
&lt;p&gt;This step is common to Arch Linux and Ubuntu. Create a &lt;em&gt;&amp;ldquo;Snakepit&amp;rdquo;&lt;/em&gt; directory for
storing all the virtualenvs.&lt;/p&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;mkdir ~/Snakepit
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the following your &lt;code&gt;~/.bashrc&lt;/code&gt; to enable &lt;code&gt;virtualenvwrapper&lt;/code&gt;.&lt;/p&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;WORKON_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/Snakepit
&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="o"&gt;[&lt;/span&gt; -f /usr/local/bin/virtualenvwrapper.sh &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;source&lt;/span&gt; /usr/local/bin/virtualenvwrapper.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; -f /usr/bin/virtualenvwrapper.sh &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;source&lt;/span&gt; /usr/bin/virtualenvwrapper.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="creating-a-virtualenv"&gt;Creating a virtualenv&lt;/h2&gt;
&lt;p&gt;Open a new shell to ensure that the &lt;code&gt;virtualenvwrapper&lt;/code&gt; configuration is
active.&lt;/p&gt;
&lt;p&gt;The following will create a new virtualenv called &lt;code&gt;Nikola5&lt;/code&gt; based on Python
2.7 and will not give access to the global &lt;code&gt;site-packages&lt;/code&gt; directory.&lt;/p&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;mkvirtualenv -p python2.7 --no-site-packages ~/Snakepit/Nikola5
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;mkvirtualenv_help&lt;/code&gt; shows a full list of arguments, the &lt;code&gt;-r&lt;/code&gt; switch can install
all the packages listed in a &lt;code&gt;pip&lt;/code&gt; requirements file into the newly created
virtualenv. Very useful.&lt;/p&gt;
&lt;h2 id="working-on-a-virtualenv"&gt;Working on a virtualenv&lt;/h2&gt;
&lt;p&gt;To workon, or activate, an existing virtualenv do the following.&lt;/p&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;workon Nikola5
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can switch to another virtualenv at any time, just use &lt;code&gt;workon envname&lt;/code&gt;.
Your shell prompt will change while a virtualenv is being worked on to indicate
which virtualenv is currently active.&lt;/p&gt;
&lt;p&gt;While working on a virtualenv you can &lt;code&gt;pip&lt;/code&gt; install what you need or manually
install any Python libraries safe in the knowledge you will not adversely
damage any other virtualenvs or the global packages in the process. Very useful
for developing a new branch which may have different library requirements than
the master/head.&lt;/p&gt;
&lt;p&gt;When you are finished working in a virtualenv you can deactivate it by simply
executing:&lt;/p&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;deactivate
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That just about sums up my notes.&lt;/p&gt;</description><summary>Installing Python and virtualenv on Arch Linux and Ubuntu</summary></item><item><title>GitHub Analytics</title><link>https://blog.wimpys.world/posts/github-analytics/</link><pubDate>Fri, 26 Oct 2012 16:39:00 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/github-analytics/</guid><description>&lt;p&gt;As I mentioned in a previous post we are prepairing to &lt;a href="2012-10-migrating-bzr-to-git.html"&gt;migrate our Bazaar
repositories to Git&lt;/a&gt;, or more
precisely to &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt;. This migration also heralds the
Open Source releases of many of the core technologies we&amp;rsquo;ve been developing at
&lt;a href="http://www.flightdataservices.com"&gt;Flight Data Services&lt;/a&gt; for the last few years.&lt;/p&gt;
&lt;p&gt;I want to track visits for our GitHub projects. A bit of Googling turned up
&lt;a href="http://githalytics.com/"&gt;githalytics&lt;/a&gt; which enables you to track visits and
page views for your GitHub projects using
[http://www.google.com/analytics/](Google Analytics).&lt;/p&gt;
&lt;p&gt;To use it, create a new Google Analytics property ID for your GitHub project,
head over to &lt;a href="http://githalytics.com/"&gt;http://githalytics.com/&lt;/a&gt; and complete the web form. You&amp;rsquo;ll be
provided a &lt;a href="http://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt; snippet to
insert in your projects &lt;code&gt;README.md&lt;/code&gt;. It will look something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[&lt;span class="nt"&gt;![githalytics.com alpha&lt;/span&gt;](&lt;span class="na"&gt;https://cruel-carlota.pagodabox.com/0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f &amp;#34;githalytics.com&amp;#34;&lt;/span&gt;)](http://githalytics.com/YourGitHubName/YourGitHubProject)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the snippet to &lt;code&gt;README.md&lt;/code&gt; and push the changes. When someone visits your
GitHub project page, the visit will be tracked. Great!&lt;/p&gt;
&lt;p&gt;However, we write all our documentation using
&lt;a href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt;. But after a
quick Twitter and email exchange with Dimitrios from githalytics and I had
a reStructuredText snippet. It looks something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rest" data-lang="rest"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;image:: https://cruel-carlota.pagodabox.com/0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; :alt: githalytics.com&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; :target: http://githalytics.com/YourGitHubName/YourGitHubProject&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Same drill, except add this snippet to &lt;code&gt;README.rst&lt;/code&gt; and push the changes.&lt;/p&gt;
&lt;p&gt;So there you have it, Google Analytics tracking of your GitHub project landing
page. If you have more than one project, create a Google Analytics property ID
and githalytics tracking snippet for each project.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://githalytics.com/"&gt;http://githalytics.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://githalytics.tumblr.com/"&gt;http://githalytics.tumblr.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://coderwall.com/team/githalytics"&gt;http://coderwall.com/team/githalytics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/4376560/add-google-analytics-to-github-wiki-pages"&gt;http://stackoverflow.com/questions/4376560/add-google-analytics-to-github-wiki-pages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>How to add Google Analytics to GitHub projects.</summary></item><item><title>Migrating Bazaar to Git</title><link>https://blog.wimpys.world/posts/migrating-bazaar-to-git/</link><pubDate>Tue, 23 Oct 2012 11:50:00 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/migrating-bazaar-to-git/</guid><description>&lt;p&gt;We have been using &lt;a href="http://bazaar.canonical.com"&gt;Bazaar&lt;/a&gt; for source
control at &lt;a href="http://www.flightdataservices.com"&gt;work&lt;/a&gt; for nearly five
years. We are about to &lt;a href="http://opensource.org"&gt;Open Source&lt;/a&gt; most of our
core technologies and decided that &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt; is the
best way to encourage community participation. We have signed up for a
Silver plan at GitHub and will migrate all our Bazaar repositories to Git.&lt;/p&gt;
&lt;p&gt;I have a few personal projects in Bazaar repositories hosted on
&lt;a href="http://www.launchpad.net"&gt;Launchpad&lt;/a&gt;. I decided to migrate my projects
to GitHub in order to learn the migration process. What follows is an
overview of how I did it using a fresh virtual machine running Ubuntu 10.04
LTS Server. I used a little project of mine called &lt;code&gt;nullserv&lt;/code&gt; in the
examples below.&lt;/p&gt;
&lt;p&gt;Add the Bazaar and Git PPAs.&lt;/p&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;sudo apt-get install python-software-properties
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:bzr/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:git-core/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install &lt;code&gt;bzr&lt;/code&gt; (and its requirements), &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;git&lt;/code&gt;.&lt;/p&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;sudo apt-get install bzr bzr-fastimport curl git python-paramiko
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the SSH keys and identify yourself.&lt;/p&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;bzr whoami &lt;span class="s2"&gt;&amp;#34;Your Name &amp;lt;name@example.org&amp;gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --global user.name &lt;span class="s2"&gt;&amp;#34;Your Name&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --global user.email you@example.org
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If your Bazaar repository is hosted on Launchpad assert your
identity.&lt;/p&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;bzr launchpad-login flexiondotorg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Branch the Bazaar repository.&lt;/p&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;bzr branch lp:~flexiondotorg/+junk/nullserv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; nullserv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git init
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr fast-export --plain &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; git fast-import
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;This step is optional. It will delete and commit the deletions to the Bazaar repository.&lt;/strong&gt;&lt;/p&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="k"&gt;for&lt;/span&gt; FILE in *&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; rm -rfv &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;FILE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;This repository has been migrated to Git. https://github.com/flexiondotorg/nullserv&amp;#34;&lt;/span&gt; &amp;gt; README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr add README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr commit -m &lt;span class="s2"&gt;&amp;#34;This repository has been migrated to Git. https://github.com/flexiondotorg/nullserv&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bzr push :parent
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Remove the Bazaar repository and reset the Git repository.&lt;/p&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;rm -rf .bzr README
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git reset HEAD
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create &lt;code&gt;.gitattributes&lt;/code&gt; to normalise line endings.&lt;/p&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;cat &amp;gt;.gitattributes&lt;span class="s"&gt;&amp;lt;&amp;lt;ENDGITATTRIBS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Normalise line endings:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;* text=auto
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Prevent certain files from being exported:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;.gitattributes export-ignore
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;.gitignore export-ignore
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ENDGITATTRIBS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add .gitattributes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Migrate &lt;code&gt;.bzrignore&lt;/code&gt; to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&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;git mv .bzrignore .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;# Keep empty directories:&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;!*/.git*&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ensure empty directories are retained by git.&lt;/p&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;find -empty -type d -not -iwholename &lt;span class="s1"&gt;&amp;#39;*.git*&amp;#39;&lt;/span&gt; -exec touch &lt;span class="s1"&gt;&amp;#39;{}/.gitkeep&amp;#39;&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add **/.gitkeep
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Commit the migrated repository&lt;/p&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;git commit -a -m &lt;span class="s2"&gt;&amp;#34;Migrated from Bazaar to Git.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Thanks to Chris for pointing out &lt;code&gt;git filter-branch&lt;/code&gt; in the comments. If you
need to modify the author info in your repository history, you can do so with
this, just replace the names and email addresses accordingly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;BEWARE! This should not be performed on a repo that has been shared with others.
Use at your own risk.&lt;/strong&gt;&lt;/p&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;git filter-branch --commit-filter &lt;span class="s1"&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; if [ &amp;#34;$GIT_COMMITTER_NAME&amp;#34; = &amp;#34;Fred&amp;#34; ]; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_NAME=&amp;#34;Fred Flintstone&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_NAME=&amp;#34;Fred Flintstone&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_EMAIL=&amp;#34;fred@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_EMAIL=&amp;#34;fred@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; elif [ &amp;#34;$GIT_COMMITTER_NAME&amp;#34; = &amp;#34;Barney&amp;#34; ]; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_NAME=&amp;#34;Barney Rubble&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_NAME=&amp;#34;Barney Rubble&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_COMMITTER_EMAIL=&amp;#34;barney@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; GIT_AUTHOR_EMAIL=&amp;#34;barney@example.org&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; else
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git commit-tree &amp;#34;$@&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; fi&amp;#39;&lt;/span&gt; HEAD
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to delete any files from the commit history, you can optionally do that now.&lt;/p&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;git filter-branch -f --index-filter &lt;span class="s2"&gt;&amp;#34;git rm --cached --ignore-unmatch *.THIS *.THAT&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--prune-empty --tag-name-filter cat -- --all
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -rf .git/refs/original/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git reflog expire --expire&lt;span class="o"&gt;=&lt;/span&gt;now --all
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git gc --prune&lt;span class="o"&gt;=&lt;/span&gt;now
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Resume here, regardless of whether you deleted any files from the commit history or not.
Remove everything from the index.&lt;/p&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;git rm --cached -r .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Write both the index and working directory from git&amp;rsquo;s database.&lt;/p&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;git reset --hard
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Prepare to make a commit by staging all the files that will get normalized.
This is your chance to inspect which files were never normalized. You may
get lots of messages like: &lt;code&gt;warning: CRLF will be replaced by LF in file.&lt;/code&gt;&lt;/p&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;git add .
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &lt;span class="s2"&gt;&amp;#34;Forced line endings to eol=lf&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Aggressively pack the repository.&lt;/p&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;git gc --aggressive --prune&lt;span class="o"&gt;=&lt;/span&gt;now
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point you have a migrated git repository. You can poke about a check that
everything is present and correct.&lt;/p&gt;
&lt;p&gt;Optionally you can create a new GitHub repository using their API. Replace &lt;code&gt;USER&lt;/code&gt;
and &lt;code&gt;PASS&lt;/code&gt; with your GitHub login crednetials.&lt;/p&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;curl -u &lt;span class="s1"&gt;&amp;#39;USER:PASS&amp;#39;&lt;/span&gt; https://api.github.com/user/repos -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;nullserv&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to create repositories for an Organisation the following will
work. Replace &lt;code&gt;YourOrganisation&lt;/code&gt; with the organisation name your are a
member of.&lt;/p&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;curl -u &lt;span class="s1"&gt;&amp;#39;USER:PASS&amp;#39;&lt;/span&gt; https://api.github.com/orgs/YourOrganisation/repos -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;nullserv&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Private repositories can be created, providing you have a paid GitHub account,
by changing the &lt;code&gt;POST&lt;/code&gt; data as follows.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;nullserv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;private&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, push to the newly created GitHub repo.&lt;/p&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;git remote add origin git@github.com:flexiondotorg/nullserv.git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push -u origin master
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All done, the Bazaar repository has been crippled and the Git repository is
ready for use on GitHub.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/624941"&gt;https://gist.github.com/624941&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-ssh"&gt;http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-ssh&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git"&gt;http://stackoverflow.com/questions/750172/how-do-i-change-the-author-of-a-commit-in-git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/articles/changing-author-info"&gt;https://help.github.com/articles/changing-author-info&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.github.com/v3/repos/"&gt;http://developer.github.com/v3/repos/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/articles/dealing-with-line-endings#platform-all"&gt;https://help.github.com/articles/dealing-with-line-endings#platform-all&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>A rough guide to migrating Bazaar repositories to GitHub</summary></item><item><title>Install Sun Java 6 JRE and JDK from .deb packages</title><link>https://blog.wimpys.world/posts/install-sun-java-6-jre-and-jdk-from-deb-packages/</link><pubDate>Mon, 16 Jan 2012 13:20:05 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/install-sun-java-6-jre-and-jdk-from-deb-packages/</guid><description>&lt;p&gt;&lt;a href="https://canonical.com"&gt;Canonical&lt;/a&gt; disabled my Java PPA at the end of last week.
So I&amp;rsquo;ve developed another solution for installing Java on Ubuntu which doesn&amp;rsquo;t
infringe any copyrights, licenses, terms of use or CoC&amp;rsquo;s. However, by running
this script to download Java you acknowledge that you have read and accepted the
terms of the Oracle end user license agreement.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.oracle.com/technetwork/java/javase/terms/license/"&gt;http://www.oracle.com/technetwork/java/javase/terms/license/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My script is an automated wrapper for &lt;a href="https://github.com/rraptorr/sun-java6"&gt;Janusz Dziemidowicz Debian packaging
scripts for Java 6&lt;/a&gt;. My new script
simply downloads the Java binary installers from Oracle, builds the .deb
packages locally on your computer and creates a local &amp;lsquo;apt&amp;rsquo; repository for
them. Once my script has been executed you can then &amp;lsquo;apt-get&amp;rsquo; install/upgrade
Java 6 from your local repository. Packages are compatible with &amp;ldquo;official&amp;rdquo;
Ubuntu ones and pre-existing Java 6 packages will upgrade cleanly. You can
find the script and full usage instructions on github.&lt;/p&gt;
&lt;div class="text-center"&gt;
&lt;iframe src="http://ghbtns.com/github-btn.html?user=flexiondotorg&amp;repo=oab-java6&amp;type=watch&amp;count=true&amp;size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="260px" height="30px"&gt;&lt;/iframe&gt;
&lt;iframe src="http://ghbtns.com/github-btn.html?user=flexiondotorg&amp;repo=oab-java6&amp;type=fork&amp;count=true&amp;size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="260px" height="30px"&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;p&gt;Please read the &lt;a href="https://github.com/flexiondotorg/oab-java6/blob/master/README.rst"&gt;README&lt;/a&gt;
file for a more detailed explanation of how the script works and how to use it.
If anyone has any problems, then please submit a ticket on my
&lt;a href="https://github.com/flexiondotorg/oab-java6/issues"&gt;Issue Tracker&lt;/a&gt;.&lt;/p&gt;</description><summary>An alternative approach to install Sun Java 6 on Ubuntu</summary></item><item><title>Sun Java 1.6.0.30 packages for Ubuntu</title><link>https://blog.wimpys.world/posts/sun-java-1.6.0.30-packages-for-ubuntu/</link><pubDate>Tue, 10 Jan 2012 10:53:50 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/sun-java-1.6.0.30-packages-for-ubuntu/</guid><description>&lt;h2 id="update-friday-13th-january-2012"&gt;Update Friday 13th January 2012&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;My Java PPA has been disabled by Canonical, possibly because they violate the Ubuntu CoC and PPA terms of use, as Jef Spaleta noted in the comments below, although I&amp;rsquo;ve had no communication from Canonical at this time. I&amp;rsquo;m preparing an alternative solution, for those of you who need Sun Java 6, that doesn&amp;rsquo;t violate and copyrights, CoCs or terms of use. A new blog post will be made when that alternate solution is available.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="update-monday-16th-january-2012"&gt;Update Monday 16th January 2012&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;I&amp;rsquo;ve developed another solution for installing Java 6u30 on Ubuntu which
doesn&amp;rsquo;t infringe any copyrights, licenses, terms of use or CoC&amp;rsquo;s.&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="2012-01-install-sun-java-6-jre-jdk-from-deb-packages.html"&gt;Install Sun Java 6 JRE and JDK from .deb packages&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;del&gt;Sun Java 6 packages are being removed from Ubuntu in the near future for the
following reasons:&lt;/del&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;As of August 24th 2011, Canonical no longer have permission to redistribute
new Java packages as Oracle has retired the &amp;ldquo;Operating System Distributor
License for Java&amp;rdquo;.&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;&lt;del&gt;Oracle has published an advisory about security issues in the version of
Java currently in the partner archive. Some of these issues are currently
being exploited in the wild.&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;&lt;del&gt;Due to the severity of the security risk, &lt;strong&gt;Canonical released a security
update for the Sun JDK browser plugin which disables the plugin on all machines&lt;/strong&gt;.&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;&lt;del&gt;In the near future, &lt;strong&gt;Canonical will remove all Sun JDK packages from the
Partner archive&lt;/strong&gt;. This will be accomplished by pushing empty packages to
the archive, so that the Sun JDK will be removed from all users machines
when they do a software update. &lt;strong&gt;Users of these packages who have not
migrated to an alternative solution will experience failures after the
package updates have removed Oracle Java from the system&lt;/strong&gt;.&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;del&gt;See the full Canonical notice below.&lt;/del&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;&lt;a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2011-December/001528.html"&gt;https://lists.ubuntu.com/archives/ubuntu-security-announce/2011-December/001528.html&lt;/a&gt;&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;del&gt;My personal motivations for creating this PPA are as follows:&lt;/del&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;I require Sun Java 6 for two enterprise applications we use at work. OpenJDK is not fully compatible.&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;I require Sun Java 6 for two desktop applications at home (so does my father-in-law). OpenJDK not compatible in one instance and not fully compatible in the other.&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;I require Sun Java 6 browser plugin for a web applications I use at home. OpenJDK is not compatible.&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;A friend of mine requires Sun Java 6 for building AOSP from source. OpenJDK is not compatible.&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Some friends of mine play Minecraft, apparently this will help ;-)&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Janusz Dziemidowicz made it easy for me - &lt;a href="https://github.com/rraptorr/sun-java6"&gt;https://github.com/rraptorr/sun-java6&lt;/a&gt;&lt;/del&gt;
&lt;del&gt;The PPA currently publishes Sun Java 6 1.6.0.30 for:&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Lucid i386/amd64&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Maverick i386/amd64&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Natty i386/amd64&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Oneiric i386/amd64&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;del&gt;Precise i386. However, amd64 is failing to build on Precise. I will try and fix this in due course.&lt;/del&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;del&gt;To Sun Java 6 , previously installed via packages, do the following.&lt;/del&gt;&lt;/p&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;sudo apt-add-repository ppa:flexiondotorg/java
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get dist-upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;del&gt;To install Sun Java 6 JRE do the following:&lt;/del&gt;&lt;/p&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;sudo apt-add-repository ppa:flexiondotorg/java
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install sun-java6-jre
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;del&gt;To install Sun Java 6 browser plugin do the following:&lt;/del&gt;&lt;/p&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;sudo apt-add-repository ppa:flexiondotorg/java
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install sun-java6-plugin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;del&gt;To install Sun Java 6 JDK do the following:&lt;/del&gt;&lt;/p&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;sudo apt-add-repository ppa:flexiondotorg/java
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install sun-java6-jdk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;del&gt;You can take a look a round my PPA from the URL below:&lt;/del&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;&lt;a href="https://launchpad.net/~flexiondotorg/+archive/java"&gt;https://launchpad.net/~flexiondotorg/+archive/java&lt;/a&gt;&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Get Sun Java 1.6.0 packages from a PPA</summary></item><item><title>Shotwell 0.11 PPA available for Ubuntu Lucid and Maverick</title><link>https://blog.wimpys.world/posts/shotwell-0.11-ppa-available-for-ubuntu-lucid-and-maverick/</link><pubDate>Tue, 30 Aug 2011 11:05:50 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/shotwell-0.11-ppa-available-for-ubuntu-lucid-and-maverick/</guid><description>&lt;p&gt;Like many others I wanted &lt;a href="http://yorba.org/shotwell/"&gt;Shotwell&lt;/a&gt; 0.11
for Lucid and Maverick so I&amp;rsquo;ve created a PPA for it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/~flexiondotorg/+archive/shotwell"&gt;https://launchpad.net/~flexiondotorg/+archive/shotwell&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My PPA contains Shotwell 0.11 built for Ubuntu Lucid 10.04 LTS and Ubuntu
Maverick 10.10. I created this PPA because I run Lucid at home and wanted the
new version of Shotwell. Sadly, Yorba aren&amp;rsquo;t going to provide new Shotwell
packages for Lucid due to the reasons discussed in the following ticket: -&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://trac.yorba.org/ticket/3015"&gt;http://trac.yorba.org/ticket/3015&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As mentioned in the ticket above, there are newer versions of Shotwell available
for Lucid in other PPAs. However, those PPAs contain hundreds of packages. If
you&amp;rsquo;re not that brave, like me, then hopefully my PPA provides what you
need. I have built Shotwell with minimal changes from the original Yorba
source packages and not polluted my PPA with any unnecessary packages. Since
Shotwell 0.11 you &lt;strong&gt;must&lt;/strong&gt; enable the GStreamer PPA, see the ticket
below for the reasons for this requirement:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://redmine.yorba.org/issues/3716"&gt;http://redmine.yorba.org/issues/3716&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To install Shotwell on Lucid and Maverick do the following:&lt;/p&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;sudo apt-add-repository ppa:flexiondotorg/shotwell
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:gstreamer-developers/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get dist-upgrade
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install shotwell
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enjoy!&lt;/p&gt;</description><summary>Showell 0.11 is available in a PPA for Ubuntu 10.04 &amp;amp; 10.10</summary></item><item><title>Shotwell 0.8.1 PPA available for Ubuntu Lucid</title><link>https://blog.wimpys.world/posts/shotwell-0.8.1-ppa-available-for-ubuntu-lucid/</link><pubDate>Thu, 17 Mar 2011 17:04:42 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/shotwell-0.8.1-ppa-available-for-ubuntu-lucid/</guid><description>&lt;p&gt;Like many others I wanted &lt;a href="http://yorba.org/shotwell/"&gt;Shotwell&lt;/a&gt; for Lucid
so I&amp;rsquo;ve created a PPA for it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lt;https://launchpad.net/~flexiondotorg/+archive/shotwell.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My PPA contains Shotwell 0.8.1 built for Ubuntu Lucid 10.04 LTS. I created the
PPA because I run Lucid at home and wanted the new version of Shotwell. Sadly,
Yorba aren&amp;rsquo;t going to provide a Lucid build of Shotwell 0.8.1 due to the
reasons discussed in the following ticket:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://trac.yorba.org/ticket/3015"&gt;http://trac.yorba.org/ticket/3015&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As mentioned in the ticket above, there are versions of Shotwell 0.8.1
available for Lucid in other PPAs. However, those PPAs contain hundreds of
packages. If you&amp;rsquo;re not that brave, like me, then hopefully my PPA provides
what you need. I have built Shotwell 0.8.1 with minimal changes from the
original Yorba source packages and not polluted my PPA with any unnecessary
packages &lt;strong&gt;NOTE!&lt;/strong&gt; My PPA has dependencies that are satisfied by the Yorba
PPA, so you must also enable the Yorba PPA too.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/~yorba/+archive/ppa"&gt;https://launchpad.net/~yorba/+archive/ppa&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To install Shotwell 0.8.1 on Lucid do the following:&lt;/p&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;sudo apt-add-repository ppa:yorba/ppa
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-add-repository ppa:flexiondotorg/shotwell
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install shotwell
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description><summary>Get the latest Shotwell 0.8.1 via a PP for Ubuntu 10.04</summary></item><item><title>Bash script to retrieve Ubuntu codenames and versions</title><link>https://blog.wimpys.world/posts/bash-script-to-retrieve-ubuntu-codenames-and-versions/</link><pubDate>Wed, 16 Mar 2011 13:44:54 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/bash-script-to-retrieve-ubuntu-codenames-and-versions/</guid><description>&lt;p&gt;I&amp;rsquo;m working a script to automatically backport &lt;a href="http://www.debian.org"&gt;Debian&lt;/a&gt;
packages to Ubuntu. I needed a way to get a list of currently supported/active
Ubuntu releases by codename or version. Here is how I do it.&lt;/p&gt;
&lt;h2 id="get-a-list-of-ubuntu-codenames"&gt;Get a list of Ubuntu codenames&lt;/h2&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;wget -q http://cdimage.ubuntu.com/releases/ -O - &lt;span class="p"&gt;|&lt;/span&gt; sed -e :a -e &lt;span class="s1"&gt;&amp;#39;s/&amp;lt;[^&amp;gt;]*&amp;gt;//g;/&amp;lt;/N;//ba&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s1"&gt;&amp;#39;^[[:space:]][a-z]&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;&amp;#39;s/\///g&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="get-a-list-of-ubuntu-versions"&gt;Get a list of Ubuntu versions&lt;/h2&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;wget -q http://cdimage.ubuntu.com/releases/ -O - &lt;span class="p"&gt;|&lt;/span&gt; sed -e :a -e &lt;span class="s1"&gt;&amp;#39;s/&amp;lt;[^&amp;gt;]*&amp;gt;//g;/&amp;lt;/N;//ba&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s1"&gt;&amp;#39;^[[:space:]][1-9]&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;&amp;#39;s/\///g&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description><summary>Get a list of Ubuntu codename and version with wget</summary></item><item><title>Goodbye F-Spot. Hello Shotwell</title><link>https://blog.wimpys.world/posts/goodbye-f-spot-hello-shotwell/</link><pubDate>Sat, 20 Mar 2010 15:39:17 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/goodbye-f-spot-hello-shotwell/</guid><description>&lt;p&gt;I&amp;rsquo;ve finally found a photo organiser for Linux I can live with,
&lt;a href="http://yorba.org/shotwell/"&gt;Shotwell&lt;/a&gt;. Shotwell is a photo organiser
for &lt;a href="http://www.gnome.org"&gt;GNOME&lt;/a&gt; that I&amp;rsquo;ve been testing for a few
months now but the recent 0.5 release which added tagging and printing,
it means Shotwell is finally ready replace &lt;a href="http://f-spot.org"&gt;F-Spot&lt;/a&gt; on
my workstation.&lt;/p&gt;
&lt;p&gt;Shotwell is intuitive, well documented, extremely easy to use and reliable.
It&amp;rsquo;s easy to dismiss Shotwell as an over simplified photo manager. But once
you start using it, you&amp;rsquo;ll quickly appreciate its clean interface and
easy-to-use tools. Don&amp;rsquo;t just take my word for it either, Shotwell is now the
default photo manager in &lt;a href="http://fedoraproject.org"&gt;Fedora&lt;/a&gt; 13 alpha. Here is
a quick run down of the features.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import photos from folders or from any digital camera supported by gPhoto.&lt;/li&gt;
&lt;li&gt;Shotwell automatically groups photos taken at the same time. You can also
use tags to organize your photo collection.&lt;/li&gt;
&lt;li&gt;You can rotate, crop, reduce red-eye, and adjust the exposure, saturation,
tint, and temperature of each photo.&lt;/li&gt;
&lt;li&gt;Publish photos to Facebook, Flickr and Picasa Web Albums.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shotwell provides a non-destructive way to tweak your photos. Instead of
modifying the original photos, Shotwell stores all edits in a database and
applies them on-the-fly as necessary. This means that you can easily undo all
edits. Shotwell comes equipped with all the usual photo enhancing tools and
slideshow. You can download a source tarball from the Shotwell home page at
&lt;a href="http://www.yorba.org/shotwell/"&gt;http://www.yorba.org/shotwell/&lt;/a&gt; or grab a binary for Ubuntu Karmic or Lucid
via Yorba&amp;rsquo;s Launchpad PPA.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://launchpad.net/~yorba/+archive/ppa"&gt;https://launchpad.net/~yorba/+archive/ppa&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>F-Spot you serve me well, but here comes Shotwell</summary></item><item><title>Linux Hex Editors</title><link>https://blog.wimpys.world/posts/linux-hex-editors/</link><pubDate>Thu, 03 Dec 2009 11:59:30 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/linux-hex-editors/</guid><description>&lt;p&gt;We use hex editors daily at work, we are regularly cutting up data from flight
data recorders for analysis or recovery. So when I find a new hex editor for
Linux I usually give it a try. I happened across a blog listing five GUI hex
editors for Ubuntu today. Find out more below.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://unixlab.blogspot.com/2009/08/five-gui-hex-editors-for-ubuntu.html"&gt;Five gui hex editors for ubuntu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Five GUI hex editors for Linux to take a look at</summary></item><item><title>M2VRequantiser for 32-bit and 64-bit Linux</title><link>https://blog.wimpys.world/posts/m2vrequantiser-for-32-bit-and-64-bit-linux/</link><pubDate>Thu, 23 Apr 2009 16:47:20 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/m2vrequantiser-for-32-bit-and-64-bit-linux/</guid><description>&lt;p&gt;I recently discovered that &lt;code&gt;tcrequant&lt;/code&gt; (part of the
&lt;a href="http://http://www.transcoding.org/"&gt;transcode&lt;/a&gt; suite of tools) has been
deprecated. Worst still I found that when I ran &lt;code&gt;tcrequant&lt;/code&gt; on my 64-bit Linux
workstation is was corrupting the video. See the links below for details.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://tcforge.berlios.de/archives/2009/01/18/transcode_1_1_0_final_release/index.html"&gt;transcode 1.1.0 Final Release&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mail-archive.com/transcode-users@exit1.org/msg01773.html"&gt;[transcode-users] tcrequant status&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore I decided to get the &lt;a href="http://www.metakine.com/products/dvdremaster/developers.html"&gt;M2VRequantiser&lt;/a&gt;
code from &lt;a href="http://www.metakine.com/"&gt;Metakine&lt;/a&gt; working on both 32-bit and 64-bit
Linux as a replacement for &lt;code&gt;tcrequant&lt;/code&gt;. M2VRequantiser accepts the raw MPEG2 video
data (not VOB) from the standard input and writes the recompressed frames to
the standard output. M2VRequantiser takes two arguments. The first one is a
floating point value specifying the ratio of compression. The second is the
size of the M2V, since the data is streamed to M2VRequantiser it cannot know
the M2V size. The following command would recompress &amp;lsquo;original.m2v&amp;rsquo;, whose
size is 1024000 bytes, by a factor of 1.25.&lt;/p&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;M2VRequantiser 1.25 &lt;span class="m"&gt;1024000&lt;/span&gt; &amp;lt; original.m2v &amp;gt; requantised.m2v
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;ve only tested on 32-bit and 64-bit Linux, specifically Ubuntu 8.10. It works
for me but I&amp;rsquo;d be interested to get your feedback.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.launchpad.net/~flexiondotorg/m2vrequantiser/trunk"&gt;M2VRequantiser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Finding a MPEG-2 video requantising solution for Linux</summary></item><item><title>Converting Matroska to M2TS for PS3 and Mediatomb</title><link>https://blog.wimpys.world/posts/converting-matroska-to-m2ts-for-ps3-and-mediatomb/</link><pubDate>Wed, 15 Apr 2009 16:19:24 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/converting-matroska-to-m2ts-for-ps3-and-mediatomb/</guid><description>&lt;p&gt;It has been a while since I last posted, mainly due to not having Internet
access at home for a month. Anyway, I&amp;rsquo;m online again and I have been tinkering
with various projects the most recent of which is Matroska conversion (again).&lt;/p&gt;
&lt;h2 id="matroska-to-mp4"&gt;Matroska to MP4&lt;/h2&gt;
&lt;p&gt;For sometime I have been converting Martoska files to MPEG-4 with AAC 5.1 audio
so I can stream them via Mediatomb to my PlayStation 3. The conversion process
works well although there is some overhead in transcoding the audio and the
AAC 5.1 audio is not as good quality as the original AC3 or DTS.&lt;/p&gt;
&lt;p&gt;If you are interested I&amp;rsquo;ve put my code in GitHub, the script automates the
whole process.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/flexiondotorg/MKV-to-MP4"&gt;MPV-to-MP4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="matroska-to-m2ts"&gt;Matroska to M2TS&lt;/h2&gt;
&lt;p&gt;A little while back I read it was possible to convert those same Matroska file
to M2TS files which, so long as the audio is AC3, so takes much less time to
convert. As the PlayStation 3 can&amp;rsquo;t play DTS audio streams inside a M2TS container
there is still a requirement to transcode DTS to AC3. That said the conversion to
M2TS requires less file I/O than converting to MPEG-4 and is therefore it is
generally a quicker conversion method, typically just 2 or 3 minutes on my
workstation at home.&lt;/p&gt;
&lt;p&gt;Plus the audio quality of the AC3 or transcoded DTS is better than that of
transcoded AAC 5.1. I&amp;rsquo;ve created my own script to fully automate the conversion
process. The script has been tested on Ubuntu 8.10 64-bit but there is an
outside chance it will work on Mac OS X if you can get the required tools
installed. Again, you can find my script on GitHub.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/flexiondotorg/MKV-to-M2TS"&gt;MPV-to-M2TS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Fast conversion of Matroska video to MPEG2-TS</summary></item><item><title>Distributing closed source Python applications</title><link>https://blog.wimpys.world/posts/distributing-closed-source-python-applications/</link><pubDate>Thu, 29 Jan 2009 13:04:03 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/distributing-closed-source-python-applications/</guid><description>&lt;p&gt;Last November we switched to &lt;a href="http://www.python.org/"&gt;Python&lt;/a&gt; as the principal
language for all new software development projects at work, ditching Microsoft
Visual C++ and PHP in the process. Last Friday we released our first Python
application to our customers for both Windows and Linux users.&lt;/p&gt;
&lt;p&gt;Although we make good use of Open Source software development tools and
methodologies the application we have just written is propritary and the
source can not be released publicly. We needed to compile, or &lt;em&gt;freeze&lt;/em&gt;, the
Python script in order to create a standalone executable. Tools that do this
have been around for sometime, however our application makes use of Win32
Extensions for Python and WMI on Windows, DBUS/HAL on Linux, wxPython
on both, and a number of other modules. This is quite a big ask for the Python
script compilers and initially the only tool which could build this lot
successfully was &lt;a href="http://www.py2exe.org/"&gt;py2exe&lt;/a&gt;. Sadly that only solves part
of the problem since it is a Windows only tool.&lt;/p&gt;
&lt;p&gt;Then we found &lt;a href="http://pypi.python.org/pypi/bbfreeze/"&gt;bbfreeze&lt;/a&gt;, which
supports both Windows and Linux with Mac OS X support being actively
developed. &lt;code&gt;bbfreeze&lt;/code&gt; has a simple build API and we were soon using it to build
stand alone executables for both Windows and Linux. Everything is peachy, all
we needed was as means to install our application.&lt;/p&gt;
&lt;p&gt;We only need a tarball for Linux since we manage all kiosk installations, but
our customer can install the Windows version. Enter &lt;a href="http://www.jrsoftware.org/isinfo.php"&gt;InnoSetup&lt;/a&gt;.
InnoSetup is a free installer for Windows programs and installer can even be
created from the command line, perfect for integration with our Jenkins build
servers.&lt;/p&gt;</description><summary>Freezing proprietary Python applications for distribution to clients</summary></item><item><title>Hacking WordTwit into WordDent</title><link>https://blog.wimpys.world/posts/hacking-wordtwit-into-worddent/</link><pubDate>Fri, 23 Jan 2009 18:24:20 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/hacking-wordtwit-into-worddent/</guid><description>&lt;p&gt;I have quickly forked &lt;a href="https://wordpress.org/plugins/wordtwit/"&gt;WordTwit&lt;/a&gt; into
WordDent. WordDent is a Wordpress plugin that utilizes the Twitter API to
automatically push a published post to your &lt;a href="http://identi.ca"&gt;Identi.ca&lt;/a&gt;
account as a dent. It allows all your Identi.ca contacts to keep up to date
with your blog postings. I&amp;rsquo;m still just testing that WordDent works
correctly. I&amp;rsquo;ll find out if the nice people over at
&lt;a href="http://www.bravenewcode.com"&gt;Brave New Code&lt;/a&gt; will agree to me releasing
WordDent since I can&amp;rsquo;t fine any license details for WordTwit.&lt;/p&gt;</description><summary>Automatically post Wordpress blog notification to Identi.ca</summary></item><item><title>R3-born 0.1.1 is released!</title><link>https://blog.wimpys.world/posts/r3-born-0.1.1-is-released/</link><pubDate>Fri, 09 Mar 2007 21:59:45 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/r3-born-0.1.1-is-released/</guid><description>&lt;p&gt;&lt;a href="http://www.sourceforge.net/projects/r3-born/"&gt;R3-born&lt;/a&gt; 0.1.1 is released :-)&lt;/p&gt;
&lt;h2 id="r3-born-core-change-log"&gt;R3-born Core Change Log&lt;/h2&gt;
&lt;p&gt;Here are the main changes for this release. &lt;em&gt;v0.1.1 : 9th March 2007&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added Akismet anti-spam API&lt;/li&gt;
&lt;li&gt;Added a version checker for the Core and also for Blocks and Modules.&lt;/li&gt;
&lt;li&gt;Added search bot (Google, MSN, Yahoo!, etc) detection.&lt;/li&gt;
&lt;li&gt;Added logging (in Combined Log Format) to the R3-born Intrusion Prevention System.&lt;/li&gt;
&lt;li&gt;Enhanced the Module API so it now supports safe updating and custom CSS for blocks and modules.&lt;/li&gt;
&lt;li&gt;Enhanced the Layout Manager&lt;/li&gt;
&lt;li&gt;Enhanced the Registration and Profile pages by separating them.&lt;/li&gt;
&lt;li&gt;Enhanced the Template engine by back porting some features from phpBB 3.0.x&lt;/li&gt;
&lt;li&gt;Optimised and fixed the Search API&lt;/li&gt;
&lt;li&gt;Optimised and simplified Coloured Groups.&lt;/li&gt;
&lt;li&gt;Improved the Groups Management ACP&lt;/li&gt;
&lt;li&gt;Improved the Styles Management ACP&lt;/li&gt;
&lt;li&gt;Fixed various bugs in the core.&lt;/li&gt;
&lt;li&gt;Significant feature enhancements, bug fixes and optimisations added to the Menu and Who Is Online blocks.&lt;/li&gt;
&lt;li&gt;Significant feature enhancements, bug fixes and optimisations added to the Comments, Downloads, Forum, Pages,&lt;/li&gt;
&lt;li&gt;Private Messages, Weblogs and View Online modules.&lt;/li&gt;
&lt;li&gt;New modules : bot_list, cookie, error, google, referrers and sql_backup&lt;/li&gt;
&lt;li&gt;New blocks : recent_blogs, recent_comments, recent_pages, recent_topics, search, socmarks and visit_counter.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;R3-born 0.1.1 has fulfilled its first major objective, which is to be functional
enough to run a website.&lt;/p&gt;</description><summary>R3-born is good enough to run a website</summary></item><item><title>R3-born 0.1.0 is released!</title><link>https://blog.wimpys.world/posts/r3-born-0.1.0-is-released/</link><pubDate>Tue, 30 Jan 2007 11:52:55 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/r3-born-0.1.0-is-released/</guid><description>&lt;p&gt;Finally, R3-born 0.1.0 is released. &lt;a href="http://www.sourceforge.net/projects/r3-born/"&gt;R3-born&lt;/a&gt;
is a content management system for modest websites which I hope will be ideal for
individuals running their own sites or small community websites.&lt;/p&gt;
&lt;p&gt;Due to my accident I have not been able to address all of the bugs which have
been reported recently and the downloads are only available as bzip2 tarballs
right now. Please report any bugs you might encounter as 0.1.0 has really only
been tested on Debian Sarge (stable) running PHP4 and MSQL 4. Feedback from
other configurations will be useful and all reported bugs will be investigated.&lt;/p&gt;</description><summary>After 10 months work R3-born 0.1.0 is ready</summary></item><item><title>Announcing R3-born</title><link>https://blog.wimpys.world/posts/announcing-r3-born/</link><pubDate>Fri, 08 Sep 2006 17:48:47 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/announcing-r3-born/</guid><description>&lt;p&gt;I suppose it is a bit silly to announce this just before I go on holiday but
what the heck. &lt;a href="http://www.sourceforge.net/projects/r3-born/"&gt;R3-born&lt;/a&gt; is
intended to be a simple and modular content management system for modest websites.
My hope is that it will be ideal for individuals running their own sites or for
small community websites. R3-born is coded in PHP (4.2.0 or better required)
and requires an SQL database, currently MySQL 3.x, 4.x and 5.x, Postgres 7.x
or better and MS-SQL 7.x or better are supported.&lt;/p&gt;
&lt;h2 id="current-status"&gt;Current Status&lt;/h2&gt;
&lt;p&gt;Right now, R3-born is considered pre-alpha and not suitable for a production
website but is ready for testers to start feeding back on bugs, feature requests
and in the near future code changes. Development has been fairly rapid so far. I
started the project in April 2006 and I hope to release a beta version of
R3-born later in 2006.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.sourceforge.net/projects/r3-born/"&gt;http://www.sourceforge.net/projects/r3-born/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Minerva is r3-born</summary></item><item><title>Comments off, Overdue update and R3-born</title><link>https://blog.wimpys.world/posts/comments-off-overdue-update-and-r3-born/</link><pubDate>Tue, 04 Jul 2006 13:14:55 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/comments-off-overdue-update-and-r3-born/</guid><description>&lt;p&gt;First of all, I have disabled comments on my blog. &lt;a href="http://jaws-project.com/"&gt;Jaws&lt;/a&gt;
has spam protection and captachs but both implementations suck. This site doesn&amp;rsquo;t
generate much feedback so disabling comments altogether is not really a problem.
I haven&amp;rsquo;t updated the site recently and here is why. The 0.6.x release of Jaws
is buggy and I still haven&amp;rsquo;t found anything else which fully meets my needs for
managing my own web content.&lt;/p&gt;
&lt;p&gt;Therefore for the last couple of months I have been working on an open source
CMS of my own called R3-born. More details to follow about that soon, but you
can find the project over at Sourceforge, don&amp;rsquo;t expect anything to work
(although it does for the most part) it is pre-alpha and unreleased. SVN is the
only way to snag the source.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.sourceforge.net/projects/r3-born/"&gt;R3-born&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><summary>Jaws spam counter measures suck</summary></item><item><title>Project Minerva is coming home</title><link>https://blog.wimpys.world/posts/project-minerva-is-coming-home/</link><pubDate>Wed, 26 Apr 2006 17:42:11 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/project-minerva-is-coming-home/</guid><description>&lt;p&gt;Despite a generous offer from a Minerva enthusiast a year or so ago to freely
host the Project Minerva sites, all the Project Minerva hosting is coming back
to where it started and rightly belongs. Yes, right here with me. It just
goes to show you really don&amp;rsquo;t get anything for free. The developers have had
several outages with the server which was provided by SpiderTech Hosting, so
we are bringing it back here where we can look after our interests directly.&lt;/p&gt;
&lt;p&gt;Minerva users might be wondering if the fact I am fully hosting Project
Minerva again means I am going to be developing for the project again. Well,
we will just have to see but I did inform Chris of a little project I kicked
off last week which may (or may not) lead to something.&lt;/p&gt;</description><summary>It&amp;rsquo;s coming home. Minerva is coming home.</summary></item><item><title>Portable app</title><link>https://blog.wimpys.world/posts/portable-app/</link><pubDate>Thu, 09 Mar 2006 05:40:07 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/portable-app/</guid><description>&lt;p&gt;I started a new job last week, I am contracting for the first time. I needed
some applications installed on my desktop at work, but to do so would not be
permitted as part of my clients standard build policies.&lt;/p&gt;
&lt;p&gt;So I started making a USB disk with the tools I needed and in doing do I found
the &lt;a href="http://portableapps.com/"&gt;Portableapp&lt;/a&gt; and &lt;a href="http://www.portablefreeware.com/"&gt;The Portable Freeware Collection&lt;/a&gt;
websites which ease the process no end.&lt;/p&gt;
&lt;p&gt;A portable app is a computer program that you can carry around with you on a
portable device and use on any Windows computer. When your USB thumb drive,
portable hard drive, iPod or other portable device is plugged in, you have
access to your software and personal data just as you would on your own PC. And
when you unplug, none of your personal data is left behind.&lt;/p&gt;</description><summary>Working around corporate Windows policies with Portable Apps</summary></item><item><title>Leaving Minerva</title><link>https://blog.wimpys.world/posts/leaving-minerva/</link><pubDate>Thu, 01 Sep 2005 09:47:16 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/leaving-minerva/</guid><description>&lt;p&gt;Yesterday was a sad day. I finally notified the core &lt;a href="http://sourceforge.net/projects/minerva/"&gt;Minerva&lt;/a&gt;
developers that I am leaving the project. Given that I started the project a few
years back it was not a decision I made lightly.&lt;/p&gt;
&lt;p&gt;I have a couple of reasons for leaving the project, the main one being that I
just do not have the time available to effectively lead or contribute to the
project. All open source projects require good leadership and I haven&amp;rsquo;t been able
to provide that for most of 2005. It is with the best interests of Minerva in
mind that I decided to leave.&lt;/p&gt;
&lt;p&gt;However, Minerva is in very good hands and is under active development,
with Dave and Chris leading the effort. I wish all the Minerva developers and
users every success with the upcoming release of R4, it is a marvelous
achievement and I am sure will prove to be very successful. I will be
keeping an eye on R4 development, and if time permits, I may contribute some
blocks and modules in the future. Until then, good luck and make me proud!&lt;/p&gt;</description><summary>Standing down from the Minerva project</summary></item><item><title>Introducing Stanley, a new theme for Jaws</title><link>https://blog.wimpys.world/posts/introducing-stanley-a-new-theme-for-jaws/</link><pubDate>Fri, 12 Aug 2005 09:29:53 +0000</pubDate><author>martin@wimpress.com (Martin Wimpress)</author><guid>https://wimpysworld.com/posts/introducing-stanley-a-new-theme-for-jaws/</guid><description>&lt;p&gt;I&amp;rsquo;ve finished hacking together a new theme for &lt;a href="http://jaws-project.com/"&gt;Jaws&lt;/a&gt;
0.5.x, which I have named Stanley, and is now the default theme on this site.
I&amp;rsquo;ve still got to fix a couple of bugs and make sure that it is compatible with
browsers other than Firefox. I wanted a theme which was crisp and clean, but
also fully compatible with Jaws, so I decided to blend some of my favourite
themes together. Stanley is inspired by the Kubrick theme which is popular among
bloggers and although the Kubrick graphics have been borrowed the style sheet
and layout are derived from the &lt;code&gt;jaws&lt;/code&gt;, &lt;code&gt;orange-grey&lt;/code&gt; and &lt;code&gt;simple-green&lt;/code&gt;
themes which are bundled with Jaws. As a result Stanley is properly Jaws
compatible, in that left and right layouts work, all the CSS elements are
supported and CSS tweaks are used throughout to improve the visual appeal.&lt;/p&gt;</description><summary>A new theme for Jaws called Stanley</summary></item></channel></rss>