<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Minimal</title>
		<description>Infrastructure Engineer</description>
		<link>https://dracoater.github.io</link>
		<atom:link href="https://dracoater.github.io/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Git aliases</title>
				<description>
&lt;p&gt;Here are a bunch of aliases I use to work with git in command line.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;bash&quot;&gt;Bash&lt;/h2&gt;

&lt;p&gt;For the bash it is simple, just copy and paste them into your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bash_aliases&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gfmp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git fetch -p &amp;amp;&amp;amp; git checkout master &amp;amp;&amp;amp; git pull&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git add&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git diff&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gdi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git diff --ignore-cr-at-eol&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git commit&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git status&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gpl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git pull&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gps&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git push --all&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git log --oneline --decorate --graph --all&apos;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;gld&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;git log --format=&quot;%C(auto)%h %d %ad %&amp;lt;(10,trunc)%al %s&quot; --graph --all --date=&quot;format:%Y-%m-%d %H:%M&quot;&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gfmp&lt;/code&gt; to git fetch, checkout master and pull, and some others like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gl&lt;/code&gt; for git
log.&lt;/p&gt;

&lt;h2 id=&quot;powershell&quot;&gt;Powershell&lt;/h2&gt;

&lt;p&gt;With powershell it is a bit harder to configure. &lt;a href=&quot;https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_aliases?view=powershell-7.4&quot;&gt;Powershell aliases&lt;/a&gt; do not support passing
parameters.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;You cannot assign an alias to a command and its parameters. For example, you can assign an alias
to the Get-Eventlog cmdlet, but you cannot assign an alias to the Get-Eventlog -LogName System
command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As a workaround we can use functions. Let’s create a profile which is automatically run in every
new powershell window and add there our new functions:&lt;/p&gt;

&lt;div class=&quot;language-ps highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;New-Item&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Type&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Path&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$PROFILE&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Force&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;notepad.exe&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$PROFILE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add the following lines into the editor and save:&lt;/p&gt;

&lt;div class=&quot;language-ps highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Removing&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;aliases&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;provided&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;by&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Powershell,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;they&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;conflict&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;aliases&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Remove-Alias`&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;does&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;work,&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;they&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;are&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;&quot;constant&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;read-only&quot;.&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;Remove-Item&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Force&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Alias:gc&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;Remove-Item&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Force&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Alias:gl&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;Remove-Item&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-Force&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Alias:gps&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gfmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;-p;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;checkout&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;master;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pull&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;@args&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;can&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pass&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;multi&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;arguments&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;example&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ga&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fileName1&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fileName2&lt;/span&gt; 
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ga&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;add&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;@args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gdi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;diff&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--ignore-cr-at-eol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;commit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gpl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pull&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;log&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--oneline&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--decorate&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--graph&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;gld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;log&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;--format=&quot;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;%C(auto)%h %d %ad %&amp;lt;(10,trunc)%al %s&quot; --graph --all --date=&quot;format:%Y-%m-%d %H:%M&quot;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now when you start the new powershell window, you will be able to use the new aliases for git.&lt;/p&gt;
</description>
				<pubDate>Wed, 23 Oct 2024 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2024/10/git-aliases</link>
				<guid isPermaLink="true">https://dracoater.github.io/2024/10/git-aliases</guid>
			</item>
		
			<item>
				<title>How To Split Audio CD Image (.flac) Into Several Tracks In Ubuntu</title>
				<description>&lt;p&gt;This is still working&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;cuetools shntool flac &lt;span class=&quot;c&quot;&gt;#install needed tools&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cuebreakpoints sample.cue | shnsplit &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; flac sample.flac &lt;span class=&quot;c&quot;&gt;#read breakpoints from cue and give them to splitter&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cuetag sample.cue split-track&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;.flac &lt;span class=&quot;c&quot;&gt;#add tags to newly created files&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
				<pubDate>Tue, 14 Apr 2020 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2020/04/split-flac</link>
				<guid isPermaLink="true">https://dracoater.github.io/2020/04/split-flac</guid>
			</item>
		
			<item>
				<title>Vim langmap</title>
				<description>&lt;p&gt;Sometimes I need to write in russian using vim. The problem that arise is that normal mode in vim
does not work with cyrillic, so I need to switch back and forth between US and RU layouts.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;I don’t like switching layouts back and forth all the time. So eventually I found some kind of
solution to this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:help langmap
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When in Normal mode the ‘langmap’ option takes care of translating a character in different
layout to the original meaning of the key. So I added the following line into my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;set langmap=йЙцЦуУкКеЕнНгГшШщЩзЗхХъЪфФыЫвВаАпПрРоОлЛдДжЖэЭяЯчЧсСмМиИтТьЬбБюЮ.\\,;qQwWeErRtTyYuUiIoOpP[{]}aAsSdDfFgGhHjJkKlL;:&apos;\&quot;zZxXcCvVbBnNmM\\,&amp;lt;.&amp;gt;/?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Yes, you need to map both small and capital letters. Now I don’t have to switch from RU to US in
Normal mode for the shortcuts to work..&lt;/p&gt;
</description>
				<pubDate>Tue, 03 Mar 2020 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2020/03/vim-langmap</link>
				<guid isPermaLink="true">https://dracoater.github.io/2020/03/vim-langmap</guid>
			</item>
		
			<item>
				<title>Windows Subsystem for Linux (WSL) and File Permissions using /etc/wsl.conf</title>
				<description>
&lt;p&gt;I encountered a problem with the Ubuntu inside Windows Subsystem for Linux. The problem is that
windows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:&lt;/code&gt; drive is mounted with root user.&lt;/p&gt;

&lt;!--more--&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;user@hostname:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-la&lt;/span&gt; /mnt/
total 0
drwxr-xr-x 1 root root 4096 Feb 11 09:36 &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
drwxr-xr-x 1 root root 4096 Feb 11 09:36 ..
drwxrwxrwx 1 root root 4096 Feb 10 14:33 c
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This causes later problems when you try to clone repository either with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hg&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;user@hostname:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;hg clone &amp;lt;somerepo&amp;gt; &lt;span class=&quot;nt&quot;&gt;--debug&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;...]
applying clone bundle from &amp;lt;somerepo&amp;gt;.hg
abort: Operation not permitted: &lt;span class=&quot;s1&quot;&gt;&apos;&amp;lt;destination&amp;gt;/.hg/.dirstate-ICQalM~&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also some other problems exist. If closing Ubuntu and killing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; process in Windows Task
Manager does not fix your problem, you can try using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wsl.conf&lt;/code&gt; file. This is availabe since
&lt;a href=&quot;https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-17063&quot;&gt;build 17063&lt;/a&gt;. You need to create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wsl.conf&lt;/code&gt; file inside your linux in WSL, and add the
default user and group ids for mount.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[automount]
options = &quot;metadata,uid=1000,gid=1000&quot; # in Ubuntu distro, the default user is created with uid=1000,gid=1000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There are also &lt;a href=&quot;https://docs.microsoft.com/en-us/windows/wsl/wsl-config#set-wsl-launch-settings&quot;&gt;other options available&lt;/a&gt;. My &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/wsl.conf&lt;/code&gt; now looks like that:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[automount]
enabled = true
options = metadata,uid=1000,gid=1000,umask=022
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
				<pubDate>Tue, 11 Feb 2020 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2020/02/wsl-and-file-permissions-using-etc-wsl-conf</link>
				<guid isPermaLink="true">https://dracoater.github.io/2020/02/wsl-and-file-permissions-using-etc-wsl-conf</guid>
			</item>
		
			<item>
				<title>Change Tmux Current Session Name and Default Directory</title>
				<description>&lt;p&gt;Run these commands inside the tmux session you want to change.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:rename-session &amp;lt;new-name&amp;gt;
:attach-session &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &amp;lt;new-default-path&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
				<pubDate>Thu, 30 Jan 2020 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2020/01/change-tmux-current-session-name-and-folder</link>
				<guid isPermaLink="true">https://dracoater.github.io/2020/01/change-tmux-current-session-name-and-folder</guid>
			</item>
		
			<item>
				<title>Test-Kitchen with Vagrant and Virtual Box in Windows Subsystem for Linux (WSL)</title>
				<description>
&lt;p&gt;I recently had to switch from Ubuntu to Windows on my workstation, but thankfully there is a
Windows Subsystem for Linux now there and I decided to setup my tools in Ubuntu inside Windows.
I will briefly describe the process and a solution for a small problem I encountered.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;install-required-software&quot;&gt;Install Required Software&lt;/h2&gt;

&lt;p&gt;To be able to start virtual machines with Test-Kitchen in WSL we need to install ChefDK and
Vagrant in WSL. After the installation create an environment variable:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;VAGRANT_WSL_ENABLE_WINDOWS_ACCESS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can add this code into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;, it is set automatically on start. More on this in &lt;a href=&quot;https://www.vagrantup.com/docs/other/wsl.html&quot;&gt;Vagrant
Docs&lt;/a&gt;. After that install VirtualBox in Windows.&lt;/p&gt;

&lt;h2 id=&quot;test-current-configuration&quot;&gt;Test Current Configuration&lt;/h2&gt;

&lt;p&gt;I started testing if I could start the VM using Test-Kitchen by creating a simple &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kitchen.yml&lt;/code&gt; file.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vagrant&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;platforms&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-18.04&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;suites&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This should download and start default ubuntu-18.04 image. After &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kitchen create&lt;/code&gt;, it downloaded
the image, but unfortunately, it couldn’t start it and failed with the error:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vm:
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: /home/${USER}/.kitchen/cache
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It tries to create a shared folder although we did not ask for it. Lets look at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vagrantfile&lt;/code&gt;
it created. The file is in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.kitchen/kitchen-vagrant/default-ubuntu-1804/Vagrantfile&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;Vagrant&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;configure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;berkshelf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;enabled&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Vagrant&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;has_plugin?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;vagrant-berkshelf&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;box&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;bento/ubuntu-18.04&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;default-ubuntu-1804.vagrantup.com&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;synced_folder&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/vagrant&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;disabled: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;synced_folder&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/home/${USER}/.kitchen/cache&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/tmp/omnibus/cache&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;create: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;vm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;provider&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:virtualbox&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;kitchen-projects-default-ubuntu-1804-af21e153-1697-468a-adff-99007a6fd980&quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;customize&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;modifyvm&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;--audio&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;none&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Indeed the main synced folder is disabled, but some other cache folder is there. The &lt;a href=&quot;https://github.com/test-kitchen/kitchen-vagrant/blob/1c4cc1f4955003115e92fe3654a1e4590f6a9d18/lib/kitchen/driver/vagrant.rb#L249&quot;&gt;source code
of kitchen-vagrant&lt;/a&gt; has the answer:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;safe_share?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;box&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:provider&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/(hyperv|libvirt)/&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;box&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;%r{^bento/(centos|debian|fedora|opensuse|ubuntu|oracle|amazonlinux)-}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;They create a cache folder automatically, if your box is from &lt;em&gt;bento&lt;/em&gt;. We need to either disable
this stuff or provide a better path. Adding this line to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kitchen.yml&lt;/code&gt; does the trick.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;vagrant&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;cache_directory&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# added line&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
				<pubDate>Wed, 29 Jan 2020 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2020/01/vagrant-in-WSL</link>
				<guid isPermaLink="true">https://dracoater.github.io/2020/01/vagrant-in-WSL</guid>
			</item>
		
			<item>
				<title>Vimrc</title>
				<description>
&lt;p&gt;Another talk about Vim I gave at &lt;a href=&quot;http://devclub.eu&quot;&gt;DevClub&lt;/a&gt;. Now it was about vimrc - options, mappings and abbreviations. Sorry, english-speaking friends, the talk is in Russian.&lt;/p&gt;

&lt;!--more--&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/r19d0mDMxYQ&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
</description>
				<pubDate>Thu, 25 Jul 2019 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2019/07/vimrc</link>
				<guid isPermaLink="true">https://dracoater.github.io/2019/07/vimrc</guid>
			</item>
		
			<item>
				<title>Dynamic Bash Prompt</title>
				<description>
&lt;p&gt;I have a problem. I keep constantly committing (and pushing) to wrong branches and then keep
searching for how to move those commits to the right place. So I decided that bash prompt should
remind me, what branch I am currently on. I need a scm tool name (because I use several) and
a branch.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Bash has some &lt;a href=&quot;https://ss64.com/bash/syntax-prompt.html&quot;&gt;special environment variables&lt;/a&gt;, which are responsible for the bash prompt.
Those are PS1, PS2, PS3, PS4 and PROMPT_COMMAND. We can set our prompt by changing the value of
the PS1 environment variable, for example like that:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PS1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;My new prompt&amp;gt; &quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;But this only assigns the prompt statically. What we actually need is, assigning dynamically,
based on what our current working directory is. For that the PROMPT_COMMAND variable is
responsible. Its value is interpreted as a command to execute before the printing of each primary
prompt ($PS1). PS1 variable is set in your ~/.bashrc, so what I did is added some code there:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-diff&quot; data-lang=&quot;diff&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;gi&quot;&gt;+PROMPT_COMMAND=scm_prompt
+
+scm_prompt(){
+  if [ -d &quot;.git&quot; ]; then
+    scm=&quot; git(`git symbolic-ref --short HEAD`)&quot;
+  elif [ -d &quot;.hg&quot; ]; then
+    scm=&quot; hg(`hg branch`)&quot;
+  else
+    scm=&quot;&quot;
+  fi
+}
+
&lt;/span&gt; if [ &quot;$color_prompt&quot; = yes ]; then
   PS1=&apos;${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ &apos;
 else
&lt;span class=&quot;gd&quot;&gt;-  PS1=&apos;${debian_chroot:+($debian_chroot)}\u@\h:\w\$ &apos;
&lt;/span&gt;&lt;span class=&quot;gi&quot;&gt;+  PS1=&apos;${debian_chroot:+($debian_chroot)}\u@\h:\w${scm}\$ &apos;
&lt;/span&gt; fi
 unset color_prompt force_color_prompt
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now, if current directory contains &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.git&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.hg&lt;/code&gt; directories, then I will see the current scm
and branch I am on in bash prompt.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;jt@ratchet:~/projects/dotfiles hg(default)$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
				<pubDate>Thu, 15 Mar 2018 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2018/03/dynamic-bash-prompt</link>
				<guid isPermaLink="true">https://dracoater.github.io/2018/03/dynamic-bash-prompt</guid>
			</item>
		
			<item>
				<title>Jenkins2 Version 1.0.0 Released</title>
				<description>
&lt;p&gt;Yesterday I have released version 1.0.0 of my &lt;a href=&quot;https://rubygems.org/gems/jenkins2&quot;&gt;jenkins2&lt;/a&gt; gem. It’s a API client and a
command line application at the same time, that allows you to manage your Jenkins.
And to be honest I am proud of the code I have pushed. Here is why:&lt;/p&gt;

&lt;!--more--&gt;

&lt;h2 id=&quot;ghost-methods&quot;&gt;Ghost Methods&lt;/h2&gt;

&lt;p&gt;I have read a book &lt;a href=&quot;https://www.goodreads.com/book/show/21824181-metaprogramming-ruby-2&quot;&gt;Metaprogramming Ruby 2&lt;/a&gt;, and there was a good example of API client
(&lt;a href=&quot;https://github.com/huboard/ghee&quot;&gt;ghee&lt;/a&gt;), which uses some metaprogramming magic to map Github’s API to objects. I also managed
to do something similar in my own code. Any API class implements methods that require
specific code, and at the same time forwards methods that just read data to &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/src/e9c986eefcedc96401b0535bea7dfbff9397bd83/lib/jenkins2/resource_proxy.rb&quot;&gt;ResourceProxy&lt;/a&gt;
class, which is essentially a wrapper for the json objects returned by Jenkins. This way the gem
adapts automatically to changes in Jenkins API, and at the same time the code is kept compact.&lt;/p&gt;

&lt;h2 id=&quot;command-line-parser&quot;&gt;Command Line Parser&lt;/h2&gt;

&lt;p&gt;Another thing I am proud of, is my personal command line argument parser, which is at the same time
powerful and compact. It can parse not just command line arguments, but also commands, although it
doesn’t use any third party gem, only the OptionParser, which is included in standard library.
Again all the classes that provide commands derive from one &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/src/e9c986eefcedc96401b0535bea7dfbff9397bd83/lib/jenkins2/cli.rb&quot;&gt;CLI&lt;/a&gt; class, which does most of the
common work like parsing global arguments and command itself, and delegates parsing the command
arguments to particular derivative class. Adding new command is very simple, all you need is to
create a new class, derive it from CLI and overwrite some methods. (Check out &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/src/e9c986eefcedc96401b0535bea7dfbff9397bd83/lib/jenkins2/cli/plugins.rb&quot;&gt;ShowPlugin&lt;/a&gt;
class for example.)&lt;/p&gt;

&lt;h2 id=&quot;high-test-coverage&quot;&gt;High Test Coverage&lt;/h2&gt;

&lt;p&gt;And the last, but not least thing is, of course, test coverage, which is currently at 98.74%. I
am testing the gem with unit and integration tests, which run in &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/addon/pipelines/home&quot;&gt;bitbucket pipelines&lt;/a&gt;.
Integration tests are run against Jenkins server inside docker container.
Look into &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/src/e9c986eefcedc96401b0535bea7dfbff9397bd83/bitbucket-pipelines.yml&quot;&gt;bitbucket-pipelines.yml&lt;/a&gt; for details.&lt;/p&gt;

&lt;p&gt;The work, of course, is not finished yet. I am planning to add support for more API endpoints and
plugins as well as provide more commands in command line client. If you feel like lacking some
functionality, please &lt;a href=&quot;https://bitbucket.org/DracoAter/jenkins2/issues&quot;&gt;create an issue&lt;/a&gt;, or if you have some free time, make yourself
comfortable and create a pull request.&lt;/p&gt;
</description>
				<pubDate>Tue, 20 Feb 2018 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2018/02/jenkins2-version-1.0.0-released</link>
				<guid isPermaLink="true">https://dracoater.github.io/2018/02/jenkins2-version-1.0.0-released</guid>
			</item>
		
			<item>
				<title>Integration Tests for Test Kitchen Driver</title>
				<description>
&lt;p&gt;Imagine you write a driver for &lt;a href=&quot;https://kitchen.ci&quot;&gt;Test Kitchen&lt;/a&gt;. It’s reasonable, if you want to check, if your
driver is working before publishing it. But which approach to take? Building the gem and
installing it locally, then manually trying to launch Test Kitchen with your driver, does not
really feel the way to do it.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;I write a &lt;a href=&quot;https://github.com/DracoAter/kitchen-lxd&quot;&gt;Test Kitchen driver for Lxd&lt;/a&gt; and here how I solved the problem of testing. Obviously
we start by adding a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.kitchen.yml&lt;/code&gt; to our driver project, where we make Kitchen use our driver.
My driver name is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lxd&lt;/code&gt;, so my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.kitchen.yml&lt;/code&gt; looks like that:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;lxd&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;transport&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;lxd&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now when we try to run Kitchen we get the error, telling us that there is no such driver found.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;kitchen list
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;------Exception-------&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; Class: Kitchen::ClientError
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; Message: Could not load the &lt;span class=&quot;s1&quot;&gt;&apos;lxd&apos;&lt;/span&gt; driver from the load path. Please ensure that your driver
&lt;span class=&quot;go&quot;&gt;is installed as a gem or included in your Gemfile if using Bundler.
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;----------------------&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; Please see .kitchen/logs/kitchen.log &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;more details
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; Also try running &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;kitchen diagnose &lt;span class=&quot;nt&quot;&gt;--all&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;configuration&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Looking further into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.kitchen/logs/kitchen.log&lt;/code&gt; reveals the exact error:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;go&quot;&gt;ERROR -- Kitchen: Message: cannot load such file -- kitchen/driver/lxd&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Well, Kitchen cannot find the file, obviously, because it does not know where to look for. This
file is in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib&lt;/code&gt; directory of our driver repository. What we need to do now, is to tell Kitchen,
that it should look also in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib&lt;/code&gt; directory. This can be done by adding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lib&lt;/code&gt; directory to
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$LOAD_PATH&lt;/code&gt; global ruby variable. Thankfully Kitchen parses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.kitchen.yml&lt;/code&gt; as an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;erb&lt;/code&gt; template,
so we can just add these instructions at the top of the file:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;# Make sure the local copy of the driver is loaded&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;lt;% lib = File.expand_path(&apos;lib&apos;, __dir__) %&amp;gt;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;lt;% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;lxd&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;transport&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;lxd&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And that’s it! Now when you run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kitchen list&lt;/code&gt; again, you will see no error, but the list of
kitchen instances.&lt;/p&gt;

&lt;p&gt;Now you can continue with adding different tests to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test/integration&lt;/code&gt; folder as usual, as if you
are testing some completely random project, not connected to Test Kitchen, with Test Kitchen.&lt;/p&gt;
</description>
				<pubDate>Sun, 07 Jan 2018 00:00:00 +0000</pubDate>
				<link>https://dracoater.github.io/2018/01/integration-tests-for-test-kitchen-driver</link>
				<guid isPermaLink="true">https://dracoater.github.io/2018/01/integration-tests-for-test-kitchen-driver</guid>
			</item>
		
	</channel>
</rss>
