<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rahul negi</title>
    <description>The latest articles on DEV Community by rahul negi (@rahulnegi).</description>
    <link>https://dev.to/rahulnegi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F734237%2F197b72dd-633e-4e4a-8bb5-e4e342399e06.jpeg</url>
      <title>DEV Community: rahul negi</title>
      <link>https://dev.to/rahulnegi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahulnegi"/>
    <language>en</language>
    <item>
      <title>Automate your SSH logins with this .bat script for your private network.</title>
      <dc:creator>rahul negi</dc:creator>
      <pubDate>Thu, 10 Feb 2022 09:45:05 +0000</pubDate>
      <link>https://dev.to/rahulnegi/automate-your-ssh-logins-with-this-bat-script-for-your-private-network-1ddk</link>
      <guid>https://dev.to/rahulnegi/automate-your-ssh-logins-with-this-bat-script-for-your-private-network-1ddk</guid>
      <description>&lt;h2&gt;
  
  
  If you're work requires a lot of interactions with private servers, this might come handy.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;A simple bash script to automate your login process, really handful for backend-devs or Dev-Ops engineers&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get into it 
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Requirement :
&lt;/h3&gt;

&lt;p&gt;putty.exe &lt;br&gt;
"PuTTY" is open source software that is available with source code and is developed and supported by a group of volunteers. You can download PuTTY &lt;a href="https://www.putty.org/" rel="noopener noreferrer"&gt;here&lt;/a&gt;].&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I'm presenting scripts in 3 ways, use what suits your need best. All these scripts are available &lt;a href="https://github.com/rahulnegi20/Automate-ssh-logins" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Three ways
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Single server login
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the best method if you have mostly or only used one server, this is just one click away method.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@echo off
@REM Use this if you have single server to login only, provide your sysyem address to puty.exe below.

@REM Provide your system's address to the putty.exe here
set putty="C:\Program Files\PuTTY\putty.exe

@REM Provide your username@address here
set id=eclairs@192.xxx.xx.174

@REM Provide your password here
set password=passwrd@123

%putty% -pw %password% %id%

@echo 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  2. Enter the last three digits to your address. 
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This method is helpful if you have multiple machine in same network, you can just enter last three digits of the address.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@echo off
@REM Enter last three number of your server's IP address only to login.

@REM Provide your system's address to the putty.exe here
set putty="C:\Program Files\PuTTY\putty.exe

@REM Provide your username@address here
set id=eclairs@192.xxx.xx.174

@REM Provide your password here
set password=passwrd@123

set /p id="Enter the suffix of IP Address you want to login: "
%putty% -pw %password% %id%

@echo 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  3. Just enter a number .
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the best method if you have multiple logins, you can just create a hash-map type relation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9qghefbewe4vull5cfd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9qghefbewe4vull5cfd.png" alt="Automate ssh logins for your private network"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@echo off
@REM Provide your username@address here
set id1=hello@192.168.xx.145
set id2=candy@192.xxx.xxx.173
set id3=eclairs@192.xxx.xx.174

@REM Provide your password here
set password1=passwrd@123
set password2=mypassword@123
set password3=mypassword@123

echo 1 : %id1%
echo 2 : %id2%
echo 3 : %id3%

set /p id="Enter Number to the Address you want to login: "

@REM Provide your system's address to the putty.exe here
set putty="C:\Program Files\PuTTY\putty.exe"

if %id%==1 %putty% -pw %password1% %id1%
if %id%==2 %putty% -pw %password2% %id2%
if %id%==3 %putty% -pw %password3% %id3%

@echo


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That's it for now, though I want to mention one important thing which is, &lt;br&gt;
&lt;strong&gt;If you're desktop has multiple users, it is advisable to not store your password in the script instead use this to take input manually.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;set /p password="Enter password: "&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@echo off

@REM Provide your system's address to the putty.exe here 
set putty="C:\Program Files\PuTTY\putty.exe

@REM Provide your username@address here
set id=eclairs@192.xxx.xx.174

set /p password="Enter password: " 
%putty% -pw %password% %id%

@echo 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I know it kills the half the fun of automation but still security is must.&lt;/p&gt;

&lt;p&gt;Open to feedback and suggestions.&lt;br&gt;
&lt;em&gt;Thanks :') for reading.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ssh</category>
      <category>automation</category>
      <category>windows</category>
    </item>
    <item>
      <title>Why do the color values range from (0-255) only?</title>
      <dc:creator>rahul negi</dc:creator>
      <pubDate>Wed, 12 Jan 2022 16:40:34 +0000</pubDate>
      <link>https://dev.to/rahulnegi/why-do-the-color-values-range-from-0-255-only-10k8</link>
      <guid>https://dev.to/rahulnegi/why-do-the-color-values-range-from-0-255-only-10k8</guid>
      <description>&lt;h2&gt;
  
  
  Once upon a time...
&lt;/h2&gt;

&lt;p&gt;Someone asked me this question "Why do the color values range from 0-255 only?". &lt;/p&gt;

&lt;p&gt;I was surprised how I never noticed this small thing and began on a quest to know the &lt;strong&gt;Truth&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Not Surprisingly, the &lt;strong&gt;Truth&lt;/strong&gt; is so simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Truth
&lt;/h2&gt;

&lt;p&gt;Most of the screens use &lt;strong&gt;24 bits&lt;/strong&gt; RGB pixels, each pixel has three components in order of** Red, Green, Blue** leaving &lt;strong&gt;8 bits&lt;/strong&gt; for each color component. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1642002269352%2FHtYh6PvEI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1642002269352%2FHtYh6PvEI.png" alt="Screenshot (40).png"&gt;&lt;/a&gt;&lt;br&gt;
Check this RGB calculator  &lt;a href="https://www.w3schools.com/colors/colors_rgb.asp" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The minimum and maximum decimal number that can be represented through 8 bits is 0 and 255.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

00000000 (binary) = 0 (decimal)
11111111 (binary) = 255 (decimal) 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Each pixel component ranges through 256 different shades of their color (RGB), and each number just  sets the brightness/contrast of that pixel component resulting in&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;256 x 256 x 256 = 16777216 possible colors&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I hope you learned something new today, open to comments and suggestions. &lt;br&gt;
Thanks for reading the article. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
