<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://blog.mparvin.me</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 00:13:16 GMT</lastBuildDate><atom:link href="https://blog.mparvin.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The best way of installing Docker on Linux]]></title><description><![CDATA[The best way of installing Docker is achieved when our criteria for Docker installation exist; these criteria include the following:
Docker installation best practice
1. Installing the latest version of DockerThe latest version is not necessarily the...]]></description><link>https://blog.mparvin.me/the-best-way-of-installing-docker-on-linux-40b46d1df1bc</link><guid isPermaLink="true">https://blog.mparvin.me/the-best-way-of-installing-docker-on-linux-40b46d1df1bc</guid><dc:creator><![CDATA[Mohammad Parvin]]></dc:creator><pubDate>Thu, 12 Nov 2020 11:02:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518283352/TaZepy3crA.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The best way of installing Docker is achieved when our criteria for Docker installation exist; these criteria include the following:</p>
<p>Docker installation best practice</p>
<p><strong>1. Installing the latest version of Docker</strong><br />The latest version is not necessarily the most secure version; the features included in the latest update may provide higher access for the hackers. However, its advantage over the other versions is that the old versions have several specific bugs.</p>
<p>When a (amateur or professional) hacker wants to review the system bugs, he/she first uses the specific and known bugs.<br />So, the most important criterion is the latest version of Docker.</p>
<p><strong>2. Quick installation</strong><br />Installation with the minimum commands and the least complexity is one of the favorable ways of installation for the server managers. As a server manager, you may need to set up various servers or install and configure various services. It is not rational to spend a lot of time for each service.</p>
<p>So, we use scripts or software such as Ansible for installing the services.</p>
<p><strong>3. Easy installation on all the Linux distributions</strong><br />If you have worked with different distributions of Linux, you have found that the software such as <strong>nginx</strong> can be installed in different ways in each Linux distribution.</p>
<blockquote>
<p>yum install nginx</p>
<p>apt install nginx # or apt-get install nginx</p>
</blockquote>
<h4 id="heading-the-best-way-of-installation">The best way of installation</h4>
<p>Regarding the above-mentioned factors, the best way of installation is to use the script provided by the Docker. This script can be installed by a download tool such as <strong><em>wget</em></strong> or <strong><em>curl</em></strong>.</p>
<p>In this way, the Docker is installed with a one-line command, and the latest version of Docker is installed on your server.</p>
<p>Note that you can install the Docker on Ubuntu servers by the following command; however, most of the Ubuntu repositories do not have the latest version of the software.</p>
<blockquote>
<p>apt install docker.io</p>
</blockquote>
<p>This script supports the following Linux distributions:</p>
<blockquote>
<p>Debian — Ubuntu — Raspbian — CentOS — Redhat — Fedora</p>
</blockquote>
<h4 id="heading-how-to-use-the-script">How to use the script</h4>
<p>Using this script is so simple.</p>
<p>You can view and download this script from <a target="_blank" href="https://get.docker.com">get.docker.com</a>.</p>
<p>Quick installation of Docker in Linux can be done by the following command.</p>
<blockquote>
<p>wget get.docker.com -qO - | sh</p>
</blockquote>
<p>With curl</p>
<blockquote>
<p>curl -sSL get.docker.com | sh</p>
</blockquote>
<p>After running, wget command usually provides some information about the server to be connected to that, the connection time, redirects, and downloads. This information cannot be observed by –q.</p>
<p><strong>-O</strong> is used for saving the website contents in a file; however by inserting — after that, the information appears in the output instead of the site.</p>
<p>In curl command, <strong>sS</strong> is used for not showing the unwanted information. <strong>–L</strong> is used for tracing the website route.</p>
<p>For example, <strong>get.docker.com</strong> is redirected to <a target="_blank" href="https://get.docker.com"><strong>https://get.docker.com</strong></a>.</p>
<p>If we do not use <strong>–L</strong>, the output will be null.</p>
<p>The second part of both the commands are the same; so that, <strong>| sh</strong> passes the output of the first command to sh command. So, the commands in the script are processed and run by Linux Shell one by one.</p>
]]></content:encoded></item><item><title><![CDATA[Introduction to JMeter]]></title><description><![CDATA[Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. Wikipedia (JMeter)

This tool is one of the most professional testing t...]]></description><link>https://blog.mparvin.me/introduction-to-jmeter-96c24748453b</link><guid isPermaLink="true">https://blog.mparvin.me/introduction-to-jmeter-96c24748453b</guid><dc:creator><![CDATA[Mohammad Parvin]]></dc:creator><pubDate>Tue, 20 Oct 2020 15:13:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518300334/ZLT8_7tPF.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p><strong>Apache JMeter</strong> is an <a target="_blank" href="https://en.wikipedia.org/wiki/Apache_Software_Foundation">Apache</a> <a target="_blank" href="https://en.wikipedia.org/wiki/Project">project</a> that can be used as a <a target="_blank" href="https://en.wikipedia.org/wiki/Load_testing">load testing</a> tool for analyzing and measuring the performance of a variety of services, with a focus on <a target="_blank" href="https://en.wikipedia.org/wiki/Web_application">web applications</a>. Wikipedia (<a target="_blank" href="https://en.wikipedia.org/wiki/Apache_JMeter">JMeter</a>)</p>
</blockquote>
<p>This tool is one of the most professional testing tools that possesses three characteristics of my favorite softwares:</p>
<ul>
<li>Firstly, it’s opensource</li>
<li>Second, it’s free</li>
<li>And third, it can be installed and launched on various operating systems</li>
</ul>
<p>Introduction to JMeter</p>
<p>Frequently, when I establish a web server, I test the server using JMeter once to find out how many clients can visit the website simultaneously.</p>
<p>Through JMeter we can test numerous protocols including FTP, HTTP, SMTP and LDAP, Even test a database server using JDBC.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518291361/7fJdSSkxp.png" alt /></p>
<p>JMeter listener lists</p>
<h4 id="heading-jmeter-sections"><strong>JMeter sections</strong></h4>
<p>As a result of close relationship between different parts of JMeter I decided to introduce the two main sections — test plan and thread group I mean — at the end in order to understand the concepts more efficient.</p>
<p><strong>Samplers</strong></p>
<p>Samplers are used to send a request to the destination server and as I explained above, we can send variety of requests.</p>
<p>The sampler used to send HTTP request is named after what it does, HTTP Request.</p>
<p><strong>Listeners</strong></p>
<p>Using listeners, we can observe all answers received from server.</p>
<p>It helps us to depict the output in different ways and achieve a good log of server.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518293408/KLalV1q9U.png" alt /></p>
<p>List of listeners</p>
<p>These three are the most efficient listeners for me:</p>
<ul>
<li>View results tree</li>
<li>Summary report</li>
<li>graph results</li>
</ul>
<p><strong>Assertions</strong></p>
<p>Assertions are used in order to make sure if recursive response from the server is right.</p>
<p>Based on this section, we can have more accurate information in the Samples section.</p>
<p>I took advantage of Response Assertion the most, which can examine the different sections of the recursive response from the server and tell us whether each of our requests sent to server has got a right response or not.</p>
<p>Fields like Response code become one of the renown HTTP response codes (200, 404, 500, etc.) when the sampler is Response code.</p>
<p>One of the other excellent assertions are Duration assertions, which uses server’s response time as an indicator of performance precision verification.</p>
<p>For instance, my API server is supposed to respond to client in 2 seconds tops, otherwise it will be useless.</p>
<p>So, I use duration assertion and assign the value 2000 for duration in milliseconds.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518295147/pBDzFVXd_.png" alt /></p>
<p>JMeter response assertion</p>
<p><strong>Timer</strong></p>
<p>Timer is used for making delay among samplers.</p>
<p>There are a variety of them like Constant timer which causes a constant delay between each request, or Gaussian Random Timer which causes a random duration of delay between each request.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518296897/pnMlpcLpZ.png" alt /></p>
<p>JMeter timers</p>
<p><strong>Thread group</strong></p>
<p>This is the most important part of the test which is the start point of it as well.</p>
<p>In this part we can define threads, which are in fact the virtual users, as well as rate of client addition, and the frequency of test execution.</p>
<p>All controllers and samplers should be under thread group.</p>
<p>The remaining elements like listeners can be defined directly under Test plan.</p>
<p><strong>Test plan</strong></p>
<p>As it’s apparent from the name, the test plan is designed in this section. In fact, all stages done by JMeter and all aforementioned factors should be defined in Test plan.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518298467/Fqf8lJdng.png" alt /></p>
<p>JMeter test plan config</p>
<p>In case various libraries or variables are going to be used, they should be added in Test plan.</p>
<p>An important option in test plan is use of functional test mode. In this mode, the data relating to responses and samplers are saved which is a bit slower than usual mode from performance point of view.</p>
<p>More complete information regarding test plan can be found on these pages on apache website:</p>
<ul>
<li><a target="_blank" href="https://jmeter.apache.org/usermanual/build-test-plan.html"><em>Build test plan</em></a></li>
<li><a target="_blank" href="https://jmeter.apache.org/usermanual/test_plan.html">Test plan</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Enable Night mode from CLI (Ubuntu)]]></title><description><![CDATA[Last year in my Ubuntu I enabled auto night mode, but some times I need to disable it.
Every time I use the keyboard and I don’t like to use the mouse when I typing with the keyboard.
I memorized most of the shortcuts in gnome and vim and use it.
For...]]></description><link>https://blog.mparvin.me/enable-night-mode-from-cli-ubuntu-b5bb639c23a</link><guid isPermaLink="true">https://blog.mparvin.me/enable-night-mode-from-cli-ubuntu-b5bb639c23a</guid><dc:creator><![CDATA[Mohammad Parvin]]></dc:creator><pubDate>Fri, 24 May 2019 21:09:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518306984/K4z3Hcc1t.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Last year in my Ubuntu I enabled auto night mode, but some times I need to disable it.</p>
<p>Every time I use the keyboard and I don’t like to use the mouse when I typing with the keyboard.</p>
<p>I memorized most of the shortcuts in gnome and vim and use it.</p>
<p>For example, when I want to open Firefox, instead of click on Activities and find Firefox icons in favourites icons, I use ALT+F2 then type</p>
<p>firefox example.com</p>
<p>Or to run play 2pac music type</p>
<p>2pac</p>
<p>Only disable and enable night mode was my trouble, sometimes when I change my web site CSS, I cannot saw the real colour, And I must disable night mode.</p>
<p>so I googled “How to enable Ubuntu night mode from CLI” and find these results(I cannot find which site I found these commands, because I found it in Jan 2018):</p>
<p>Enable night light #ubuntu from CLI:</p>
<p>$ gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true</p>
<p>to disable:<br />gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false</p>
<p>Oh my God, these are too long for typing.</p>
<p>I used alias instead these commands:</p>
<p>$ echo -e “\n alias nightmode=’gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true’” &gt;&gt; ~/.bashrc</p>
<p>$ echo -e “\n alias daymode=’gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false’” &gt;&gt; ~/.bashrc</p>
<p>$ source ~./bashrc</p>
<p>But these commands (nightmode, daymode) only worked in terminal, I knew aliases not work in ALT+F2 box, so I used commands into files in bin directory:</p>
<p>$ sudo echo 'gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true' &gt; /usr/bin/nightmode</p>
<p>$ sudo chmod +x  /usr/bin/nightmode</p>
<p>$ sudo echo 'gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false' &gt; /usr/bin/daymode</p>
<p>$ sudo chmod +x /usr/bin/daymode</p>
<p>I hope this trick is helpful for You ;)</p>
]]></content:encoded></item><item><title><![CDATA[Bulk resize photos in Bash]]></title><description><![CDATA[Some times We need to resize our photos.
I use bash for do it because it’s very fast and very customizable.
For example I need to resize All photos in folder “Pictures” (recursively) that names starts with “need_resize”.
This is not possible in some ...]]></description><link>https://blog.mparvin.me/bulk-resize-photos-in-bash-c52c4755f806</link><guid isPermaLink="true">https://blog.mparvin.me/bulk-resize-photos-in-bash-c52c4755f806</guid><dc:creator><![CDATA[Mohammad Parvin]]></dc:creator><pubDate>Thu, 26 Apr 2018 21:42:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518313831/O2x_FJcR_.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Some times We need to resize our photos.</p>
<p>I use bash for do it because it’s very fast and very customizable.</p>
<p>For example I need to resize All photos in folder “Pictures” (recursively) that names starts with “need_resize”.</p>
<p>This is not possible in some programs like Photoshop.</p>
<p>I use “convert” command from “ImageMagick” package to resize images.</p>
<p>Use this command to install it on</p>
<p>Ubuntu/Debian:</p>
<p>sudo apt-get install imagemagick</p>
<p>Redhat/Fedora/CentOS:</p>
<p>sudo yum install ImageMagick</p>
<p>The “convert” command can do this:<br />1. Converting images to another format</p>
<blockquote>
<p>convert Image.jpg Image.png<br />2. Resize images</p>
<p>convert Image.jpg -resize 400x300 Image_resized.jpg<br />3. Rotate images</p>
<p>convert Image.jpg -rotate 180 Image_rotated.jpg</p>
</blockquote>
<p>4. and etc, To know more about this command see manual page:</p>
<blockquote>
<p>man convert</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652518313831/O2x_FJcR_.png" alt /></p>
<p>Examples of convert command</p>
<ol>
<li>Resize all images in current folder to 400x300:</li>
</ol>
<p>## Not recursively</p>
<blockquote>
<p>for imageName in ` ls *.{jpg,png}`</p>
<p>do</p>
<p>convert $imageName -resize 400x300 $imageName_resized</p>
<p>done</p>
</blockquote>
<p>## Recursively</p>
<blockquote>
<p>for imageName in `find ./ -type f -iname *.jpg -o -iname *.png`</p>
<p>do</p>
<p>convert $imageName -resize 400x300 $imageName_resized</p>
<p>done</p>
</blockquote>
<p>2. Resize all images in folder that names starts with need_convert, Only change first line of above scripts to these:</p>
<p>## Not recursively</p>
<blockquote>
<p>for imageName in ` ls need_convert*.{jpg,png}`</p>
</blockquote>
<p>## Recursively</p>
<blockquote>
<p>for imageName in `find ./ -type f -iname need_convert*.jpg -o -iname need_convert*.png`</p>
<p>alternatively You can use only find command instead for:</p>
<p>find ./ -type f -iname “need_convert*.jpg” -o -iname “need_convert*.png” -exec sh -c ‘fileName=”{}”; convert “$fileName” -resize 400x300 “$fileName_resized”’ \;</p>
</blockquote>
<p>3. Convert all PNG files to JPEG:</p>
<blockquote>
<p>for imageName in `find ./ -type f -iname “*.png”`</p>
<p>do</p>
<p>newImageName=`echo $imageName | sed ‘s/png$/jpg/i’`</p>
<p>convert $imageName $newImageName</p>
<p>done</p>
</blockquote>
]]></content:encoded></item></channel></rss>