<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Daniel Marczin</title>
    <description>The latest articles on DEV Community by Daniel Marczin (@dim5).</description>
    <link>https://dev.to/dim5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1467250%2Fd1046398-4698-4708-b004-e7eabccf5941.jpeg</url>
      <title>DEV Community: Daniel Marczin</title>
      <link>https://dev.to/dim5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dim5"/>
    <language>en</language>
    <item>
      <title>Improve your PowerShell experience</title>
      <dc:creator>Daniel Marczin</dc:creator>
      <pubDate>Tue, 06 Aug 2024 16:33:08 +0000</pubDate>
      <link>https://dev.to/dim5/improve-your-powershell-experience-4mi6</link>
      <guid>https://dev.to/dim5/improve-your-powershell-experience-4mi6</guid>
      <description>&lt;h2&gt;
  
  
  Completions
&lt;/h2&gt;

&lt;p&gt;Command completion is somewhat lackluster by default in PowerShell.&lt;br&gt;
Most of the built-in functions have tab-completion support, but for those of us&lt;br&gt;
socialized on &lt;del&gt;better&lt;/del&gt; different shells, it might be a bit unusual at first.&lt;br&gt;
Out of the box, &lt;code&gt;TAB&lt;/code&gt; invokes the tab completion for files and cmdlets with subsequent presses cycling through the available suggestions.&lt;br&gt;
Pressing &lt;code&gt;Ctrl+Space&lt;/code&gt; provides a selection, similar to what ZSH offers for &lt;code&gt;TAB&lt;/code&gt; presses.&lt;/p&gt;

&lt;p&gt;You can remap these, if you don't want to bother re-learning them.&lt;br&gt;
First, let's open your profile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code &lt;span class="nv"&gt;$PROFILE&lt;/span&gt; &lt;span class="c"&gt;# just use your favourite editor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add the following line(s), setting the keys to whatever you're accustomed to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Set-PSReadlineKeyHandler&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Key&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Tab&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;MenuComplete&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-PSReadlineKeyHandler&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Key&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Shift&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;Tab&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;TabCompleteNext&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;To list all the shortcuts with descriptions, just use the command&lt;br&gt;
  &lt;code&gt;Get-PSReadLineKeyHandler&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Go the extra mile
&lt;/h3&gt;

&lt;p&gt;You can also install the latest version of &lt;code&gt;PSReadLine&lt;/code&gt;, which is responsible for your completions, by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Install-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSReadLine&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The latest versions utilize the command history and various plugins for better completions.&lt;br&gt;
One of these plugins is &lt;code&gt;CompletionPredictor&lt;/code&gt;, which can be installed just like we did with &lt;code&gt;PSReadLine&lt;/code&gt;,&lt;br&gt;
and provides IntelliSense-like suggestion. You can toggle between the default and IntelliSense recommendations by pressing &lt;code&gt;F2&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Install-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;CompletionPredictor&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;In PWSH you can press &lt;code&gt;F1&lt;/code&gt; after entering a command to see its man-page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Just use Bash? 👀
&lt;/h3&gt;

&lt;p&gt;While I personally didn't have much luck with this tool,&lt;br&gt;
if you really need those completions for &lt;em&gt;that one program&lt;/em&gt; that you use all the time (provided it has completions defined for bash),&lt;br&gt;
you might opt to try your luck with &lt;a href="https://github.com/tillig/ps-bash-completions/" rel="noopener noreferrer"&gt;PS bash completions&lt;/a&gt;.&lt;br&gt;
This module acts as a bridge between bash and PowerShell, providing you with completions (with some limitations).&lt;/p&gt;
&lt;h2&gt;
  
  
  Make things pretty
&lt;/h2&gt;

&lt;p&gt;Install Oh My Posh &lt;em&gt;(á la Oh My ZSH)&lt;/em&gt;, available on Windows, Linux and macOS. Just follow the instructions &lt;a href="https://ohmyposh.dev/docs/installation/windows" rel="noopener noreferrer"&gt;in their docs&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Windows&lt;/span&gt;
winget &lt;span class="nb"&gt;install &lt;/span&gt;JanDeDobbeleer.OhMyPosh &lt;span class="nt"&gt;-s&lt;/span&gt; winget

&lt;span class="c"&gt;# macOS &amp;amp; Linux&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;jandedobbeleer/oh-my-posh/oh-my-posh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then install a NerdFont, to display some fancy glyphs, by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;oh-my-posh font &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="c"&gt;# or to run it without elevation use: --user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;..and don't forget to configure your terminal to actually use the font(s) that you've just installed.&lt;/p&gt;

&lt;p&gt;Next, configure a theme that you like. You can just run &lt;code&gt;Get-PoshThemes&lt;/code&gt; which displays all the available themes, and even tells you how set one permanently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use git shorthands
&lt;/h2&gt;

&lt;p&gt;You can use the same git aliases that you do in Oh My Zsh by installing the module &lt;a href="https://github.com/gluons/powershell-git-aliases" rel="noopener noreferrer"&gt;powershell-git-aliases&lt;/a&gt;.&lt;br&gt;
If you are not familiar with them, Oh My ZSH provides a full list &lt;a href="https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/README.md" rel="noopener noreferrer"&gt;on their GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Just run the usual command to install it and add the module to your profile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Install-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;git-aliases&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Scope&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;CurrentUser&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-AllowClobber&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# then add this to your $PROFILE, and restart your terminal:&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;Import-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;git-aliases&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-DisableNameChecking&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There it is! Now you can use your &lt;code&gt;gco&lt;/code&gt;s, &lt;code&gt;gpra&lt;/code&gt;s and &lt;code&gt;ggfl&lt;/code&gt;s to your heart's content.&lt;/p&gt;

</description>
      <category>pwsh</category>
      <category>dx</category>
      <category>zsh</category>
    </item>
    <item>
      <title>How I ended up using Colima for Docker on Apple Silicon</title>
      <dc:creator>Daniel Marczin</dc:creator>
      <pubDate>Fri, 03 May 2024 21:59:00 +0000</pubDate>
      <link>https://dev.to/dim5/how-i-ended-up-using-colima-for-docker-on-apple-silicon-2hb2</link>
      <guid>https://dev.to/dim5/how-i-ended-up-using-colima-for-docker-on-apple-silicon-2hb2</guid>
      <description>&lt;p&gt;This year I got the chance to work with an Apple Silicon-based MacBook Pro, and what neat machines they are!&lt;br&gt;
Compared to my Dell XPS 9500, the difference is night and day. These ARM based devices are fast and cool (both literally and figuratively), whereas the XPS can often sound like a helicopter taking off.&lt;br&gt;
(It doesn't help that I got a device equipped with a 4K screen, but that's another story).&lt;/p&gt;

&lt;p&gt;Because of the &lt;a href="https://www.docker.com/blog/updating-product-subscriptions"&gt;pricing change&lt;/a&gt; that happened back in August 2021, I couldn't use Docker Desktop that I suppose everyone got accustomed to throughout the years, so just like I did on Windows back then, I started looking for a replacement.&lt;/p&gt;
&lt;h2&gt;
  
  
  Podman
&lt;/h2&gt;

&lt;p&gt;A lot of well-known Docker alternatives emerged at this point, the most commonly recommended of which must be &lt;a href="https://github.com/containers/podman"&gt;Podman&lt;/a&gt; (along with Podman Desktop).&lt;br&gt;
This is what I use on my Windows machines, and this was the first solution that I tried on the Macbook as well.&lt;/p&gt;

&lt;p&gt;The setup was pretty straightforward, as it usually is with Homebrew:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;podman-desktop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything was working flawlessly, especially with the &lt;code&gt;podman-compose&lt;/code&gt; extension installed, which allowed me to run compose files.&lt;/p&gt;

&lt;p&gt;The first problems arose, when I needed to run a compose file, that contained x64 images.&lt;br&gt;
Even though, in theory, it should've been possible, it didn't matter how much time I spent on following various tutorials, reinitializing podman-machines, messing with QEMU flags, I just couldn't get the thing working.&lt;/p&gt;
&lt;h2&gt;
  
  
  Colima
&lt;/h2&gt;

&lt;p&gt;While looking into the issue with Podman, I came across &lt;a href="https://github.com/abiosoft/colima"&gt;colima&lt;/a&gt;.&lt;br&gt;
Apart from being able to run AMD64 images out of the box, there were additional benefits to it, one of which was, unlike podman, colima could use Rosetta 2 for x64 emulation (which is significantly more performant).&lt;/p&gt;
&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;The installation was pretty simple.&lt;br&gt;
First, you need to make sure that you have Rosetta installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;softwareupdate &lt;span class="nt"&gt;--install-rosetta&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then just install colima, Docker and compose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;colima
brew &lt;span class="nb"&gt;install &lt;/span&gt;docker docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can start colima, but let's edit the machine defaults first. You can do both with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;colima start &lt;span class="nt"&gt;--edit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now edit the configuration file that's just opened in your default editor.&lt;br&gt;
Make the following config changes to use :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vmType: vz
rosetta: &lt;span class="nb"&gt;true
&lt;/span&gt;mountType: virtiofs
&lt;span class="c"&gt;# optionally adjust whatever else you want&lt;/span&gt;
&lt;span class="c"&gt;# I suggest increasing the available cpu cores and RAM by editing `cpu` and `memory`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There! Now you can run all the Docker images you want by using the usual Docker CLI, since colima set itself up as a Docker context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Drawbacks
&lt;/h3&gt;

&lt;p&gt;Unlike docker-desktop or podman-desktop, you need to manually start colima every time you log off. You can work around this by using &lt;a href="https://github.com/Homebrew/homebrew-services"&gt;brew-services&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew services start colima
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another disadvantage is that you don't get a GUI. Personally, this isn't a big deal for me, I opted for the &lt;code&gt;-desktop&lt;/code&gt; versions just because of the ease of installation &lt;em&gt;(something something Windows user and GUIs)&lt;/em&gt; but I only ever used the CLIs anyway.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you are an individual dev, you can use the good old Docker-Desktop&lt;/li&gt;
&lt;li&gt;If you are a business user, and you want a GUI, use &lt;a href="https://github.com/containers/podman-desktop"&gt;Podman-Desktop&lt;/a&gt;, unless you want to run x64 images&lt;/li&gt;
&lt;li&gt;Otherwise, set up &lt;a href="https://github.com/abiosoft/colima"&gt;Colima&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://marczin.dev/blog/macos-docker-setup/"&gt;https://marczin.dev&lt;/a&gt; on December 10, 2023.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>macos</category>
      <category>osx</category>
    </item>
  </channel>
</rss>
