<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>tkuchiki's blog</title><link>https://blog.tkuchiki.net/en/</link><description>Recent content on tkuchiki's blog</description><generator>Hugo -- gohugo.io</generator><copyright>&amp;copy; 2018 blog.tkuchiki.com</copyright><lastBuildDate>Mon, 31 Oct 2022 00:00:00 +0900</lastBuildDate><atom:link href="https://blog.tkuchiki.net/en/feed.xml" rel="self" type="application/rss+xml"/><item><title>Alias to run "git switch" regardless of whether the default branch is main or master.</title><link>https://blog.tkuchiki.net/en/git-switch-default-branch/</link><pubDate>Mon, 31 Oct 2022 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/git-switch-default-branch/</guid><description>GitHub has changed the default branch from master to main, but repositories created before the change may still be master.
You can git switch them by creating the following alias and running the gitswdb.
alias gitswdb=&amp;#34;git switch $(git symbolic-ref refs/remotes/origin/HEAD | cut -f4 -d&amp;#39;/&amp;#39;)&amp;#34; If you are using git checkout, rewriting switch to checkout should work.</description><content>&lt;p>GitHub has changed the default branch from master to main, but repositories created before the change may still be master.&lt;br>
You can &lt;code>git switch&lt;/code> them by creating the following alias and running the &lt;code>gitswdb&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>alias gitswdb&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;git switch &lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>git symbolic-ref refs/remotes/origin/HEAD | cut -f4 -d&lt;span style="color:#e6db74">&amp;#39;/&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If you are using &lt;code>git checkout&lt;/code>, rewriting &lt;code>switch&lt;/code> to &lt;code>checkout&lt;/code> should work.&lt;/p></content></item><item><title>Fastly's request condition is applied to the latest matching condition</title><link>https://blog.tkuchiki.net/en/fastly-request-condition-priority/</link><pubDate>Tue, 06 Apr 2021 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/fastly-request-condition-priority/</guid><description>If you want Fastly to switch origin (backend) according to a condition, you can do so by setting a request condition. I misunderstood the behavior of the request condition and got into trouble, so I&amp;rsquo;ll show you what I misunderstood and how I dealt with it.
Request condition The Request condition has a priority, and the default is 10. The lower the value, it will be evaluated first, and all request conditions will be evaluated.</description><content>&lt;p>If you want Fastly to switch origin (backend) according to a condition, you can do so by setting a request condition.
I misunderstood the behavior of the request condition and got into trouble, so I&amp;rsquo;ll show you what I misunderstood and how I dealt with it.&lt;/p>
&lt;h2 id="request-condition">Request condition&lt;/h2>
&lt;p>The Request condition has a priority, and the default is 10. The lower the value, it will be evaluated first, and all request conditions will be evaluated.
The following is an example of a request condition.&lt;/p>
&lt;ul>
&lt;li>Request condition 1
&lt;ul>
&lt;li>priority: 10&lt;/li>
&lt;li>condition: &lt;code>req.http.host == &amp;quot;foo.example.com&amp;quot; &amp;amp;&amp;amp; req.url.path ~ &amp;quot;^/v2&amp;quot;&lt;/code>&lt;/li>
&lt;li>backend: &lt;code>bar.example.com&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Request condition 2
&lt;ul>
&lt;li>priority: 20&lt;/li>
&lt;li>condition: &lt;code>req.http.host == &amp;quot;foo.example.com&amp;quot;&lt;/code>&lt;/li>
&lt;li>backend: &lt;code>foo.example.com&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>With this configuration, I thought that a request for &lt;code>foo.example.com/v2/ping&lt;/code> would set the backend to &lt;code>bar.example.com&lt;/code> and a request for &lt;code>foo.example.com/v1/ping&lt;/code> would set the backend to &lt;code>foo.example.com&lt;/code>.
However, the backend for &lt;code>foo.example.com/v2/ping&lt;/code> was set to &lt;code>foo.example.com&lt;/code>.
This is because the request conditions are evaluated in ascending order of priority, but matching the conditions does not stop them from being evaluated.
The above request conditions are VCL as follows.&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-vcl" data-lang="vcl"># Request Condition: api_v2 Prio: 10
if( req.http.host == &amp;#34;foo.example.com&amp;#34; &amp;amp;&amp;amp; req.url.path ~ &amp;#34;^/v2/&amp;#34; ) {
set req.backend = F_bar_example_com;
}
#end condition
# Request Condition: api_v1 Prio: 20
if( req.http.host == &amp;#34;foo.example.com&amp;#34; ) {
set req.backend = F_foo_example_com;
}
#end condition
&lt;/code>&lt;/pre>&lt;p>&lt;code>If statements&lt;/code> are generated as there are request conditions. if a condition with a high priority value is matched, the backend will be that one.
When setting the request conditions, you must be aware of one of the following:&lt;/p>
&lt;ul>
&lt;li>Set a condition that does not match more than one request condition&lt;/li>
&lt;li>Set priorities appropriately to ensure that multiple request conditions match the intended behavior&lt;/li>
&lt;/ul></content></item><item><title>How to convert to lowercase and uppercase in bash, awk, sed, and, tr and the benchmark results for each</title><link>https://blog.tkuchiki.net/en/to-lower-upper-bash-awk-sed-tr/</link><pubDate>Sat, 03 Apr 2021 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/to-lower-upper-bash-awk-sed-tr/</guid><description>This article introduces how to convert to lowercase and uppercase in bash, awk, sed, and tr, and the benchmark results for each.
Versions The versions are as follows:
OS Ubuntu 20.04.1 LTS bash GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu) gawk GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0) mawk 1.3.4 20200120 sed sed (GNU sed) 4.7 tr tr (GNU coreutils) 8.30 Convert to lowercase/uppercase bash The documentation says the following:</description><content>&lt;p>This article introduces how to convert to lowercase and uppercase in bash, awk, sed, and tr, and the benchmark results for each.&lt;/p>
&lt;h2 id="versions">Versions&lt;/h2>
&lt;p>The versions are as follows:&lt;/p>
&lt;ul>
&lt;li>OS
&lt;ul>
&lt;li>Ubuntu 20.04.1 LTS&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>bash
&lt;ul>
&lt;li>&lt;code>GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>gawk
&lt;ul>
&lt;li>&lt;code>GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>mawk
&lt;ul>
&lt;li>&lt;code>1.3.4 20200120&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>sed
&lt;ul>
&lt;li>&lt;code>sed (GNU sed) 4.7&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>tr
&lt;ul>
&lt;li>&lt;code>tr (GNU coreutils) 8.30&lt;/code>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h2 id="convert-to-lowercaseuppercase">Convert to lowercase/uppercase&lt;/h2>
&lt;h3 id="bash">bash&lt;/h3>
&lt;p>The &lt;a href="https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion">documentation&lt;/a> says the following:&lt;/p>
&lt;blockquote>
&lt;p>The ‘^’ operator converts lowercase letters matching pattern to uppercase; the ‘,’ operator converts matching uppercase letters to lowercase. The ‘^^’ and ‘,,’ expansions convert each matched character in the expanded value;&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span># to lower
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ val&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;AAA&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">${&lt;/span>val,,&lt;span style="color:#e6db74">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aaa
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span># to upper
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ val&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;aaa&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">${&lt;/span>val^^&lt;span style="color:#e6db74">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AAA
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="awk">awk&lt;/h3>
&lt;p>The documentations says that there are functions called &lt;a href="https://www.gnu.org/software/gawk/manual/gawk.html#index-converting-4">tolower&lt;/a> and &lt;a href="https://www.gnu.org/software/gawk/manual/gawk.html#index-converting-5">toupper&lt;/a>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span># to lower
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo AAA | awk &lt;span style="color:#e6db74">&amp;#39;{print tolower($0)}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aaa
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span># to upper
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo aaa | awk &lt;span style="color:#e6db74">&amp;#39;{print toupper($0)}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AAA
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="sed">sed&lt;/h3>
&lt;p>The &lt;a href="https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command">documentation&lt;/a> says the following:&lt;/p>
&lt;blockquote>
&lt;p>\L
Turn the replacement to lowercase until a \U or \E is found,&lt;/p>
&lt;/blockquote>
&lt;blockquote>
&lt;p>\U
Turn the replacement to uppercase until a \L or \E is found,&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span># to lower
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo AAA | sed -e &lt;span style="color:#e6db74">&amp;#39;s/\(.*\)/\L\1/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aaa
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span># to upper
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo aaa | sed -e &lt;span style="color:#e6db74">&amp;#39;s/\(.*\)/\U\1/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AAA
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>However, &lt;code>\L&lt;/code> and &lt;code>\U&lt;/code> cannot be used in BSD sed.&lt;/p>
&lt;h3 id="tr">tr&lt;/h3>
&lt;p>The &lt;a href="https://man7.org/linux/man-pages/man1/tr.1.html">documentation&lt;/a> says the following:&lt;/p>
&lt;blockquote>
&lt;p>[:lower:]
all lower case letters&lt;/p>
&lt;/blockquote>
&lt;blockquote>
&lt;p>[:upper:]
all upper case letters&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span># to lower
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo AAA | tr &lt;span style="color:#e6db74">&amp;#39;[:upper:]&amp;#39;&lt;/span> &lt;span style="color:#e6db74">&amp;#39;[:lower:]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aaa
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span># to upper
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo aaa | tr &lt;span style="color:#e6db74">&amp;#39;[:lower:]&amp;#39;&lt;/span> &lt;span style="color:#e6db74">&amp;#39;[:upper:]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AAA
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The above is how to convert to lowercase and uppercase.&lt;/p>
&lt;h2 id="benchmark">Benchmark&lt;/h2>
&lt;p>Benchmark the performance of each. Will use &lt;a href="https://github.com/sharkdp/hyperfine">hyperfine&lt;/a> for benchmarking.&lt;/p>
&lt;h3 id="generate-script">Generate script&lt;/h3>
&lt;p>To convert strings of various lengths, write the following script to generate a script that executes commands on arbitrary-length strings.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>n&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>1&lt;span style="color:#e6db74">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>str&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>perl -e &lt;span style="color:#e6db74">&amp;#34;print &amp;#39;a&amp;#39; x &lt;/span>&lt;span style="color:#e6db74">${&lt;/span>n&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; bash-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">v=${str}; echo \${v^^}
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; tr-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">echo ${str} | tr &amp;#39;[:lower:]&amp;#39; &amp;#39;[:upper:]&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; sed-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">echo ${str} | sed -e &amp;#39;s/\(.*\)/\U\1/&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; gawk-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">echo ${str} | gawk &amp;#39;{print toupper(\$0)}&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; mawk-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">echo ${str} | mawk &amp;#39;{print toupper(\$0)}&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF &amp;gt; benchmark-n${n}.sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">hyperfine --warmup 3 --min-runs 1000 &amp;#34;bash bash-n${n}.sh&amp;#34; &amp;#34;bash tr-n${n}.sh&amp;#34; &amp;#34;bash sed-n${n}.sh&amp;#34; &amp;#34;bash gawk-n${n}.sh&amp;#34; &amp;#34;bash mawk-n${n}.sh&amp;#34; --export-markdown benchmark-result-n${1}.md
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the above script called &lt;code>gen-scripts.sh&lt;/code>, run it as &lt;code>gen-scripts.sh 10&lt;/code> to generate a script that executes commands against &lt;code>aaaaaaaaa&lt;/code>(length = 10) and benchmarks them with hyperfine. Since it is unlikely that the results will change between lowercase and uppercase conversions, benchmark only for uppercase conversions.&lt;/p>
&lt;h3 id="results">Results&lt;/h3>
&lt;p>Benchmarked the string lengths as 10, 100, 1,000, 10,000, 100,000, and 1,000,000. &lt;code>*-n10.sh&lt;/code> has a string length of 10, &lt;code>*-n100.sh&lt;/code> has a string length of 100, &amp;hellip; and so on.
The benchmark was done on Ubuntu 20.04.1, but since the first installed awk was &lt;a href="https://invisible-island.net/mawk/">mawk&lt;/a>, so also measured it with gawk.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n10.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">2.2 ± 0.5&lt;/td>
&lt;td style="text-align:right">1.5&lt;/td>
&lt;td style="text-align:right">6.3&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n10.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.1 ± 0.6&lt;/td>
&lt;td style="text-align:right">2.4&lt;/td>
&lt;td style="text-align:right">9.6&lt;/td>
&lt;td style="text-align:right">1.43 ± 0.44&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n10.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.3 ± 0.5&lt;/td>
&lt;td style="text-align:right">2.7&lt;/td>
&lt;td style="text-align:right">6.7&lt;/td>
&lt;td style="text-align:right">1.55 ± 0.44&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n10.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.9 ± 0.7&lt;/td>
&lt;td style="text-align:right">3.1&lt;/td>
&lt;td style="text-align:right">8.5&lt;/td>
&lt;td style="text-align:right">1.81 ± 0.54&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n10.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.3 ± 0.6&lt;/td>
&lt;td style="text-align:right">2.5&lt;/td>
&lt;td style="text-align:right">6.7&lt;/td>
&lt;td style="text-align:right">1.52 ± 0.46&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n100.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">1.6 ± 0.3&lt;/td>
&lt;td style="text-align:right">1.1&lt;/td>
&lt;td style="text-align:right">3.3&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n100.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">2.6 ± 0.5&lt;/td>
&lt;td style="text-align:right">1.8&lt;/td>
&lt;td style="text-align:right">6.1&lt;/td>
&lt;td style="text-align:right">1.70 ± 0.45&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n100.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">2.8 ± 0.5&lt;/td>
&lt;td style="text-align:right">2.2&lt;/td>
&lt;td style="text-align:right">5.6&lt;/td>
&lt;td style="text-align:right">1.79 ± 0.46&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n100.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.4 ± 0.6&lt;/td>
&lt;td style="text-align:right">2.6&lt;/td>
&lt;td style="text-align:right">6.8&lt;/td>
&lt;td style="text-align:right">2.16 ± 0.55&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n100.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">2.7 ± 0.5&lt;/td>
&lt;td style="text-align:right">2.0&lt;/td>
&lt;td style="text-align:right">6.4&lt;/td>
&lt;td style="text-align:right">1.70 ± 0.45&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n1000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">2.3 ± 0.5&lt;/td>
&lt;td style="text-align:right">1.6&lt;/td>
&lt;td style="text-align:right">7.2&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n1000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.2 ± 1.3&lt;/td>
&lt;td style="text-align:right">2.4&lt;/td>
&lt;td style="text-align:right">19.0&lt;/td>
&lt;td style="text-align:right">1.44 ± 0.66&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n1000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">4.6 ± 2.2&lt;/td>
&lt;td style="text-align:right">2.8&lt;/td>
&lt;td style="text-align:right">24.1&lt;/td>
&lt;td style="text-align:right">2.02 ± 1.08&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n1000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">4.1 ± 0.9&lt;/td>
&lt;td style="text-align:right">3.1&lt;/td>
&lt;td style="text-align:right">8.9&lt;/td>
&lt;td style="text-align:right">1.83 ± 0.57&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n1000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.2 ± 0.4&lt;/td>
&lt;td style="text-align:right">2.6&lt;/td>
&lt;td style="text-align:right">6.3&lt;/td>
&lt;td style="text-align:right">1.40 ± 0.37&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n10000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.1 ± 0.4&lt;/td>
&lt;td style="text-align:right">2.4&lt;/td>
&lt;td style="text-align:right">7.3&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n10000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.4 ± 0.6&lt;/td>
&lt;td style="text-align:right">2.6&lt;/td>
&lt;td style="text-align:right">6.1&lt;/td>
&lt;td style="text-align:right">1.11 ± 0.25&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n10000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">5.7 ± 26.5&lt;/td>
&lt;td style="text-align:right">3.8&lt;/td>
&lt;td style="text-align:right">842.7&lt;/td>
&lt;td style="text-align:right">1.84 ± 8.62&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n10000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">4.4 ± 0.7&lt;/td>
&lt;td style="text-align:right">3.4&lt;/td>
&lt;td style="text-align:right">7.6&lt;/td>
&lt;td style="text-align:right">1.44 ± 0.31&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n10000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">3.4 ± 0.4&lt;/td>
&lt;td style="text-align:right">2.7&lt;/td>
&lt;td style="text-align:right">5.5&lt;/td>
&lt;td style="text-align:right">1.10 ± 0.21&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n100000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">17.1 ± 1.4&lt;/td>
&lt;td style="text-align:right">14.8&lt;/td>
&lt;td style="text-align:right">29.4&lt;/td>
&lt;td style="text-align:right">1.63 ± 0.20&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n100000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">10.5 ± 1.0&lt;/td>
&lt;td style="text-align:right">8.9&lt;/td>
&lt;td style="text-align:right">15.8&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n100000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">21.2 ± 1.6&lt;/td>
&lt;td style="text-align:right">19.0&lt;/td>
&lt;td style="text-align:right">39.2&lt;/td>
&lt;td style="text-align:right">2.02 ± 0.24&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n100000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">12.8 ± 1.0&lt;/td>
&lt;td style="text-align:right">11.0&lt;/td>
&lt;td style="text-align:right">19.1&lt;/td>
&lt;td style="text-align:right">1.22 ± 0.15&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n100000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">11.9 ± 0.7&lt;/td>
&lt;td style="text-align:right">10.7&lt;/td>
&lt;td style="text-align:right">18.3&lt;/td>
&lt;td style="text-align:right">1.13 ± 0.13&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Command&lt;/th>
&lt;th style="text-align:right">Mean [ms]&lt;/th>
&lt;th style="text-align:right">Min [ms]&lt;/th>
&lt;th style="text-align:right">Max [ms]&lt;/th>
&lt;th style="text-align:right">Relative&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash bash-n1000000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">144.8 ± 11.2&lt;/td>
&lt;td style="text-align:right">126.3&lt;/td>
&lt;td style="text-align:right">206.8&lt;/td>
&lt;td style="text-align:right">1.89 ± 0.19&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash tr-n1000000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">77.4 ± 6.9&lt;/td>
&lt;td style="text-align:right">67.1&lt;/td>
&lt;td style="text-align:right">143.5&lt;/td>
&lt;td style="text-align:right">1.01 ± 0.11&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash sed-n1000000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">172.3 ± 13.6&lt;/td>
&lt;td style="text-align:right">151.1&lt;/td>
&lt;td style="text-align:right">276.5&lt;/td>
&lt;td style="text-align:right">2.24 ± 0.23&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash gawk-n1000000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">84.3 ± 5.4&lt;/td>
&lt;td style="text-align:right">75.4&lt;/td>
&lt;td style="text-align:right">103.7&lt;/td>
&lt;td style="text-align:right">1.10 ± 0.10&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;code>bash mawk-n1000000.sh&lt;/code>&lt;/td>
&lt;td style="text-align:right">76.8 ± 5.0&lt;/td>
&lt;td style="text-align:right">68.8&lt;/td>
&lt;td style="text-align:right">128.3&lt;/td>
&lt;td style="text-align:right">1.00&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The results are summarized as follow:&lt;/p>
&lt;ul>
&lt;li>For string lengths of 1,000 or less, conversion by bash&amp;rsquo;s variable expansion is the fastest.&lt;/li>
&lt;li>At a string length of 10,000, bash&amp;rsquo;s variable expansion, tr, and mawk, become almost as fast.&lt;/li>
&lt;li>Bash&amp;rsquo;s variable expansion slows down when the string length 100,000 or higher, and tr, mawk, and gawk are faster.&lt;/li>
&lt;li>The performance of tr and mawk will always be about the same.&lt;/li>
&lt;li>sed is the slowest in all results.&lt;/li>
&lt;li>Perhaps because the process was simple, there was not much difference in performance between gawk and mawk.&lt;/li>
&lt;/ul>
&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>This article introduces how to convert to lowercase and uppercase in bash, awk, sed, and tr, and the benchmark results for each.
However, since there is only a 2-fold difference in performance between top and bottom, think there is no problem using the command you like as long as it is not executed too often.
Also, since CPU and memory usage is not measured in hyperfine, choosing which one to use will change when you consider those factors as well.&lt;/p></content></item><item><title>Conver an array of JSON objects to the Markdown table</title><link>https://blog.tkuchiki.net/en/convert-an-array-of-json-objects-to-the-markdown-table/</link><pubDate>Tue, 30 Mar 2021 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/convert-an-array-of-json-objects-to-the-markdown-table/</guid><description>This article is introduction to json2mdtbl, a cli tool that converts an array of JSON objects into a Markdown table.
Installation Download from https://github.com/tkuchiki/json2mdtbl/releases and place it in a location where your PATH environment variable can find it(e.g. /usr/local/bin).
Usage It&amp;rsquo;s easy to use, just pipe in JSON or ndjson.
$ echo &amp;#39;[{&amp;#34;name&amp;#34;: &amp;#34;alice&amp;#34;, &amp;#34;age&amp;#34;: 10},{&amp;#34;name&amp;#34;:&amp;#34;bob&amp;#34;, &amp;#34;age&amp;#34;: 20}]&amp;#39; | json2mdtbl | AGE | NAME | |-----|-------| | 10 | alice | | 20 | bob | $ echo -e &amp;#39;{&amp;#34;name&amp;#34;: &amp;#34;alice&amp;#34;, &amp;#34;age&amp;#34;: 10}\n{&amp;#34;name&amp;#34;:&amp;#34;bob&amp;#34;, &amp;#34;age&amp;#34;: 20}&amp;#39; | json2mdtbl | AGE | NAME | |-----|-------| | 10 | alice | | 20 | bob | You can use it to get BigQuery results as JSON and put them into a Markdown table!</description><content>&lt;p>This article is introduction to json2mdtbl, a cli tool that converts an array of JSON objects into a Markdown table.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;p>Download from &lt;a href="https://github.com/tkuchiki/json2mdtbl/releases">https://github.com/tkuchiki/json2mdtbl/releases&lt;/a> and place it in a location where your &lt;code>PATH&lt;/code> environment variable can find it(e.g. /usr/local/bin).&lt;/p>
&lt;h2 id="usage">Usage&lt;/h2>
&lt;p>It&amp;rsquo;s easy to use, just pipe in JSON or ndjson.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">&amp;#39;[{&amp;#34;name&amp;#34;: &amp;#34;alice&amp;#34;, &amp;#34;age&amp;#34;: 10},{&amp;#34;name&amp;#34;:&amp;#34;bob&amp;#34;, &amp;#34;age&amp;#34;: 20}]&amp;#39;&lt;/span> | json2mdtbl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| AGE | NAME |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|-----|-------|
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| 10 | alice |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| 20 | bob |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>$ echo -e &lt;span style="color:#e6db74">&amp;#39;{&amp;#34;name&amp;#34;: &amp;#34;alice&amp;#34;, &amp;#34;age&amp;#34;: 10}\n{&amp;#34;name&amp;#34;:&amp;#34;bob&amp;#34;, &amp;#34;age&amp;#34;: 20}&amp;#39;&lt;/span> | json2mdtbl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| AGE | NAME |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|-----|-------|
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| 10 | alice |
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| 20 | bob |
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can use it to get BigQuery results as JSON and put them into a Markdown table!&lt;/p></content></item><item><title>Introduction to kubectls</title><link>https://blog.tkuchiki.net/en/introduction-to-kubectls/</link><pubDate>Thu, 18 Mar 2021 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/introduction-to-kubectls/</guid><description>kubectls is a kubectl version manager.
This is a kubectl version of tools like *env(kubectlenv).
Installation You can install it with the following command: Think it will work if you have bash, ln, readlink, curl, and git installed.
$ git clone https://github.com/tkuchiki/kubectls ~/.kubectls Set the PATH to give priority to ~/.kubectls/bin in .bashrc. If you are using zsh, replace it with .zshrc.
# for bash $ echo &amp;#34;PATH=~/.kubectls/bin:\$PATH&amp;#34; &amp;gt;&amp;gt; ~/.bashrc $ echo &amp;#34;export $PATH&amp;#34; &amp;gt;&amp;gt; ~/.</description><content>&lt;p>&lt;a href="https://github.com/tkuchiki/kubectls">kubectls&lt;/a> is a kubectl version manager.&lt;br>
This is a kubectl version of tools like &lt;code>*env&lt;/code>(kubectlenv).&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;p>You can install it with the following command:
Think it will work if you have bash, ln, readlink, curl, and git installed.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ git clone https://github.com/tkuchiki/kubectls ~/.kubectls
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Set the PATH to give priority to &lt;code>~/.kubectls/bin&lt;/code> in .bashrc.
If you are using zsh, replace it with .zshrc.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span># &lt;span style="color:#66d9ef">for&lt;/span> bash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">&amp;#34;PATH=~/.kubectls/bin:\$PATH&amp;#34;&lt;/span> &amp;gt;&amp;gt; ~/.bashrc
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">&amp;#34;export &lt;/span>$PATH&lt;span style="color:#e6db74">&amp;#34;&lt;/span> &amp;gt;&amp;gt; ~/.bashrc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="usage">Usage&lt;/h2>
&lt;p>kubectls consists of 5 subcommands. Introduction to them one by one.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>kubectls is kubectl version manager
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Commands:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> install Install kubectl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> path Show current kubectl&amp;#39;s abs path
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> update Update kubectls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> use Set version
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> versions Show installed versions
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Options:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --version Show version
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="install">install&lt;/h3>
&lt;p>The install subcommand is an installing kubectl.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls install --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectl install (VERSION|stable) [--set]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Install kubectl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Options:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> --set Set version
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can install the stable version of kubectl with &lt;code>kubectl install stable&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls install stable
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> % Total % Received % Xferd Average Speed Time Time Time Current
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Dload Upload Total Spent Left Speed
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>100 44.1M 100 44.1M 0 0 16.3M 0 0:00:02 0:00:02 --:--:-- 16.3M
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>v1.20.4 is installed
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can install the specified version of kubectl with &lt;code>kubectls install VERSION&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls install v1.20.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> % Total % Received % Xferd Average Speed Time Time Time Current
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Dload Upload Total Spent Left Speed
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>100 44.0M 100 44.0M 0 0 17.5M 0 0:00:02 0:00:02 --:--:-- 17.5M
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>v1.20.0 is installed
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>kubectls install&lt;/code> just installs it. It will not become usable.
To switch to the specified version, you can run &lt;code>kubectls use&lt;/code>(see below) or &lt;code>kubectls install&lt;/code> with the option &lt;code>--use&lt;/code>.&lt;/p>
&lt;pre tabindex="0">&lt;code>$ kubectls install v1.20.1 --use
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 44.0M 100 44.0M 0 0 20.7M 0 0:00:02 0:00:02 --:--:-- 20.7M
v1.20.1 is installed
v1.20.1 selected
$ kubectl version --client --short
Client Version: v1.20.1
&lt;/code>&lt;/pre>&lt;h3 id="use">use&lt;/h3>
&lt;p>This is a subcommand to switch to the version of kubectl that you installed with &lt;code>kubectls install&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls use --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectl use [VERSION]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Set version
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can switch to the specific version with &lt;code>kubectls use VERSION&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls use v1.20.4
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.4 selected
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can switch to the specific version by selecting from the list of installed versions.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls use
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>1) v1.20.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2) v1.20.1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>3) v1.20.2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>4) v1.20.4
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Which version? 3
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.2 selected
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="path">path&lt;/h3>
&lt;p>Print the absolute path of the kubectl currently be used.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls path --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectl path
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Show current kubectl&amp;#39;s abs path
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls path
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/Users/tkuchiki/.kubectls/versions/v1.20.2/kubectl
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="versions">versions&lt;/h3>
&lt;p>Prints a list of installed versions.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls versions --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectl versions
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Show installed versions
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls versions
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>v1.20.4
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="update">update&lt;/h3>
&lt;p>Update kubectls.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ kubectls update --help
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Usage: kubectl update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#960050;background-color:#1e0010">&lt;/span>Update kubectls
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>This article was an introduction to kubectls.
You may not switch between multiple versions very often, but I hope this helps you!&lt;/p></content></item><item><title>Open the file in JetBrains IDE by specifying the line that matches the search</title><link>https://blog.tkuchiki.net/en/open-the-file-in-jetbrains-ide-by-specifying-the-line-that-matches-the-search/</link><pubDate>Thu, 11 Mar 2021 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/open-the-file-in-jetbrains-ide-by-specifying-the-line-that-matches-the-search/</guid><description>This article is an introduction to searching for a string in a file using ag or pt and specify the matching line to open in JetBrains IDE.
The way to open a file from the command line in the JetBrains IDE is the same for all of them, so will use Goland as an example. You can configure it on Windows, macOS, and Linux that are supported by the JetBrains IDE, but in this article, the only introduction to macOS.</description><content>&lt;p>This article is an introduction to searching for a string in a file using &lt;a href="https://github.com/ggreer/the_silver_searcher">ag&lt;/a> or &lt;a href="https://github.com/monochromegane/the_platinum_searcher">pt&lt;/a> and specify the matching line to open in &lt;a href="https://www.jetbrains.com/products/#type=ide">JetBrains IDE&lt;/a>.&lt;/p>
&lt;p>The way to open a file from the command line in the JetBrains IDE is the same for all of them, so will use &lt;a href="https://www.jetbrains.com/go/">Goland&lt;/a> as an example.
You can configure it on Windows, macOS, and Linux that are supported by the JetBrains IDE, but in this article, the only introduction to macOS.&lt;/p>
&lt;h2 id="create-a-shell-script">Create a shell script&lt;/h2>
&lt;p>Enables Goland to be run as a command.&lt;br>
Place the following files in a location where your PATH environment variable can find it(e.g. /usr/local/bin).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#!/bin/sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>open -na &lt;span style="color:#e6db74">&amp;#34;GoLand.app&amp;#34;&lt;/span> --args &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>@&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Grant the execute permissions.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ chmod +x /usr/local/bin/goland
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can rewrite the &lt;code>&amp;quot;Goland.app&amp;quot;&lt;/code> to &lt;code>&amp;quot;IntelliJ IDEA.app&amp;quot;&lt;/code> and change &lt;code>/usr/local/bin/goland&lt;/code> to &lt;code>/usr/local/bin/idea&lt;/code> to make the settings for IntelliJ IDEA.
If you want to use a different IDE, change it accordingly.&lt;/p>
&lt;p>Refer to the &lt;a href="https://www.jetbrains.com/help/go/working-with-the-ide-features-from-command-line.html#toolbox">manual&lt;/a> for instructions if you are using the &lt;a href="https://www.jetbrains.com/toolbox-app/">Toolbox App&lt;/a>.&lt;/p>
&lt;h2 id="open-files-from-the-command-line">Open files from the command line&lt;/h2>
&lt;p>The following command will open the file in Goland.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ goland nosplash /path/to/file
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>nosplash&lt;/code> is an option to prevent the splash screen from appearing when Goland is loaded.&lt;/p>
&lt;p>The command to open a file by specifying a line is as follows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ goland nosplash --line NUMBER /path/to/file
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="search-for-strings-and-open-matching-lines">Search for strings and open matching lines&lt;/h2>
&lt;p>Use &lt;a href="https://github.com/peco/peco">peco&lt;/a> for the command line selector and ag for string search (skip the details usage of each).
If you want to use pt, replace ag with pt.&lt;br>
Add the following function to your .bashrc or .zshrc and reload it.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>ag-goland&lt;span style="color:#f92672">()&lt;/span> &lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> local selected_line&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>ag &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>@&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span> | peco --query &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$LBUFFER&lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#f92672">[&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>selected_line&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span> !&lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span> &lt;span style="color:#f92672">]&lt;/span>; &lt;span style="color:#66d9ef">then&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#f92672">[&lt;/span> -f &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>2&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span> &lt;span style="color:#f92672">]&lt;/span>; &lt;span style="color:#66d9ef">then&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> goland nosplash --line &lt;span style="color:#66d9ef">$(&lt;/span>echo &lt;span style="color:#e6db74">${&lt;/span>selected_line&lt;span style="color:#e6db74">}&lt;/span> | awk -F&lt;span style="color:#e6db74">&amp;#39;:&amp;#39;&lt;/span> &lt;span style="color:#e6db74">&amp;#39;{print $1}&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span> &lt;span style="color:#e6db74">${&lt;/span>2&lt;span style="color:#e6db74">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> goland nosplash --line &lt;span style="color:#66d9ef">$(&lt;/span>echo &lt;span style="color:#e6db74">${&lt;/span>selected_line&lt;span style="color:#e6db74">}&lt;/span> | awk -F&lt;span style="color:#e6db74">&amp;#39;:&amp;#39;&lt;/span> &lt;span style="color:#e6db74">&amp;#39;{print $2, $1}&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">fi&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">fi&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If no file matches the string search, or if you stop the execution with Ctrl-C while selecting with peco, nothing will be done.
The second argument of ag is made to work with both directories and files, but the implementation is designed to specify only one file, so please be careful about that.&lt;/p>
&lt;p>The usage is as follows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ ag-goland PATTERN /path/to/dir
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ ag-goland PATTERN /path/to/file
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>This article was an introduction to searching for a string in a file and specify the matching line to open in Goland.&lt;br>
If you want to open a file within a project, you may not need to use it since you can do the same thing with the IDE functionality, but if you want to open a file by searching across various projects, you may be able to use it.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://www.jetbrains.com/help/go/working-with-the-ide-features-from-command-line.html">https://www.jetbrains.com/help/go/working-with-the-ide-features-from-command-line.html&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.jetbrains.com/help/go/opening-files-from-command-line.html">https://www.jetbrains.com/help/go/opening-files-from-command-line.html&lt;/a>&lt;/li>
&lt;/ul></content></item><item><title>Clear the container logs on Docker Desktop for Mac</title><link>https://blog.tkuchiki.net/en/clear-docker-for-mac-logs/</link><pubDate>Fri, 19 Oct 2018 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/clear-docker-for-mac-logs/</guid><description>This article is an introduction to clearing the container logs in Docker Desktop for Mac.
The version at the time of writing is Docker Desktop for Mac 3.2.2(61853).
About Docker Desktop for Mac You can run docker inspect to get the path to the container log file.
$ docker inspect CONTAINER_ID --format &amp;#34;{{.LogPath}}&amp;#34; /var/lib/docker/containers/3d0305c254c33ff5e78d675f45e60fdcef65937ed8b53e21baf07f818d34ce9b/3d0305c254c33ff5e78d675f45e60fdcef65937ed8b53e21baf07f818d34ce9b-json.log If you have dockerd and containerd running on the same host as the docker container on Linux, you can cleaer the logs with a command like the following:</description><content>&lt;p>This article is an introduction to clearing the container logs in Docker Desktop for Mac.&lt;br>
The version at the time of writing is Docker Desktop for Mac 3.2.2(61853).&lt;/p>
&lt;h2 id="about-docker-desktop-for-mac">About Docker Desktop for Mac&lt;/h2>
&lt;p>You can run &lt;code>docker inspect&lt;/code> to get the path to the container log file.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ docker inspect CONTAINER_ID --format &lt;span style="color:#e6db74">&amp;#34;{{.LogPath}}&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/var/lib/docker/containers/3d0305c254c33ff5e78d675f45e60fdcef65937ed8b53e21baf07f818d34ce9b/3d0305c254c33ff5e78d675f45e60fdcef65937ed8b53e21baf07f818d34ce9b-json.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If you have dockerd and containerd running on the same host as the docker container on Linux, you can cleaer the logs with a command like the following:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ sudo truncate &lt;span style="color:#66d9ef">$(&lt;/span>docker inspect CONTAINER_ID --format &lt;span style="color:#e6db74">&amp;#34;{{.LogPath}}&amp;#34;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span> --size &lt;span style="color:#ae81ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ sudo bash -c &lt;span style="color:#e6db74">&amp;#34;:&amp;gt; &lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>docker inspect CONTAINER_ID --format &lt;span style="color:#e6db74">&amp;#34;{{.LogPath}}&amp;#34;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>However, if you run &lt;code>docker inspect&lt;/code> on Docker Desktop for Mac on macOS, you can get the path to the log file, but you cannot clear the log using the above way because &lt;code>/var/lib/docker&lt;/code> is not present on macOS.
This is because running LinuxKit, a lightweight Linux, in a virtualized environment called HyperKit on macOS, and running containerd on it.&lt;/p>
&lt;pre tabindex="0">&lt;code>+------------+
| containerd |
+------------+
| LinuxKit |
+------------+
| HyperKit |
+------------+
| macOS |
+------------+
&lt;/code>&lt;/pre>&lt;p>If you need to clear the container logs in the Docker Desktop for Mac, you need to clear the log files on LinuxKit, not macOS.&lt;/p>
&lt;h2 id="connect-to-the-linuxkit">Connect to the LinuxKit&lt;/h2>
&lt;p>&lt;a href="https://docs.docker.com/docker-for-mac/release-notes/#docker-desktop-community-2400">https://docs.docker.com/docker-for-mac/release-notes/#docker-desktop-community-2400&lt;/a> says to open the shell with the following command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ nc -U ~/Library/Containers/com.docker.docker/Data/debug-shell.sock
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="clear-the-container-logs">Clear the container logs&lt;/h2>
&lt;p>Once you know how to connect, all you have to do is pipe the command to &lt;code>nc&lt;/code> to clear the log.
However, since you cannot run the &lt;code>docker&lt;/code> command on LinuxKit, you have to get the path to the log file by macOS.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ echo &lt;span style="color:#e6db74">&amp;#34;:&amp;gt; &lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>docker inspect CONTAINER_ID --format &lt;span style="color:#e6db74">&amp;#39;{{.LogPath}}&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">; exit&amp;#34;&lt;/span> | nc -U ~/Library/Containers/com.docker.docker/Data/debug-shell.sock
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Since it is hard to do this every time, it might be better to define a shell function.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>clear_docker_logs&lt;span style="color:#f92672">()&lt;/span> &lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#e6db74">&amp;#34;:&amp;gt; &lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>docker inspect &lt;span style="color:#e6db74">${&lt;/span>1&lt;span style="color:#e6db74">}&lt;/span> --format &lt;span style="color:#e6db74">&amp;#39;{{.LogPath}}&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">; exit&amp;#34;&lt;/span> | nc -U ~/Library/Containers/com.docker.docker/Data/debug-shell.sock
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>By running the above shell function, you can clear the log of the container with the container ID passed as an argument.
Note that if you are installing &lt;code>netcat&lt;/code> with &lt;code>brew&lt;/code>, you cannot use &lt;code>nc -U&lt;/code> and an error will occur. In that case, just run &lt;code>/usr/bin/nc&lt;/code> with the absolute path.&lt;/p>
&lt;h2 id="appendix">Appendix&lt;/h2>
&lt;p>&lt;a href="https://gist.github.com/BretFisher/5e1a0c7bcca4c735e716abf62afad389">https://gist.github.com/BretFisher/5e1a0c7bcca4c735e716abf62afad389&lt;/a> says an example of serial connection with &lt;code>socat&lt;/code> and &lt;code>screen&lt;/code>, which may be easier to use when doing something on LinuxKit.&lt;/p></content></item><item><title>Modify the value of max open files for the running process</title><link>https://blog.tkuchiki.net/en/modify-max-open-files-of-running-processes/</link><pubDate>Thu, 30 Aug 2018 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/modify-max-open-files-of-running-processes/</guid><description>Do you know how to modify the value of &amp;ldquo;max open files&amp;rdquo; for a running process? You can modify that it is using the command &amp;ldquo;prlimit&amp;rdquo;(You can also modify more than just &amp;ldquo;max open files&amp;rdquo;).
docker-prlimit-example makes it easy to try.
Run the following commands in order to connect to the docker container where the unicorn process is running.
$ git clone https://github.com/tkuchiki/docker-prlimit-example $ cd docker-prlimit-example $ docker build -t prlimit .</description><content>&lt;p>Do you know how to modify the value of &amp;ldquo;max open files&amp;rdquo; for a running process?
You can modify that it is using the command &lt;a href="https://man7.org/linux/man-pages/man1/prlimit.1.html">&amp;ldquo;prlimit&amp;rdquo;&lt;/a>(You can also modify more than just &amp;ldquo;max open files&amp;rdquo;).&lt;/p>
&lt;p>&lt;a href="https://github.com/tkuchiki/docker-prlimit-example">docker-prlimit-example&lt;/a> makes it easy to try.&lt;br>
Run the following commands in order to connect to the docker container where the unicorn process is running.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ git clone https://github.com/tkuchiki/docker-prlimit-example
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ cd docker-prlimit-example
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ docker build -t prlimit .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ docker run -d --rm prlimit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ docker exec -it &lt;span style="color:#66d9ef">$(&lt;/span>docker ps | grep prlimit | awk &lt;span style="color:#e6db74">&amp;#39;{print $1}&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span> bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Let&amp;rsquo;s run ps, you can see that the unicorn process is running.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# ps aux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root 1 1.2 1.1 102084 23336 ? Ssl 04:03 0:00 unicorn master -c unicorn_config.rb -E development -d -l0.0.0.0:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root 10 0.0 0.9 102084 19436 ? Sl 04:03 0:00 unicorn worker[0] -c unicorn_config.rb -E development -d -l0.0.0.0:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root 13 0.0 0.9 102084 19044 ? Sl 04:03 0:00 unicorn worker[1] -c unicorn_config.rb -E development -d -l0.0.0.0:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root 16 4.3 0.1 18500 3348 pts/0 Ss 04:04 0:00 bash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root 27 0.0 0.1 34396 2732 pts/0 R+ 04:04 0:00 ps aux
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now, try to modify &amp;ldquo;max open files&amp;rdquo; using &lt;code>prlimit&lt;/code>.&lt;br>
First, let&amp;rsquo;s run the following command to check the current value.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# prlimit --pid 1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RESOURCE DESCRIPTION SOFT HARD UNITS
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AS address space limit unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>CORE max core file size 0 unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>CPU CPU time unlimited unlimited seconds
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>DATA max data size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FSIZE max file size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>LOCKS max number of file locks held unlimited unlimited locks
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MEMLOCK max locked-in-memory address space 83968000 83968000 bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MSGQUEUE max bytes in POSIX mqueues 819200 819200 bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NICE max nice prio allowed to raise 0 0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NOFILE max number of open files 1048576 1048576 files
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NPROC max number of processes unlimited unlimited processes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RSS max resident set size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RTPRIO max real-time priority 0 0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RTTIME timeout for real-time tasks unlimited unlimited microsecs
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>SIGPENDING max number of pending signals 7862 7862 signals
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>STACK max stack size 8388608 unlimited bytes
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>NOFILE&lt;/code> line is the &amp;ldquo;max open files&amp;rdquo;.The soft limit / hard limit are both set to 1048576.&lt;br>
Modify the value of soft limit / hard limit to 1024.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# prlimit --pid 1 --nofile=1024:1024
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# prlimit --pid 1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RESOURCE DESCRIPTION SOFT HARD UNITS
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>AS address space limit unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>CORE max core file size 0 unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>CPU CPU time unlimited unlimited seconds
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>DATA max data size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FSIZE max file size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>LOCKS max number of file locks held unlimited unlimited locks
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MEMLOCK max locked-in-memory address space 83968000 83968000 bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MSGQUEUE max bytes in POSIX mqueues 819200 819200 bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NICE max nice prio allowed to raise 0 0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NOFILE max number of open files 1024 1024 files
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NPROC max number of processes unlimited unlimited processes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RSS max resident set size unlimited unlimited bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RTPRIO max real-time priority 0 0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RTTIME timeout for real-time tasks unlimited unlimited microsecs
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>SIGPENDING max number of pending signals 7862 7862 signals
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>STACK max stack size 8388608 unlimited bytes
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can see that the value has changed to 1024.&lt;/p>
&lt;p>Forking a process like a unicorn does not affect child processes.
The following command generates a &lt;code>prlimit&lt;/code> command that modifies the &amp;ldquo;max open files&amp;rdquo; for both the parent and child processes.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# PID=1; pids(){ echo $1; for p in $(ps --ppid $1 --no-heading | awk &amp;#39;{ print $1 }&amp;#39;); do echo $p; pids $p ; done ; }; pids $PID | uniq | xargs -I{} echo &amp;#34;prlimit --pid {} --nofile=65536:65536&amp;#34;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>prlimit --pid 1 --nofile=65536:65536
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>prlimit --pid 10 --nofile=65536:65536
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>prlimit --pid 13 --nofile=65536:65536
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>PID=1&lt;/code> is the PID of the parent process, and &lt;code>PID=10,13&lt;/code> are the child processes.
Why not just run &lt;code>prlimit&lt;/code> directly?
This is because &lt;code>prlimit&lt;/code> has a large impact when it fails, and I think it&amp;rsquo;s better to check it before running.
For example, if you mistakenly use &amp;ndash;nofile=1:1, the process will most likely not work properly.
If you only need to modify the child processes, please run the following command.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>root@b83fe16b540e:/app# PID=1; pids(){ for p in $(ps --ppid $1 --no-heading | awk &amp;#39;{ print $1 }&amp;#39;); do echo $p; pids $p ; done ; }; pids $PID | xargs -I{} echo &amp;#34;prlimit --pid {} --nofile=65536:65536&amp;#34;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>prlimit --pid 10 --nofile=65536:65536
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>prlimit --pid 13 --nofile=65536:65536
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="conclusion">Conclusion&lt;/h2>
&lt;p>This article was an introduction to how to use &lt;code>prlimit&lt;/code> to modify the value of &amp;ldquo;max open files&amp;rdquo;.&lt;br>
I hope this helps you!&lt;/p></content></item><item><title>Send multipart/form-data requests with Vegeta</title><link>https://blog.tkuchiki.net/en/vegeta-multipart-form/</link><pubDate>Sat, 14 Jul 2018 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/vegeta-multipart-form/</guid><description>Vegeta is an HTTP load testing tool written in Go.
When sending multipart/form-data requests in the API server benchmark, wrk requires writing lua to send the request. Vegeta could send the request easily without writing any code, so will share how to do it.
vegeta has the subcommands attack, report, and dump, with attack sending an HTTP Request. The -targets option of vegeta attack can send HTTP requests flexibly by specifying the text of the request header and request body.</description><content>&lt;p>&lt;a href="https://github.com/tsenart/vegeta">Vegeta&lt;/a> is an HTTP load testing tool written in Go.&lt;/p>
&lt;p>When sending multipart/form-data requests in the API server benchmark, &lt;a href="https://github.com/wg/wrk">wrk&lt;/a> requires writing lua to send the request.
Vegeta could send the request easily without writing any code, so will share how to do it.&lt;/p>
&lt;p>&lt;code>vegeta&lt;/code> has the subcommands &lt;code>attack&lt;/code>, &lt;code>report&lt;/code>, and &lt;code>dump&lt;/code>, with &lt;code>attack&lt;/code> sending an HTTP Request.
The &lt;code>-targets&lt;/code> option of &lt;code>vegeta attack&lt;/code> can send HTTP requests flexibly by specifying the text of the request header and request body.&lt;/p>
&lt;p>The following is an example of a file to specify for &lt;code>-targets&lt;/code>.&lt;/p>
&lt;pre tabindex="0">&lt;code>POST http://localhost:8080/api/path
Content-Type: multipart/form-data; boundary=vegetaboundary
@body.txt
&lt;/code>&lt;/pre>&lt;p>&lt;code>@body.txt&lt;/code> is the path to the file where the request body. You can write it as follows:&lt;/p>
&lt;pre tabindex="0">&lt;code>--vegetaboundary
Content-Disposition: form-data; name=&amp;#34;file&amp;#34;; filename=&amp;#34;dummy&amp;#34;
Content-Type: application/octet-stream
12345
--vegetaboundary--
&lt;/code>&lt;/pre>&lt;p>Once the file is created, run &lt;code>vegeta attack&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ vegeta attack -rate &lt;span style="color:#ae81ff">10&lt;/span> -duration 60s -targets targets.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can send multipart/form-data by writing the request body and request headers in text like this.&lt;br>
Vegeta writes the results of the &lt;code>attack&lt;/code> to a file, and when you pass the data to &lt;code>vegeta report&lt;/code>, it will output a report.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>$ vegeta attack ... &amp;gt; load_test.bin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ cat load_test.bin | vegeta report
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>You can run it as above.&lt;/p>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/tsenart/vegeta#targets-with-custom-headers">https://github.com/tsenart/vegeta#targets-with-custom-headers&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/tsenart/vegeta#targets-with-custom-bodies-and-headers">https://github.com/tsenart/vegeta#targets-with-custom-bodies-and-headers&lt;/a>&lt;/li>
&lt;/ul></content></item><item><title/><link>https://blog.tkuchiki.net/en/about/</link><pubDate>Sun, 01 Jul 2018 00:00:00 +0900</pubDate><guid>https://blog.tkuchiki.net/en/about/</guid><description>WHOAMI I am an SRE.
I ❤️ Shell Script and Go.</description><content>&lt;h2 id="whoami">WHOAMI&lt;/h2>
&lt;img loading="lazy" src="https://blog.tkuchiki.net/img/tkuchiki-icon.jpg" width="300" height="300" alt="tkuchiki icon" position="center" style="border-radius: 50%; margin-left: auto; margin-right: auto;" />
&lt;p>I am an SRE.&lt;/p>
&lt;p>I ❤️ Shell Script and Go.&lt;/p></content></item></channel></rss>