<?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[Pranav Tripathi]]></title><description><![CDATA[Follow if you look forward to blogs around tech, my insights and views on different topics.]]></description><link>https://blogs.pranavtripathi.me</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 22:24:00 GMT</lastBuildDate><atom:link href="https://blogs.pranavtripathi.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Redis for Pub/Sub Messaging]]></title><description><![CDATA[Introduction
This blog is second installment of Redis in Action blog series and if you’ve read the first blog on Ratelimiting using Redis, you are aware of what Redis is and how it works as a versatile in-memory data store. Today we’re diving into on...]]></description><link>https://blogs.pranavtripathi.me/redis-for-pubsub</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/redis-for-pubsub</guid><category><![CDATA[Redis]]></category><category><![CDATA[PubSub]]></category><category><![CDATA[Microservices]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Wed, 02 Apr 2025 11:47:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1743594343373/a18b69ae-4416-48ec-ace1-e8a063668f2d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>This blog is second installment of Redis in Action blog series and if you’ve read the first blog on <a target="_blank" href="https://blogs.pranavtripathi.me/ratelimiting-using-redis">Ratelimiting using Redis</a>, you are aware of what Redis is and how it works as a versatile in-memory data store. Today we’re diving into one of the Redis’s most elegant features: <strong>Pub/Sub Messaging</strong>.</p>
<p>In the world of <a target="_blank" href="https://microservices.io/">microservices</a>, communicatio is everything. Services need to talk to each other without becoming tightly coupled, maintain stability under load and often exchange information in realtime. This is where Publish/Subscribe (Pub/Sub) pattern shines.</p>
<p>Pub/Sub is a messaging pattern where senders or publishers don’t send messages directly to the receivers. Instead, they publish messages to channels without knowledge of which subscribers might be listening. This decoupling is particularly valuable in distributed systems. For example, Reddit works on a similar pattern, where publishers posts in a subreddit (channel) without knowing which user or receiever will get that post and read it.</p>
<p>Redis offers a lightweight, blazing fast implementation of this pattern that can serve as a message broker between your microservices. Let’s see how it works and when it makes sense to use it.</p>
<p><img src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExc2VpZXByNHBobWRwZ2p5ZDlocXlma3g4eWI1cngzbG1jcGwwMmpveSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/lXu72d4iKwqek/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-core-concepts-of-redis-pubsub">Core concepts of Redis Pub/Sub</h2>
<h3 id="heading-redis-pubsub-basics">Redis Pub/Sub Basics</h3>
<p>The Pub/Sub mechanism in Redis revolves around these three simple concepts.</p>
<ul>
<li><p><strong>Channels:</strong> Named message routes (like subreddits on Reddit) eg. <code>user_signups</code> or <code>payment_events</code>.</p>
</li>
<li><p><strong>Publishers:</strong> Clients that send messages to specific channels</p>
</li>
<li><p><strong>Subscribers:</strong> Clients that listen for messages on one or more channels.</p>
</li>
</ul>
<p>When a publisher sends a message to a channel, Redis broadcasts that message to all subscribers of that channel in realtime. The operation is async, so publishers don’t wait for confirmations/acknowledgements that subscribers recieved the message.</p>
<p>The beauty of Redis Pub/Sub lies in the simplicity. The entire featues can be accessed with just a handful of commands:</p>
<pre><code class="lang-plaintext">PUBLISH channel message
SUBSCRIBE channel [channel ...]
PSUBSCRIBE pattern [pattern ...]
UNSUBSCRIBE [channel ...]
PUNSUBSCRIBE [pattern ...]
</code></pre>
<h3 id="heading-redis-vs-traditional-message-brokers">Redis vs Traditional Message Brokers</h3>
<p>Unlike heavyweight message brokers like <a target="_blank" href="https://www.rabbitmq.com/">RabbitMQ</a> and <a target="_blank" href="https://kafka.apache.org/">Apache Kafka</a>. Redis Pub/Sub is remarkably lightweight. Here’s the comparison:</p>
<h4 id="heading-strengths">Strengths</h4>
<ul>
<li><p><strong>Simplicity</strong>: Minimal config, and straighforward API</p>
</li>
<li><p><strong>Speed</strong>: Sub-millisecond latency for message delivery</p>
</li>
<li><p><strong>Integration</strong>: If you’re already using Redis, it’s one less system to maintain</p>
</li>
</ul>
<h4 id="heading-limitations">Limitations</h4>
<ul>
<li><p><strong>No persistance</strong>: Messages are only delivered to the currently connected subscribers</p>
</li>
<li><p><strong>No guaranteed delivery</strong>: If a subscriber is offline it misses the message</p>
</li>
<li><p><strong>No message queues</strong>: Messages can’t be processed later by reconnecting clients</p>
</li>
</ul>
<h3 id="heading-use-cases-for-redis-pubsub">Use cases for Redis Pub/Sub</h3>
<p>Redis Pub/Sub excels in scenarios requiring realtime messaging with minimal latency:</p>
<ul>
<li><p><strong>Realtime notifications</strong>: Chat applications, live dashboards, activity feeds</p>
</li>
<li><p><strong>Event driven microservices</strong>: Services reacting to events from other services</p>
</li>
<li><p><strong>IoT Applications</strong>: Distributing sensor data to multiple processing services</p>
</li>
<li><p><strong>Live monitoring systems</strong>: Broadcasting metrics to various visualization tools</p>
</li>
</ul>
<p><img src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExOHVtNTcxZXgydTc0bnBodjk5bzBoeGVwaW5mOGJndzBvMGJha3ZoMCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/d5pGYhWb3T1Hyyl8OB/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-designing-a-pubsub-system-with-redis">Designing a Pub/Sub System with Redis</h2>
<h3 id="heading-architecture-overview">Architecture Overview</h3>
<p>A typical Redis Pub/Sub architecture in a microservices environment looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1743581996091/c846c948-f1b5-45de-bc26-680102ee1e72.png" alt class="image--center mx-auto" /></p>
<p>Service A might be an order service publishing new orders, Service B a payment processor both publishing and consuming events, and Service C a notification service subscribing to relevant events.</p>
<h3 id="heading-scalability-considerations">Scalability Considerations</h3>
<p>Redis Pub/Sub scales horizontally on the subscriber side. You can have multiple instances of the same service subscribed to the same channel, and each will receive a copy of each message.</p>
<p>For high-volume systems, you can consider these strategies:</p>
<ul>
<li><p><strong>Channel segmentation</strong>: Use multiple fine-grained channels instead of a few broad ones</p>
</li>
<li><p><strong>Load distribution</strong>: For heavy publishing, Redis Cluster can distribute channels across nodes</p>
</li>
<li><p><strong>Multiple Redis instances</strong>: For complete isolation of different messaging domains</p>
</li>
</ul>
<h3 id="heading-lets-take-a-look-at-code-examples">Let’s take a look at code examples</h3>
<h4 id="heading-publisher-order-service">Publisher (Order Service):</h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> redis = <span class="hljs-built_in">require</span>(<span class="hljs-string">'redis'</span>);
<span class="hljs-keyword">const</span> publisher = redis.createClient();

<span class="hljs-comment">// When a new order is created</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">createOrder</span>(<span class="hljs-params">orderData</span>) </span>{
  <span class="hljs-comment">// Save order to database</span>
  <span class="hljs-keyword">const</span> orderId = saveToDatabase(orderData);

  <span class="hljs-comment">// Publish event to Redis</span>
  publisher.publish(<span class="hljs-string">'orders:created'</span>, <span class="hljs-built_in">JSON</span>.stringify({
    <span class="hljs-attr">id</span>: orderId,
    <span class="hljs-attr">amount</span>: orderData.amount,
    <span class="hljs-attr">customerId</span>: orderData.customerId,
    <span class="hljs-attr">timestamp</span>: <span class="hljs-built_in">Date</span>.now()
  }));

  <span class="hljs-keyword">return</span> orderId;
}
</code></pre>
<h4 id="heading-subscriber-notification-service">Subscriber (Notification service):</h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> redis = <span class="hljs-built_in">require</span>(<span class="hljs-string">'redis'</span>);
<span class="hljs-keyword">const</span> subscriber = redis.createClient();

subscriber.on(<span class="hljs-string">'message'</span>, <span class="hljs-function">(<span class="hljs-params">channel, message</span>) =&gt;</span> {
  <span class="hljs-keyword">if</span> (channel === <span class="hljs-string">'orders:created'</span>) {
    <span class="hljs-keyword">const</span> order = <span class="hljs-built_in">JSON</span>.parse(message);
    sendOrderConfirmationEmail(order.customerId, order.id, order.amount);
  }
});

subscriber.subscribe(<span class="hljs-string">'orders:created'</span>);
</code></pre>
<h2 id="heading-best-practices-and-patterns">Best Practices and Patterns</h2>
<h3 id="heading-channel-naming-conventions">Channel Naming Conventions</h3>
<p>A good naming convention makes your system easier to understand and maintain:</p>
<ul>
<li><p><strong>Hierarchical structure</strong>: <code>domain:entity:action</code> (e.g., <code>orders:payment:succeeded</code>)</p>
</li>
<li><p><strong>Service-oriented</strong>: <code>service-name:event-type</code> (e.g., <code>payment-service:refund-processed</code>)</p>
</li>
<li><p><strong>Versioning</strong>: Add version when message formats might change (e.g., <code>users:created:v1</code>)</p>
</li>
</ul>
<h3 id="heading-security">Security</h3>
<p>Redis Pub/Sub transmits messages in plaintext by default. For secure setups:</p>
<ul>
<li><p>Use Redis ACLs to restrict which clients can publish/subscribe to which channels</p>
</li>
<li><p>Enable TLS for encrypted communication between Redis and clients</p>
</li>
<li><p>Keep Redis servers in a private network, accessible only to your services</p>
</li>
</ul>
<h3 id="heading-monitoring-and-debugging">Monitoring and Debugging</h3>
<p>Redis provides with simple commands to inspect the Pub/Sub Activity</p>
<pre><code class="lang-plaintext"># List all active channels with subscribers
PUBSUB CHANNELS

# Count subscribers for specific channels
PUBSUB NUMSUB channel1 channel2

# Count pattern subscribers
PUBSUB NUMPAT
</code></pre>
<p>For comprehensive monitoring:</p>
<ul>
<li><p>Use Redis INFO command to track overall Pub/Sub memory usage</p>
</li>
<li><p>Implement client-side metrics for message volumes and processing times</p>
</li>
<li><p>Log channel activity for debugging and auditing</p>
</li>
</ul>
<h3 id="heading-performance-optimization">Performance Optimization</h3>
<p>To get the most out of Redis Pub/Sub:</p>
<ul>
<li><p><strong>Keep messages small</strong>: Large messages consume more bandwidth and memory</p>
</li>
<li><p><strong>Avoid blocking operations</strong>: Subscriber callbacks should be quick and non-blocking</p>
</li>
<li><p><strong>Use pattern matching judiciously</strong>: <code>PSUBSCRIBE</code> with wildcards is powerful but more resource-intensive</p>
</li>
</ul>
<h2 id="heading-real-world-example-microservice-in-action">Real World Example: Microservice in action</h2>
<p>I'll walk you through an example of an ecommerce which processes order using Redis Pub/Sub.</p>
<h3 id="heading-the-players">The Players</h3>
<ul>
<li><p><strong>Order Service</strong>: Creates new orders and publishes <code>orders:created</code> events</p>
</li>
<li><p><strong>Payment Service</strong>: Processes payments and publishes <code>payments:completed</code> events</p>
</li>
<li><p><strong>Inventory Service</strong>: Updates stock levels based on order events</p>
</li>
<li><p><strong>Notification Service</strong>: Sends emails based on various events</p>
</li>
<li><p><strong>Analytics Service</strong>: Tracks business metrics based on all events</p>
</li>
</ul>
<h3 id="heading-the-flow">The Flow</h3>
<ol>
<li><p>Customer places an order through the web app</p>
</li>
<li><p>Order Service saves the order and publishes <code>orders:created</code> with order details</p>
</li>
<li><p>Payment Service receives the event, processes payment, then publishes <code>payments:completed</code></p>
</li>
<li><p>Inventory Service receives both events, first marking items as reserved, then confirming deduction</p>
</li>
<li><p>Notification Service sends order confirmation after <code>orders:created</code> and payment confirmation after <code>payments:completed</code></p>
</li>
<li><p>Analytics Service silently collects all events to update dashboards</p>
</li>
</ol>
<p>This decoupled architecture allows each service to focus on its core responsibilities without direct dependencies on other services.</p>
<h2 id="heading-when-to-use-and-avoid-redis-pubsub">When to use (and avoid) Redis Pub/Sub</h2>
<h3 id="heading-ideal-scenarios">Ideal Scenarios</h3>
<p>Redis Pub/Sub is perfect for:</p>
<ul>
<li><p><strong>Real-time updates</strong>: When speed matters more than guaranteed delivery</p>
</li>
<li><p><strong>Broadcast notifications</strong>: When many services need the same information</p>
</li>
<li><p><strong>System status changes</strong>: Broadcasting state changes across a distributed system</p>
</li>
<li><p><strong>Non-critical events</strong>: Where occasional missed messages are acceptable</p>
</li>
</ul>
<h3 id="heading-when-to-consider-alternatives">When to consider alternatives</h3>
<p>Look elsewhere when you need:</p>
<ul>
<li><p><strong>Guaranteed delivery</strong>: Consider Redis Streams, RabbitMQ, or Kafka</p>
</li>
<li><p><strong>Message persistence</strong>: Redis Streams or a dedicated message broker</p>
</li>
<li><p><strong>Complex routing logic</strong>: RabbitMQ's exchanges and bindings</p>
</li>
<li><p><strong>Exactly-once processing</strong>: Systems with robust message acknowledgment and deduplication</p>
</li>
</ul>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExMzU4MHF5MTg1azBsaHZwcW0xY3RjZGlhaW14OWZpemx6ajBhano3NSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xT1XGzgkBT1IdfMbDi/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Redis Pub/Sub offers a refreshingly simple approach to event-driven communication in microservice architectures. Its minimal API, blazing speed, and seamless integration with existing Redis deployments make it an attractive option for many real-time messaging needs.</p>
<p>While it won't replace full-featured message brokers for complex or mission-critical messaging, Redis Pub/Sub finds its sweet spot in scenarios where simplicity and performance are paramount. It's the lightweight champion of real-time messaging.</p>
<p>Until then, I encourage you to experiment with Redis Pub/Sub in your own projects. Start small, perhaps with a notification system or real-time dashboard, and experience firsthand the elegant simplicity it brings to service communication.</p>
<h2 id="heading-some-additional-resources">Some Additional Resources</h2>
<ul>
<li><p><a target="_blank" href="https://redis.io/docs/manual/pubsub/">Redis Pub/Sub official documentation</a></p>
</li>
<li><p><a target="_blank" href="https://university.redis.com/">Redis University</a></p>
</li>
<li><p>Previous posts in this series</p>
<ul>
<li><a target="_blank" href="https://blogs.pranavtripathi.me/ratelimiting-using-redis">Ratelimiting using Redis</a></li>
</ul>
</li>
</ul>
<p><img src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExNTdqdmxuN2tnNjh1ZTdwcThibHIyNW05Mnk1MnoxdHNodXpndm5zMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/tTQV0ts7ZV5N12M0VS/giphy.gif" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Mastering PowerShell Profiles]]></title><description><![CDATA[Introduction
PowerShell isn’t just a command line tool—It’s the Swiss Army knife of windows automation. Whether you’re managing files, deploying apps, or wrangling servers. But did you know you can make it even better? PowerShell Profiles; your secre...]]></description><link>https://blogs.pranavtripathi.me/powershell</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/powershell</guid><category><![CDATA[Windows]]></category><category><![CDATA[Powershell]]></category><category><![CDATA[PowerShell Automation]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Thu, 13 Mar 2025 12:30:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/T01GZhBSyMQ/upload/ecd726d6b77b14c092e06b4130ee37ee.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExajQ3YWRtY3duazU1ZGNhZWdpb3AzZHBkOXp0c2xvcHVhZXVibW5pMCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/Ch1zCx8tu6DQY/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-introduction">Introduction</h2>
<p>PowerShell isn’t just a command line tool—It’s the Swiss Army knife of windows automation. Whether you’re managing files, deploying apps, or wrangling servers. But did you know you can make it even better? <strong><em>PowerShell Profiles;</em></strong> your secret weapon for aliases, shortcuts and automation spells.</p>
<p>Think of it like an automation script that runs everytime you launch PowerShell. Customize it, and it’ll unlock:</p>
<ul>
<li><p>Productivity boosts (type less, do more!)</p>
</li>
<li><p>Personalized workflows (goodbye, repetitive tasks!)</p>
</li>
<li><p>A terminal that feels like home (rainbow prompts, anyone?)</p>
</li>
</ul>
<p>Let’s dive in!</p>
<h2 id="heading-what-is-powershell-profile">What is PowerShell profile?</h2>
<p>A PowerShell profile is a script file (<code>.ps1</code>) that runs automatically when you start a PowerShell session. It’s where you stash your favorite aliases, functions, and settings—like a “Welcome to My World” banner for your terminal.</p>
<p>There are <strong>four types of profiles</strong>, depending on scope:</p>
<ol>
<li><p>All users, All hosts</p>
<p> This profile applies to all users and all PowerShell hosts on the system. It is located at <code>$PsHome\Profile.ps1</code>.</p>
</li>
<li><p>All users, Current host</p>
<p> This profile applies to all users but only to the specific PowerShell host (e.g., console or ISE). It is located at <code>$PsHome\Microsoft.PowerShell_profile.ps1</code>.</p>
</li>
<li><p>Current user, All hosts</p>
<p> This profile applies to the current user for all PowerShell hosts. It is located at <code>$Home\Documents\Profile.ps1</code> (or <code>$Home\My Documents\Profile.ps1</code> in older versions).</p>
</li>
<li><p>Current user, Current host</p>
<p> This profile applies to the current user and the specific PowerShell host. For the console, it is located at <code>$Home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1</code>. For the ISE, it is located at <code>$Home\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1</code>.</p>
</li>
</ol>
<p>The <code>$profile</code> variable in PowerShell contains the paths to these profiles. When PowerShell starts, it executes these profiles in a specific order, if they exist.</p>
<p>Check if you already have a profile:</p>
<pre><code class="lang-powershell"><span class="hljs-built_in">Test-Path</span> <span class="hljs-variable">$PROFILE</span>
</code></pre>
<p>If it returns <code>False</code>, time to create one!</p>
<p><img src="https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExMmFlODNlZzlpNDBieDV4dWQ1aW9wb3FsbDBidDA0NGl3Yjl5NzIzdyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/NS7gPxeumewkWDOIxi/giphy.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-creating-a-powershell-profile">Creating a PowerShell profile</h2>
<p>No profile? No problem! Run this.</p>
<pre><code class="lang-powershell"><span class="hljs-built_in">New-Item</span> <span class="hljs-literal">-Path</span> <span class="hljs-variable">$PROFILE</span> <span class="hljs-literal">-ItemType</span> File <span class="hljs-literal">-Force</span>
</code></pre>
<p>This will create the <code>ps1</code> file for the profile on the location where it should be.</p>
<p>Now, edit it with Notepad (for the brave) or VS Code (for the fancy).</p>
<pre><code class="lang-powershell">notepad <span class="hljs-variable">$PROFILE</span> <span class="hljs-comment"># Classic Vibes</span>
code <span class="hljs-variable">$PROFILE</span>    <span class="hljs-comment"># Modern Flair</span>
</code></pre>
<h2 id="heading-customizing-your-powershell-profile">Customizing your PowerShell Profile</h2>
<p>Here’s where the fun begins!</p>
<ol>
<li><h3 id="heading-aliases-shortcuts-for-lazy-typists">Aliases: Shortcuts for Lazy Typists</h3>
<p> Turn <code>Get-ChildItem</code> into <code>ll</code> (because life’s short):</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-built_in">Set-Alias</span> ll <span class="hljs-built_in">Get-ChildItem</span>
</code></pre>
<p>Now <code>ll</code> lists your files.</p>
<ol start="2">
<li><h3 id="heading-auto-load-modules">Auto-Load modules:</h3>
<p> Hate typing <code>Import-Module Az</code> everytime? Add it to your profile:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-built_in">Import-Module</span> Az <span class="hljs-comment"># Azure admins, rejoice</span>
</code></pre>
<ol start="3">
<li><h3 id="heading-custom-functions">Custom functions</h3>
<p> Create a function to nuke temp files:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Clear-TempFiles</span></span> {  
    <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">"Blasting junk into oblivion..."</span> <span class="hljs-literal">-ForegroundColor</span> Red  
    <span class="hljs-built_in">Remove-Item</span> <span class="hljs-literal">-Path</span> <span class="hljs-variable">$env:TEMP</span>\* <span class="hljs-literal">-Recurse</span> <span class="hljs-literal">-Force</span>  
}
</code></pre>
<p>Run <code>Clear-TempFiles</code> anytime.</p>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExdGF3Zzc3cTI3OWp4Mzk1dmlvbXR2bWI5c253eDd1cGxkNjdvd2I4cSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/Rk886EfhYyITeWbyKM/giphy.gif" alt class="image--center mx-auto" /></p>
<ol start="4">
<li><h3 id="heading-fancy-prompts">Fancy Prompts</h3>
<p> Make your prompt glow like a neon sign:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">prompt</span></span> {  
    <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">"[<span class="hljs-variable">$</span>(Get-Date -Format 'HH:mm:ss')]"</span> <span class="hljs-literal">-NoNewline</span> <span class="hljs-literal">-ForegroundColor</span> Cyan  
    <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">" PS <span class="hljs-variable">$env:USERNAME</span>@"</span> <span class="hljs-literal">-NoNewline</span> <span class="hljs-literal">-ForegroundColor</span> Magenta  
    <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">"<span class="hljs-variable">$env:COMPUTERNAME</span> &gt;"</span> <span class="hljs-literal">-ForegroundColor</span> Yellow  
    <span class="hljs-keyword">return</span> <span class="hljs-string">" "</span>  
}
</code></pre>
<h2 id="heading-managing-and-securing-your-profile">Managing and Securing your profile</h2>
<ol>
<li><h3 id="heading-secure-credential-storage">Secure credential storage</h3>
<p> Never hardcode passwords! Use PowerShell’s <code>SecretManagement</code> module or encrypted files:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-comment"># Save credentials securely (uses Windows Data Protection API)  </span>
<span class="hljs-variable">$credential</span> = <span class="hljs-built_in">Get-Credential</span>  
<span class="hljs-variable">$credential</span> | <span class="hljs-built_in">Export-CliXml</span> <span class="hljs-literal">-Path</span> <span class="hljs-string">"<span class="hljs-variable">$env:USERPROFILE</span>\secure_cred.xml"</span>  

<span class="hljs-comment"># Load credentials later  </span>
<span class="hljs-variable">$storedCred</span> = <span class="hljs-built_in">Import-CliXml</span> <span class="hljs-literal">-Path</span> <span class="hljs-string">"<span class="hljs-variable">$env:USERPROFILE</span>\secure_cred.xml"</span>
</code></pre>
<p><img src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExeGh2NTlwbzhsc3A0cHRjNHo2Z3U2M3NnNXBxbmZoZHp3cnhob2dheiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/of9TaQAGMCgYQWqB3D/giphy.gif" alt class="image--center mx-auto" /></p>
<ol start="2">
<li><h3 id="heading-azure-key-vault-integration">Azure Key Vault Integration</h3>
<p> For cloud users, fetch secrets dynamically from Azure Key Vault:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-comment"># Ensure Az module is imported first  </span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Get-MySecret</span></span> {  
    <span class="hljs-keyword">param</span> (<span class="hljs-variable">$SecretName</span>)  
    <span class="hljs-variable">$secret</span> = <span class="hljs-built_in">Get-AzKeyVaultSecret</span> <span class="hljs-literal">-VaultName</span> <span class="hljs-string">"MyVault"</span> <span class="hljs-literal">-Name</span> <span class="hljs-variable">$SecretName</span> <span class="hljs-literal">-AsPlainText</span>  
    <span class="hljs-keyword">return</span> <span class="hljs-variable">$secret</span>  
}  

<span class="hljs-comment"># Usage:  </span>
<span class="hljs-variable">$apiKey</span> = <span class="hljs-built_in">Get-MySecret</span> <span class="hljs-literal">-SecretName</span> <span class="hljs-string">"ProdAPIKey"</span>
</code></pre>
<ol start="3">
<li><h3 id="heading-environment-variables-for-sensitive-data">Environment Variables for Sensitive Data</h3>
<p> Store tokens in environment variables (safer than plain text in scripts):</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-comment"># Set via PowerShell (temporary)  </span>
<span class="hljs-variable">$env:GITHUB_TOKEN</span> = <span class="hljs-string">"ghp_abc123"</span>  

<span class="hljs-comment"># Or permanently in Windows:  </span>
[<span class="hljs-type">System.Environment</span>]::SetEnvironmentVariable(<span class="hljs-string">'GITHUB_TOKEN'</span>, <span class="hljs-string">'ghp_abc123'</span>, <span class="hljs-string">'User'</span>)
</code></pre>
<h2 id="heading-advanced-use-cases-for-power-users">Advanced Use Cases for Power Users</h2>
<ol>
<li><h3 id="heading-automated-ssh-connections-with-logging">Automated SSH connections with logging</h3>
<p> Log SSH sessions and automate connections:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Connect-DevServer</span></span> {  
    <span class="hljs-variable">$session</span> = <span class="hljs-built_in">New-SSHSession</span> <span class="hljs-literal">-ComputerName</span> <span class="hljs-string">"dev.example.com"</span> <span class="hljs-literal">-Credential</span> <span class="hljs-variable">$storedCred</span>  
    <span class="hljs-built_in">Start-SSHStream</span> <span class="hljs-literal">-SessionId</span> <span class="hljs-variable">$session</span>.SessionId <span class="hljs-literal">-ShellStream</span> <span class="hljs-string">"DevSession"</span>  

    <span class="hljs-comment"># Log the session  </span>
    <span class="hljs-variable">$timestamp</span> = <span class="hljs-built_in">Get-Date</span> <span class="hljs-literal">-Format</span> <span class="hljs-string">"yyyyMMdd-HHmmss"</span>  
    <span class="hljs-built_in">Start-Transcript</span> <span class="hljs-literal">-Path</span> <span class="hljs-string">"<span class="hljs-variable">$env:USERPROFILE</span>\ssh_logs\<span class="hljs-variable">$timestamp</span>.txt"</span>  
}
</code></pre>
<ol start="2">
<li><h3 id="heading-custom-command-logging">Custom Command Logging</h3>
<p> Track every command you run in a searchable JSON file:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-variable">$global:CommandHistoryPath</span> = <span class="hljs-string">"<span class="hljs-variable">$env:USERPROFILE</span>\ps_history.json"</span>  

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Log-Command</span></span> {  
    <span class="hljs-keyword">param</span> (<span class="hljs-variable">$command</span>)  
    <span class="hljs-variable">$logEntry</span> = <span class="hljs-selector-tag">@</span>{  
        Timestamp = <span class="hljs-built_in">Get-Date</span> <span class="hljs-literal">-Format</span> <span class="hljs-string">"o"</span>  
        Command   = <span class="hljs-variable">$command</span>  
        User      = <span class="hljs-variable">$env:USERNAME</span>  
        Host      = <span class="hljs-variable">$env:COMPUTERNAME</span>  
    } | <span class="hljs-built_in">ConvertTo-Json</span>  

    <span class="hljs-built_in">Add-Content</span> <span class="hljs-literal">-Path</span> <span class="hljs-variable">$global:CommandHistoryPath</span> <span class="hljs-literal">-Value</span> <span class="hljs-variable">$logEntry</span>  
}  

<span class="hljs-comment"># Override the default Add-History to log  </span>
<span class="hljs-variable">$originalAddHistory</span> = <span class="hljs-built_in">Get-Command</span> <span class="hljs-built_in">Add-History</span>  
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Add-History</span></span> {  
    <span class="hljs-keyword">param</span>([<span class="hljs-built_in">string</span>[]]<span class="hljs-variable">$Lines</span>)  
    <span class="hljs-variable">$Lines</span> | <span class="hljs-built_in">ForEach-Object</span> { Log<span class="hljs-literal">-Command</span> <span class="hljs-variable">$_</span> }  
    &amp; <span class="hljs-variable">$originalAddHistory</span> @PSBoundParameters  
}
</code></pre>
<ol start="3">
<li><h3 id="heading-dynamic-environment-switcher">Dynamic Environment Switcher</h3>
<p> Auto-load AWS/Azure/GCP profiles based on your current project folder:</p>
</li>
</ol>
<pre><code class="lang-powershell"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Set-CloudEnv</span></span> {  
    <span class="hljs-keyword">param</span> (<span class="hljs-variable">$Environment</span>)  

    <span class="hljs-keyword">switch</span> (<span class="hljs-variable">$Environment</span>) {  
        <span class="hljs-string">"AWS-Prod"</span> {  
            <span class="hljs-variable">$env:AWS_ACCESS_KEY_ID</span> = (<span class="hljs-built_in">Get-MySecret</span> <span class="hljs-literal">-SecretName</span> <span class="hljs-string">"AWSProdKey"</span>)  
            <span class="hljs-variable">$env:AWS_SECRET_ACCESS_KEY</span> = (<span class="hljs-built_in">Get-MySecret</span> <span class="hljs-literal">-SecretName</span> <span class="hljs-string">"AWSProdSecret"</span>)  
            <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">"AWS Production environment loaded!"</span> <span class="hljs-literal">-ForegroundColor</span> Yellow  
        }  
        <span class="hljs-string">"Azure-Dev"</span> {  
            <span class="hljs-built_in">Connect-AzAccount</span> <span class="hljs-literal">-Credential</span> <span class="hljs-variable">$storedCred</span>  
            <span class="hljs-built_in">Set-AzContext</span> <span class="hljs-literal">-SubscriptionId</span> <span class="hljs-string">"12345-abcde"</span>  
            <span class="hljs-built_in">Write-Host</span> <span class="hljs-string">"Azure Dev environment loaded!"</span> <span class="hljs-literal">-ForegroundColor</span> Cyan  
        }  
    }  
}
</code></pre>
<h2 id="heading-some-security-tips">Some security tips</h2>
<ul>
<li><p><strong>Rotate credentials regularly</strong>: Automate token refreshes with Azure AD or AWS IAM roles.</p>
</li>
<li><p><strong>Audit your profile</strong>: Use <code>Unblock-File $PROFILE</code> if scripts are blocked by Windows.</p>
</li>
<li><p><strong>Use JEA (Just Enough Administration)</strong>: Restrict PowerShell capabilities for non-admin users.</p>
</li>
</ul>
<p><img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExYXMzYXpoNnpyNWg3dThyendzZHAwYmFlcGVveDd4b3RxYmZrMzFudSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/Me7Jvz4x9RA4dpV9sS/giphy.gif" alt class="image--center mx-auto" /></p>
<p>Experiment with these snippets, and remember: <strong>with great power comes great automation!</strong> 🔥</p>
]]></content:encoded></item><item><title><![CDATA[Ratelimiting using Redis]]></title><description><![CDATA[What is Rate limiting and why do we need it?
Rate limiting is a technique used to control the number of requests a client can make to a server within a specified time frame. It helps prevent abuse, ensures fair resource distribution, and maintains sy...]]></description><link>https://blogs.pranavtripathi.me/ratelimiting-using-redis</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/ratelimiting-using-redis</guid><category><![CDATA[Redis]]></category><category><![CDATA[Go Language]]></category><category><![CDATA[gin-gonic]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Thu, 06 Mar 2025 12:04:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/yLDabpoCL3s/upload/9411fffc52e0b52d783c45456a5e41f2.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-rate-limiting-and-why-do-we-need-it">What is Rate limiting and why do we need it?</h2>
<p>Rate limiting is a technique used to control the number of requests a client can make to a server within a specified time frame. It helps prevent abuse, ensures fair resource distribution, and maintains system stability.</p>
<p><img src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExb29qNDBjcGx5d3RrMzVscDRvNjlyaXBuNmlpaHQ3azBkczAyZWs3YyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/UF64wV0ebjs2Y/giphy.gif" alt class="image--center mx-auto" /></p>
<ol>
<li><p><strong>Prevents API abuse:</strong> Stops users and bots to from overwhelming the server with excessive requests.</p>
</li>
<li><p><strong>Protects from attacks:</strong> Enhances security to protect from brute force attacks and Denial of Service (DoS) attacks.</p>
</li>
<li><p><strong>Controls costs:</strong> Helps in avoiding excessive costs on resource consumption, reducing operational costs.</p>
</li>
</ol>
<h2 id="heading-pre-requisites">Pre-requisites</h2>
<p>This is a very simple implementation of rate limiting, which can be improved upon a lot. But this can save your side projects to be heavily bombarded from excessive API calls.</p>
<p>Things you need to implement this:</p>
<ul>
<li><p>Redis up and running (locally using docker or using any cloud service like <a target="_blank" href="https://upstash.com/">upstash</a>)</p>
</li>
<li><p>Golang and Gin (because Go’s default <code>net/http</code> is like building IKEA furniture without instructions)</p>
</li>
</ul>
<h2 id="heading-lets-implement">Let’s implement</h2>
<ol>
<li><h3 id="heading-install-dependencies">Install dependencies</h3>
<p> These are the dependencies we need for our ratelimiting middleware to work.</p>
</li>
</ol>
<pre><code class="lang-bash">go get github.com/gin-gonic/gin
go get github.com/go-redis/redis/v8
</code></pre>
<ol start="2">
<li><h3 id="heading-connect-to-redis">Connect to Redis 🏓</h3>
<p> Let’s code to connect to redis.</p>
<p> This code is to connect with redis when you have running it locally using docker or have a redis server on your PC.</p>
</li>
</ol>
<pre><code class="lang-go"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">ConnectRedis</span><span class="hljs-params">()</span> <span class="hljs-title">error</span></span> {
    redisClient = redis.NewClient(&amp;redis.Options{
        Addr:     <span class="hljs-string">"localhost:6379"</span>, <span class="hljs-comment">// Redis' home address</span>
        Password: <span class="hljs-string">""</span>,               <span class="hljs-comment">// No password? You can set your own password</span>
        DB:       <span class="hljs-number">0</span>,                <span class="hljs-comment">// The VIP database</span>
    })

    <span class="hljs-comment">// Send a "PING" to check if Redis is awake</span>
    pong, err := redisClient.Ping(ctx).Result()
    <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
        log.Fatalf(<span class="hljs-string">"Redis connection failed harder than my diet on Thanksgiving: %v"</span>, err)
    }
    fmt.Println(<span class="hljs-string">"Redis says:"</span>, pong) <span class="hljs-comment">// "PONG!" means you're in business!</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">nil</span>
}
</code></pre>
<p>But what if you have it up in the cloud using some service provider like upstash. Then change the fields <code>Addr</code> and <code>Password</code> to the ones you have from your provider, and add <a target="_blank" href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/">TLS</a> config (it’s necessary)<br />Then the function for connecting to redis will look like this.  </p>
<pre><code class="lang-go"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">ConnectRedis</span><span class="hljs-params">()</span> <span class="hljs-title">error</span></span> {
    redisClient = redis.NewClient(&amp;redis.Options{
        Addr:     <span class="hljs-string">"your-upstash-endpoint:6379"</span>, <span class="hljs-comment">// Replace with your Upstash Redis endpoint</span>
        Password: <span class="hljs-string">"your-upstash-password"</span>,     <span class="hljs-comment">// Replace with your Upstash Redis password</span>
        DB:       <span class="hljs-number">0</span>,                           <span class="hljs-comment">// Default DB</span>
        TLSConfig: &amp;tls.Config{},              <span class="hljs-comment">// Enable TLS (important for Upstash)</span>
    })

    <span class="hljs-comment">// Check if Redis connection is successful</span>
    pong, err := redisClient.Ping(ctx).Result()
    <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
        log.Fatalf(<span class="hljs-string">"Failed to connect to Upstash Redis: %v"</span>, err)
    }
    fmt.Println(<span class="hljs-string">"Connected to Upstash Redis:"</span>, pong)
    <span class="hljs-keyword">return</span> <span class="hljs-literal">nil</span>
}
</code></pre>
<ol start="3">
<li><h3 id="heading-the-rate-limiter-middleware">The Rate Limiter Middleware</h3>
<p> The rules?</p>
<p> 5 requests per IP per minute</p>
<p> More than that, you’ll get a 429 (Too many requests) error.</p>
</li>
</ol>
<pre><code class="lang-go"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">RateLimiter</span><span class="hljs-params">()</span> <span class="hljs-title">gin</span>.<span class="hljs-title">HandlerFunc</span></span> {
    <span class="hljs-keyword">return</span> <span class="hljs-function"><span class="hljs-keyword">func</span><span class="hljs-params">(c *gin.Context)</span></span> {
        ip := c.ClientIP() <span class="hljs-comment">// Get that IP! (No cheating with proxies, okay?)</span>
        key := fmt.Sprintf(<span class="hljs-string">"rate_limit:%s"</span>, ip) <span class="hljs-comment">// Redis key. Example: "rate_limit:127.0.0.1"</span>
        limit := <span class="hljs-number">5</span>                              <span class="hljs-comment">// 5 requests...</span>
        window := <span class="hljs-number">60</span> * time.Second              <span class="hljs-comment">// ...per 60 seconds. Play nice!</span>

        <span class="hljs-comment">// Increment the request counter for this IP</span>
        count, err := redisClient.Incr(ctx, key).Result()
        <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
            log.Printf(<span class="hljs-string">"Redis threw a tantrum: %v"</span>, err)
            c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{<span class="hljs-string">"message"</span>: <span class="hljs-string">"BRB, server's crying"</span>})
            <span class="hljs-keyword">return</span>
        }

        <span class="hljs-comment">// If this is the first request, set the "self-destruct" timer</span>
        <span class="hljs-keyword">if</span> count == <span class="hljs-number">1</span> {
            <span class="hljs-keyword">if</span> _, err := redisClient.Expire(ctx, key, window).Result(); err != <span class="hljs-literal">nil</span> {
                log.Printf(<span class="hljs-string">"Redis tried to ghost us: %v"</span>, err)
                c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{<span class="hljs-string">"message"</span>: <span class="hljs-string">"Server's on strike"</span>})
                <span class="hljs-keyword">return</span>
            }
        }

        <span class="hljs-comment">// Enforce the limit</span>
        <span class="hljs-keyword">if</span> count &gt; <span class="hljs-keyword">int64</span>(limit) {
            c.AbortWithStatusJSON(http.StatusTooManyRequests, gin.H{
                <span class="hljs-string">"message"</span>: <span class="hljs-string">"Slow your roll, cowboy! 🐄 Try again later."</span>,
            })
            <span class="hljs-keyword">return</span>
        }

        c.Next() <span class="hljs-comment">// All good—proceed to the party!</span>
    }
}
</code></pre>
<p><strong>How this works?</strong></p>
<ul>
<li><p><code>Incr</code> Increments the request count for the IP</p>
</li>
<li><p><code>Expire</code> Set’s a 60 seconds TTL on the key only on the first request (so it auto deletes itself).</p>
</li>
<li><p>Limit check: If the count exceeds 5, deny entry for the requests.</p>
</li>
</ul>
<ol start="4">
<li><h3 id="heading-add-the-middleware-to-your-gin-router">Add the middleware to your Gin router</h3>
<p> Add the middleware onto your routes and protect them from getting overwhelmed.</p>
</li>
</ol>
<pre><code class="lang-go"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">if</span> err := ConnectRedis(); err != <span class="hljs-literal">nil</span> {
        log.Fatal(<span class="hljs-string">"Redis connection: Pong"</span>)
    }

    router := gin.Default()
    router.Use(RateLimiter()) <span class="hljs-comment">// Apply to all routes</span>

    router.GET(<span class="hljs-string">"/api/secret-sauce"</span>, <span class="hljs-function"><span class="hljs-keyword">func</span><span class="hljs-params">(c *gin.Context)</span></span> {
        c.JSON(http.StatusOK, gin.H{<span class="hljs-string">"message"</span>: <span class="hljs-string">"🔥 Secret sauce: 3 parts caffeine, 2 parts chaos"</span>})
    })

    router.Run(<span class="hljs-string">":8080"</span>)
}
</code></pre>
<p>You can start your server using <code>go run main</code>.</p>
<p>Now, hit <code>/api/secret-sauce</code> more than 5 times in a minute, and you’ll get a sassy <code>429</code> error. Test it with <code>curl -I http://localhost:8080/api/secret-sauce</code> and watch the headers fly!  </p>
<h2 id="heading-gotcha-and-pro-tips">Gotcha and Pro tips</h2>
<ol>
<li><p><strong>IP-based limits aren’t perfect</strong>: In a shared network (like Starbucks WiFi), you might block innocent bystanders. For critical apps, use API keys or auth tokens.</p>
</li>
<li><p><strong>Adjust the limits</strong>: 5 requests/minute too strict? Crank it up! (But not so high that your server melts.)</p>
</li>
<li><p><strong>Upgrade to sliding windows</strong>: This example uses a fixed window. For smoother limits, try Redis’s <a target="_blank" href="https://redis.io/docs/latest/develop/data-types/sorted-sets/"><code>ZSET</code></a> with a sliding window algorithm.</p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Rate limiting is a technique to control the number of requests a client can make to a server in a given timeframe, helping prevent abuse, ensure fair resource distribution, and maintain system stability. This article covers a simple implementation using Redis, Golang, and Gin, allowing 5 requests per IP per minute. The guide includes setup instructions, connection details for local and cloud-based Redis, and middleware implementation to protect your API routes. Adjusting limits and considering advanced techniques like sliding windows are also discussed for better control and efficiency.</p>
<p><img src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExZzh5a3N4aTVjdzNvbGo2cTRjN3FjeDFqZTlwZm90azZya3ZhYzdldyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l4KibK3JwaVo0CjDO/giphy.gif" alt class="image--center mx-auto" /></p>
<p>Bye !</p>
]]></content:encoded></item><item><title><![CDATA[KubeNation]]></title><description><![CDATA[So last Sunday, i.e. 3rd September 2023 I went to a meetup organized by CNCF New Delhi.
So, in this meetup, there were many inspirational and educational talks given, but for me, there was one session that stood out from all. It was around the basics...]]></description><link>https://blogs.pranavtripathi.me/kubenation</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/kubenation</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[kubernetes architecture]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Wed, 06 Sep 2023 12:45:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/PYyPeCHonnc/upload/62841983b50d52ef4d44897aacbd7378.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>So last Sunday, i.e. 3rd September 2023 I went to a meetup organized by <a target="_blank" href="https://twitter.com/cncfnd">CNCF New Delhi</a>.</p>
<p>So, in this meetup, there were many inspirational and educational talks given, but for me, there was one session that stood out from all. It was around the basics of Kubernetes, and various terminologies around it. This talk was given by <a target="_blank" href="https://twitter.com/i_siddhantk">Siddhant Khisty</a> and <a target="_blank" href="https://twitter.com/AakanshaPriya_">Aakansha Priya</a>.</p>
<p>I'm going to summarize that session here in this blog, so let's begin.</p>
<p><img src="https://media.tenor.com/r3XdvPsAV3kAAAAC/despicable-me-minions.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-is-kubernetes">What is Kubernetes?</h2>
<p>Whenever you Google this question, you'll find terms like</p>
<ul>
<li><p>DeFacto Container Orchestrator</p>
</li>
<li><p>widely used in the industry</p>
</li>
<li><p>amazing distributed system</p>
</li>
<li><p>complicated</p>
</li>
<li><p>and especially very easy to get it wrong</p>
</li>
</ul>
<p>But we're not going to see it this way today and use our imagination to make it easier to understand.</p>
<h3 id="heading-kubenation">KubeNation</h3>
<p>Imagine you are a person who wants to make a new nation, who is bored of all the countries and everything.</p>
<p>What things you'll need:</p>
<ul>
<li><p>Land</p>
</li>
<li><p>Authority</p>
</li>
<li><p>People &amp; Homes</p>
</li>
<li><p>Communication</p>
</li>
<li><p>Hard Workers</p>
</li>
</ul>
<h3 id="heading-land">Land</h3>
<p>You need land, your territory to rule over. How can you get land, there can be 4 major ways to get your hands on some land.</p>
<ul>
<li><p>💵 Buy</p>
</li>
<li><p>🔌 Rent</p>
</li>
<li><p>⚔️ Conquer</p>
</li>
<li><p>🥷🏻 Steal</p>
</li>
</ul>
<p>The last 2 are not recommended ☠️.</p>
<p>Now you have land, and you decided to divide your land into 4 cities.</p>
<ol>
<li><p><strong>Your national capital</strong>, where all the administration resides</p>
</li>
<li><p><strong>A Park City</strong>, to keep the environment healthy</p>
</li>
<li><p><strong>Industrial City</strong>, to pump up the economy</p>
</li>
<li><p>And <strong>Night City</strong>, coz why not (Who else likes cyberpunk 2077)</p>
</li>
</ol>
<h3 id="heading-authority">Authority</h3>
<p>We have to distribute the power too, who'll make the decisions, who'll ensure that everyone works properly and other things too.</p>
<p>So, let's divide the work.</p>
<p>There are four posts that you created for the country's authority and administration.</p>
<ol>
<li><p>Mr. President</p>
<ul>
<li><p>Governs the nation</p>
</li>
<li><p>Makes important decisions</p>
</li>
<li><p>decide who should know about his decisions</p>
</li>
<li><p>and also represents the nation</p>
</li>
</ul>
</li>
<li><p>Mr. Manager</p>
<ul>
<li><p>He makes sure everyone works</p>
</li>
<li><p>checks if all the cities are working properly</p>
</li>
<li><p>Are people able to communicate</p>
</li>
<li><p>And checks what's for lunch today</p>
</li>
</ul>
</li>
<li><p>Mr. Task Manager</p>
<ul>
<li><p>Assign work to everyone</p>
</li>
<li><p>Decide where to give the task</p>
</li>
</ul>
</li>
<li><p>A Central Record</p>
<p> Keeps a record of everything like</p>
<ul>
<li><p>What were the past decisions</p>
</li>
<li><p>Who's doing what task</p>
</li>
<li><p>Progress of each task</p>
</li>
<li><p>If tasks failed, why?</p>
</li>
<li><p>Who lives in the nation</p>
</li>
<li><p>And who are people talking to</p>
</li>
</ul>
</li>
</ol>
<h3 id="heading-people-amp-homes">People &amp; Homes</h3>
<p>Everyone in this KubeNation has his own home, where he and his family live happily.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693987039217/34594dbf-7479-44d2-9a64-e125cb2f4753.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-communication">Communication</h3>
<p>We made communication between people easier and accessible to all.</p>
<p>People can communicate with each other using phones, mobiles etc.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693987167512/0602be7d-cbd7-47ca-9728-d9bb80700b21.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-hard-workers">The Hard Workers</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693987258353/99a78f0f-0fb9-483b-949b-34033dcc64a7.png" alt class="image--center mx-auto" /></p>
<p>We're going to divide some essential tasks with the workers.</p>
<p>We've two types of workers with us, <strong>builders</strong> and <strong>communication.</strong></p>
<p>Builders</p>
<ul>
<li><p>build houses</p>
</li>
<li><p>and rebuild any damaged or destroyed houses</p>
</li>
<li><p>making sure people stay in their respective homes</p>
</li>
<li><p>They are available in every city</p>
</li>
</ul>
<p>Communications</p>
<ul>
<li><p>Make sure people talk with each other</p>
</li>
<li><p>deliver messages to people</p>
</li>
<li><p>enforce rules for better and hassle-free communication</p>
</li>
<li><p>They're available in every city too</p>
</li>
</ul>
<p><strong>Now you have the country of your dreams.</strong></p>
<p><img src="https://media.tenor.com/o1fnLBZm-OAAAAAM/phew-sigh.gif" alt class="image--center mx-auto" /></p>
<p>That was an easy task, wasn't it?</p>
<p>Congratulations 🎉🎊🎉🎊, you just learned the entire Kubernetes architecture. Confused? Let us go through our nation again and now I'll tell you about the Kubernetes architecture on the go.</p>
<h3 id="heading-land-1">Land</h3>
<p><img src="https://media.tenor.com/o3USUEFWvqUAAAAC/thor-landing.gif" alt class="image--center mx-auto" /></p>
<p>Your computer, laptop, PC, server, whatever you have becomes your land.</p>
<p>This is your territory to make your nation the leader of the world.</p>
<p>Talking about cities, your capital city becomes your <strong>Control Plane Node</strong>, other cities serve as <strong>nodes</strong>.</p>
<p>The Control Plane Node handles everything like all the authorities in the capital city.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693988218180/5878baa0-02c3-4985-8f4d-96470ee5ecf4.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-authority-1">Authority</h3>
<p>So, let's rename all the positions we had in our authoritative organization.</p>
<ul>
<li><p>Mr. President ➡️ Kube-API server</p>
</li>
<li><p>Mr. Manager ➡️ Controller Manager</p>
</li>
<li><p>Mr. Task Manager ➡️ Kube Scheduler</p>
</li>
<li><p>The Central Records ➡️ ETC-D</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693988470177/74582efe-f753-43b7-94d1-7cca5709a01c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-homes-and-people">Homes and People</h3>
<p>The homes are called the pods where all the containers reside, which represent the people.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693989227059/79d51078-4de4-4bb1-89cd-37bfa2b394b3.png" alt class="image--center mx-auto" /></p>
<p>The pod contains all the containers and there can be more than one pod in a node, just like there can be more than one home in a city.</p>
<h3 id="heading-communication-1">Communication</h3>
<p>The pods communicate with each other using services. Services provide a stable endpoint for pods to communicate with each other. A service can be used to expose a set of pods to other pods within the cluster.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693989443878/0de5cd2f-3ba7-4d72-b223-e2215568e877.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-hard-workers-1">The Hard Workers</h3>
<p>The hardest workers, builders and communications are replaced by Kubelet and Kube-proxy in Kubernetes respectively.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693989590827/b6a2a4ad-36af-4173-b312-1dbd15cfc9b6.png" alt class="image--center mx-auto" /></p>
<p>Kubelet helps in creating and maintaining pods, whereas Kube-proxy maintains the communication between the pods to run smoothly.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Now you can see what a cluster in Kubernetes looks like.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693989767038/5929d490-ed44-4cb1-885d-58188f319dd0.png" alt class="image--center mx-auto" /></p>
<p>Here the <strong>control plane node</strong> is the capital city with all the authority and keeps a check on every <strong>node</strong> (city).</p>
<p>Only the control plane node consists of the Kube-API server (president), controller manager (manager), Kube Scheduler (Task Manager) and ETC-D (the central records)</p>
<p>Each node (city) contains its kubelet (builder) and k-proxy (communications) to maintain pods (homes) and communication between them. The pods (homes) communicate with the help of services (phones etc.)</p>
<p>This is how you can understand the architecture of Kubernetes. Thanks again to <a target="_blank" href="https://twitter.com/i_siddhantk">Siddhant Khisty</a> and <a target="_blank" href="https://twitter.com/AakanshaPriya_">Aakansha Priya</a> for making this complex topic so simple.</p>
<p>See you folks again. 👋🏻👋🏻</p>
<p><img src="https://media.tenor.com/aWZ6PaC5x5EAAAAC/skeletor-until-we-meet-again.gif" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Open Source: insights from an Inspiring Event]]></title><description><![CDATA[Once upon a time, in a realm where lines of code intertwine with boundless creativity, I found myself amidst an enchanting event. Alongside esteemed speakers Anshum Shukla and Praddhumn Singh, we embarked on a whimsical journey, exploring the extraor...]]></description><link>https://blogs.pranavtripathi.me/open-source-insights-from-an-inspiring-event</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/open-source-insights-from-an-inspiring-event</guid><category><![CDATA[Open Source]]></category><category><![CDATA[community]]></category><category><![CDATA[events]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Sat, 08 Jul 2023 13:00:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688751191743/b1fa0248-de19-44b9-ac42-7b2ecef7134c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Once upon a time, in a realm where lines of code intertwine with boundless creativity, I found myself amidst an enchanting event. Alongside esteemed speakers <a target="_blank" href="https://twitter.com/anshumshukla">Anshum Shukla</a> and <a target="_blank" href="https://twitter.com/singh_praddhumn">Praddhumn Singh</a>, we embarked on a whimsical journey, exploring the extraordinary impact of Open Source and its vibrant communities. In this spellbinding blog post, I invite you to join me as we uncover the key insights and captivating takeaways from this remarkable gathering.</p>
<h3 id="heading-unleashing-the-magic-of-open-source">Unleashing the Magic of Open Source</h3>
<p><img src="https://media.tenor.com/E7MGaYKzyo4AAAAd/chipstop-tom-and-jerry.gif" alt class="image--center mx-auto" /></p>
<p>Within the enchanting realm of Open Source, we discovered a magical force that empowers individuals and communities alike. Open Source is not just about code; it's a philosophy that embraces transparency, collaboration and the tireless pursuit of innovation. Just like Harry Potter's wand, Open-Source transforms lines of code into catalysts for remarkable creations.</p>
<p><img src="https://media.tenor.com/KIpV4rHwju0AAAAM/harry-potter-wand.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-collaboration-where-fairytales-meet-innovation">Collaboration: Where Fairytales Meet Innovation</h3>
<p>Collaboration takes center stage in this captivating world. We witnessed the true essence of collaboration, where people from different backgrounds come together, sharing their unique gifts and surpassing boundaries. Much like characters from beloved fairytales, the collaborative spirit within Open-Source ignites a symphony of ideas, fostering innovation and unlocking new possibilities.</p>
<p><img src="https://media.tenor.com/cxsA-a-8uz0AAAAM/tom-and-jerry-jerry-the-mouse.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-unveiling-the-benefits-of-open-source">Unveiling the Benefits of Open Source</h3>
<p>Our journey unveiled the enchanting benefits bestowed upon those who embrace Open Source. Transparent and accessible, Open Source provides a playground for exploration. Feedback flows freely, leading to continuous improvement and the creation of remarkable solutions.</p>
<h3 id="heading-inclusive-communities-a-tale-of-growth-and-empowerment">Inclusive Communities: A Tale of Growth and Empowerment</h3>
<p>Open-Source communities are like a tapestry woven with diversity, unity, and shared purpose. We marveled at the inclusive nature of these communities, where individuals of all backgrounds and skill sets find support and inspiration. It is a realm where newcomers are welcomed, mentorship thrives, and personal growth becomes an integral part of the journey. Open-Source nurtures talents and empowers dreamers to embark on extraordinary quests. During the event, we highlighted the importance of thriving communities like <a target="_blank" href="https://twitter.com/WeMakeDevs">WeMakeDevs</a>, <a target="_blank" href="https://github.com/EddieHubCommunity/">EddieHub</a>, <a target="_blank" href="https://twitter.com/SuperContri_twt">SuperContributors</a>, and <a target="_blank" href="https://twitter.com/devs_in_tech">DevsInTech</a>. The audience eagerly expressed their desire to become part of these dynamic communities, recognizing the immense value they provide in nurturing collaboration, fostering growth, and creating meaningful connections. These communities serve as welcoming spaces where individuals can contribute their unique talents and be part of a supportive network that propels them forward in their Open-Source journeys.</p>
<p><img src="https://media.tenor.com/1fU1IZSrKOoAAAAC/tom-and-jerry.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-ripple-effect-spreading-wonder-across-industries">The Ripple Effect: Spreading Wonder Across Industries</h3>
<p>As we gazed into the reflective pools of Open Source, we witnessed the magical ripple effect it creates. Every contribution, no matter how small, sets forth a chain reaction that reverberates beyond individual projects. It sparks inspiration, fueling the imaginations of others and fostering a culture of continuous learning and innovation across industries. Open-Source becomes a beacon of hope, connecting dreamers, creators, and innovators in a dance of shared progress.</p>
<h3 id="heading-in-conclusion">In conclusion...</h3>
<p>Our whimsical journey through the realms of Open Source has only just begun. As we bid farewell to this captivating event, we carry with us the revelations and insights that will shape our own quests. Let us embrace the magic of Open Source, forging connections, and weaving our stories into the grand tapestry of collaboration, innovation, and a truly connected world.</p>
<p>So, my dear reader, are you ready to step into the enchanting world of Open Source and become part of this wondrous tale? Adventure awaits, and together, we shall create something truly magical.</p>
<p><img src="https://media.tenor.com/MK3U9VAdNq4AAAAC/talk-soon-talk-to-you-soon.gif" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Git- Your first step in the tech :)]]></title><description><![CDATA[Why is it needed?

After working on anything, you want to save it before it is interrupted or deleted so that you may pick up where you left off, and maintain a history of the changes you made.

makes any sense?

Let's take an example, I want to crea...]]></description><link>https://blogs.pranavtripathi.me/git</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/git</guid><category><![CDATA[CocodeBlogs]]></category><category><![CDATA[Git]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Fri, 28 Apr 2023 04:24:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/842ofHC6MaI/upload/94b8411d7d625d1fd2bd2989fc96c16f.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-why-is-it-needed">Why is it needed?</h3>
<p><img src="https://media.tenor.com/dlxmmF2Xps4AAAAC/someone-tell-me-why-jonathan-larson.gif" alt class="image--center mx-auto" /></p>
<p>After working on anything, you want to save it before it is interrupted or deleted so that you may pick up where you left off, and maintain a history of the changes you made.</p>
<blockquote>
<p>makes any sense?</p>
</blockquote>
<p>Let's take an example, I want to create a personal website. I spent days working on the coding for it. But hold on, my system isn't working, my hard drive may have failed, or I might have made a mistaken modification to my code and I can't go back to how things were.</p>
<blockquote>
<p>this has happened to me :(</p>
</blockquote>
<p>This is where Git steps in to save you from all the hassles and disappointments by keeping track of your current project and all the changes you've made rather than saving every single version with a new name on your machine.</p>
<p>There are various programs available to help you maintain track of your work, but in this article, we will solely discuss Git. Git is a version control software that records changes to the code.</p>
<blockquote>
<p>It's a talent that every company wants, and BOOM, you can add it to your résumé. :D</p>
</blockquote>
<p>Ok! Perhaps you're not happy with it. Perhaps you feel safe storing every file locally.</p>
<blockquote>
<p>Lemme answer that as well :)</p>
</blockquote>
<p>Since numerous abilities would help the website and I need additional individuals, I am now intending to work with my friends on it. However, having it on your local makes it a little more challenging to use. Since you should always collaborate rather than operate remotely.</p>
<p>With a clear knowledge of where, what, and by whom changes have been made, Git may be used to merge a new version of an already existing version from another user.</p>
<blockquote>
<p>Now make your friends do some work too :D</p>
</blockquote>
<h3 id="heading-git">Git</h3>
<p><img src="https://miro.medium.com/v2/da:true/resize:fit:1200/1*sOWIyC1rjrWSUdIS1KvyHw.gif" alt class="image--center mx-auto" /></p>
<p>Git is a distributed version control system that allows any user to modify the entirety of a repository on their computer. It makes use of the command line, and Git makes it simple to reverse changes repeatedly while providing a detailed account of what was changed. It can do the following:</p>
<ol>
<li><p>Tracking the changes, or many iterations of the same file.</p>
</li>
<li><p>It also maintains a list of all the files that are included in a project.</p>
</li>
<li><p>Comparison and analysis of several codes with thorough justification.</p>
</li>
</ol>
<blockquote>
<p>Now you know why to use it, but how?</p>
</blockquote>
<p>The first step in getting started with Git is to create a local repository and a remote repository.</p>
<p><strong>Local repository</strong>: A local repository is a working path or directory that you have built on a local computer. Up until you push it to the remote repository, the repository where you write your code is private to you.</p>
<p><strong>Remote repository</strong>: For hosting your websites, you may use a remote repository, such as GitHub or Bitbucket, which is a public directory or platform. Git makes it simple to push a section of code or a whole project to a remote directory.</p>
<h3 id="heading-installation">Installation</h3>
<p>You should now install it on your machine. To install it, kindly look at this link.</p>
<p><a target="_blank" href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">Git installation guide</a></p>
<p><img src="https://media.tenor.com/uO4u0ib3oK0AAAAM/done-and-done-spongebob.gif" alt class="image--center mx-auto" /></p>
<blockquote>
<p>I hope you installed it :)</p>
</blockquote>
<h3 id="heading-key-concepts">Key concepts</h3>
<p>Let's attempt to comprehend some of the main terms used here:</p>
<p><strong>Version Control System</strong>: This program keeps track of various versions of the codes. likewise known as source code management.</p>
<p><strong>Commit</strong>: After making your changes, you should send them from the local repository to the staging area or staging index, then to the remote repository. Your code is now saved to Git. Please click the git commit link to learn more about committing.</p>
<p><strong>Checkout</strong>: When the working directory has been duplicated with all of the repository's content.</p>
<p><strong>Secure Hash Algorithm, or SHA</strong>: Each commit receives its ID. Branch: When you deviate from the primary route of development and carry on working without interfering with it.</p>
<h3 id="heading-configure-your-git">Configure your Git</h3>
<p>You may set up the user credentials for your local and remote repositories by using the command <code>cd</code> to go to your working directory. The code is pushed into a remote repository using these credentials.</p>
<p>Add your username and user email-id</p>
<pre><code class="lang-plaintext">git config --global user.name "Enter your name here"
git config --global user.email "your_email_address@domain.com"
</code></pre>
<p>Use the following command to check the changes you made.</p>
<pre><code class="lang-plaintext">git config -l
</code></pre>
<h3 id="heading-lets-see-how-to-work-locally-with-git">Let's see how to work locally with git</h3>
<p>A repository must first be present on a local system. The current project will be kept in this repository; it may then be uploaded to GitHub. To navigate the repositories, we utilize the command line. Go to the path using the cd command, then use the <code>mkdir</code> command to create a directory.</p>
<pre><code class="lang-plaintext">mkdir git-test
</code></pre>
<ol>
<li><p><code>git init</code></p>
<p> Use the git init command to initialize the directory after it has been created. The master branch is now the result of the git init command, which starts a fresh git repository. The source code and other development materials are kept in the repository, which is a version control system.</p>
</li>
<li><p><code>git status</code></p>
<p> It is simple to see the changes made in a repository using git status. Let's assume I used the git status command to add a new file to the branch that Git is showing. By executing this command, any modifications may be noticed. This does not imply that the modifications are made and saved.</p>
</li>
<li><p><code>git add</code></p>
<p> Before it is committed, the modifications made should be included. Using the git add command, the code or any file is added to the staging area.</p>
<p> To add multiple files at one go we use the command <code>git add .</code> All the modified files present in the local repository are moved to the staging area.</p>
</li>
<li><p><code>git commit</code></p>
<p> It is used to store the file in a repository from the staging area.</p>
</li>
</ol>
<h3 id="heading-commands-to-review-history-in-git">Commands to review history in Git</h3>
<p><img src="https://i.gifer.com/F1Wp.gif" alt class="image--center mx-auto" /></p>
<p>When working on a piece of code, you'll probably want to undo any changes you've made or want to see how the code looked before you made them. Some commands may be used to view previous modifications.</p>
<ol>
<li><p><code>git log</code></p>
<p> to see every commit that has been made to the repository. The git log command is used. By including the SHA key in the command, we can see a particular commit come first, then all the others.</p>
</li>
<li><p><code>git --stat</code></p>
<p> Using this command, you can see which files were changed and how many lines of code were added or deleted.</p>
</li>
<li><p><code>git log -p</code></p>
<p> Using this command, you may see the actual changes—the lines that have been added or removed—that have been made. The patch is indicated by the -p.</p>
</li>
</ol>
<p>You may supply the SHA key to any of these commands, which may be beneficial for seeing a specific commit.</p>
<h3 id="heading-branching-in-git">Branching in Git</h3>
<p><strong>Creating a new branch</strong></p>
<p>One should make it a practice to make modifications in a distinct branch before making them straight to the master branch. Even though you can roll back to the prior commit if the new modifications don't work, doing so costs the organization money.</p>
<p>Instead, it is preferable to work on a fresh branch, test the changes, and then transfer them to the living environment.</p>
<p>Use the command <code>git branch &lt;branch-name&gt;</code> to add a branch that references the master. Use <code>git branch &lt;branch-name&gt;</code> SHA instead if the modifications need to be made to a commit that isn't a master right now. The new branch should be added after which commit, according to SHA.</p>
<p>We transfer the master branch to a new branch named <code>&lt;branch-name&gt;</code> using the command <code>git checkout &lt;branch-name&gt;</code>. By using the same procedures, we used with the previous master branch, you can now add and commit modifications to this branch. after that, your branch has been pushed to the distant repository:</p>
<p><code>&lt;branch-name&gt; git push -u origin</code></p>
<p>If successful, use <code>git merge &lt;branch-name&gt;</code> to combine the code with the old master branch. However, you must use the <code>git checkout</code> command to return to the previous master branch before executing the merge command.</p>
<p>Using git commands, it is also possible to rename, remove, and compare branches:</p>
<ol>
<li><p>Rename: <code>git branch -m &lt;branch-name&gt; &lt;new-branch-name&gt;</code></p>
</li>
<li><p>Delete: <code>git branch -d &lt;branch-name&gt;</code></p>
</li>
<li><p>Compare branches: <code>git diff &lt;branch-name&gt; &lt;master-branch-name&gt;</code></p>
</li>
</ol>
<h3 id="heading-tl-dr">TL; DR</h3>
<p>Git is an open-source, free program. It delivers at a higher speed and is simple to use. It enables you to execute your code in the cloud and keeps track of every change that has ever been made to the project, or the whole history of changes. Each commit includes the name of the author, a brief description, a date, and the SHA1 hash of the previous commit.</p>
<p>Git is advantageous when a team is operating remotely. Since anybody may edit as long as they have access to the remote repository.</p>
<p>Your local repository may be connected to any remote repository, including GitHub, GitLab, Bitbucket, and others.</p>
<p><img src="https://media.tenor.com/u_8116zY_LUAAAAC/later-gator-see-you-later.gif" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Front-end Development Roadmap in 2023]]></title><description><![CDATA[Why a roadmap?
In today's tech industry, the biggest mistake beginners do is jumping from one language to another as they follow trends, check out 'what is popular' and start learning it without a roadmap. That is a bad way to start in the industry a...]]></description><link>https://blogs.pranavtripathi.me/front-end-development-roadmap-in-2023</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/front-end-development-roadmap-in-2023</guid><category><![CDATA[DevsInTechBlogs]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[CSS]]></category><category><![CDATA[Roadmap]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Thu, 09 Mar 2023 05:15:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/5KD5PmZEfcg/upload/a65cc7e3eaabb8e5e77bb9b2a7ebeeb0.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-why-a-roadmap">Why a roadmap?</h3>
<p>In today's tech industry, the biggest mistake beginners do is jumping from one language to another as they follow trends, check out <em>'what is popular'</em> and start learning it without a roadmap. That is a bad way to start in the industry and if you don't start well, the path ahead goes and becomes more and more difficult. One of the things my friend did for me when I first started in IT was to create a learning roadmap, and it was one of the things that helped me improve. Although it may appear complicated, the frontend development learning map is not that large. It won't seem daunting if you approach it to step by step.</p>
<p><img src="https://media0.giphy.com/media/ppdJSbkKj25NvdxFQo/giphy.gif?cid=ecf05e47t28pxiugg88mvickhdtaolew59t64jup60hi92o1&amp;rid=giphy.gif&amp;ct=g" alt="Let's get started" class="image--center mx-auto" /></p>
<ul>
<li><h3 id="heading-foundation-knowledge">Foundation Knowledge</h3>
<p>  as you will be developing websites it will be beneficial to understand the Internet, how websites work, etc. It will help you understand the rationale behind why things are done the way they are.</p>
</li>
<li><h3 id="heading-into-the-basics">Into the Basics</h3>
<p>  <img src="https://media1.giphy.com/media/TI32JwHmWQEi4/giphy.gif?cid=ecf05e472t9eflo3tewfte4tniwx9quohugnj90fxqjq1h0b&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>  The three pillars of Front-end development are HTML, CSS and JavaScript. 90% of websites we go on, through our phone, our laptop or tablet are made using these three languages, HTML, CSS and JavaScript. So I don't think so you have any doubt about why we should start with these three.</p>
<p>  Let's take the example of the human body, how our body is built with the skeletal system, muscular system and nervous system. Just like the skeletal system is responsible for all the structure of the body, HTML is responsible for the structure of the website. And the muscles on the body are responsible for how we look, just like CSS takes responsibility for how our website will look. All the aesthetics of the website is under the influence of CSS. Now comes the functionality, as the nervous system takes care of the functionality of the human body, and JavaScript takes care of all the functionality in the website.</p>
</li>
<li><h3 id="heading-now-come-libraries-and-frameworks">Now come Libraries and Frameworks</h3>
<p>  after the basics, libraries and frameworks like React, Vue and Angular etc. make the work easier and faster. As React is a library, not a framework. The major difference between a library and a framework is that a library doesn't force the application to be in a pre-defined structure but a framework forces the application to follow a structure. For example, a project that uses bootstrap may be identified by the way it looks and functions since bootstrap is a CSS framework.</p>
</li>
<li><h3 id="heading-learn-the-usage-of-version-control-software">Learn the usage of version control software</h3>
<p>  <img src="https://media2.giphy.com/media/zQOmyYc8TXzSBfrTFb/giphy.gif?cid=ecf05e47upsl1utvxdqr8tg4o1nephe506mgjorp3cfmeg18&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>  Learn how to use Git, as Git is the most popular and most used version control system, and is used in 70% of software development. It is utilized to keep track of our project history and collaborate with others, hence it is virtually universally mentioned in job descriptions. Whilst there are several version control systems, it is advised to become familiar with Git because of its popularity.</p>
</li>
<li><h3 id="heading-css-pre-processors">CSS pre-processors</h3>
<p>  Because of its age and inability to handle extremely large projects, CSS is insufficient. Whenever you try to make changes to your code, a bug pops up, and the process may be quite daunting. The CSS preprocessor streamlines and expedites your work. There are other CSS preprocessors, however as SASS is more widely used, learning it is advised.</p>
</li>
<li><h3 id="heading-resources">Resources</h3>
<p>  <a target="_blank" href="https://www.freecodecamp.org/learn/front-end-development-libraries/">Front-end Libraries Certification by FCC</a></p>
<p>  <a target="_blank" href="https://www.youtube.com/watch?v=zJSY8tbf_ys&amp;t=291s">Video by FCC on Front-end Development</a></p>
<p>  <a target="_blank" href="https://www.youtube.com/watch?v=xV7S8BhIeBo">Portfolio Website tutorial using HTML, CSS and JavaScript</a></p>
</li>
</ul>
<p><img src="https://media2.giphy.com/media/3o6EhGvKschtbrRjX2/giphy.gif?cid=ecf05e47oeyq8jo2ws173enxqxwdkf56jxctdjnraala4mp9&amp;rid=giphy.gif&amp;ct=g" alt class="image--center mx-auto" /></p>
<p>See you folks in another blog.</p>
]]></content:encoded></item><item><title><![CDATA[GoLang: Why it is my favorite language now]]></title><description><![CDATA[Hey everyone,
From the huge ocean of programming languages, today I'm going to tell about my new favourite language GoLang.
What is GoLang?
The Golang programming language is an open source project from Google. It was made to be a better alternative ...]]></description><link>https://blogs.pranavtripathi.me/golang</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/golang</guid><category><![CDATA[golang]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Go Language]]></category><category><![CDATA[Google]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Thu, 17 Nov 2022 07:25:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1668669900828/VFjNeMt2uX.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone,
From the huge ocean of programming languages, today I'm going to tell about my new favourite language <strong>GoLang</strong>.</p>
<h2 id="heading-what-is-golang">What is GoLang?</h2>
<p>The Golang programming language is an open source project from Google. It was made to be a better alternative for writing large programs, especially ones that need concurrency features like channels and goroutines. Golang can also compile code into the machine’s native instruction set so it runs faster than other languages.</p>
<h2 id="heading-why-it-is-better-than-others">Why it is better than others?</h2>
<p>GoLang bring a lot of benefits on the table, which makes it better than others, like:</p>
<ol>
<li><p><strong>Simple:</strong> 
<img src="https://media1.giphy.com/media/krtDmVuQGssOtMWfRg/giphy.gif?cid=ecf05e47tbph3cxlr9w4pqkw05b3jehqs2w09t8x0ttx52tf&amp;rid=giphy.gif&amp;ct=g" alt />
It has a simpler syntax than many other languages, much similar to <em>Python</em>. No curly braces, semi-colons or parentheses for control statements. This ease in syntax and writing codes makes it easier to read Golang code which helps engineers to work faster and find errors.</p>
</li>
<li><p><strong>Faster Development:</strong> 
<img src="https://media2.giphy.com/media/fBEMsUeGHdpsClFsxM/giphy.gif?cid=ecf05e47gxkl1msw425hjq8rimcpxo0pj8jk41o8gxrqdltv&amp;rid=giphy.gif&amp;ct=g" alt />
It reduces development time considerably in error checking, concurrency or simplifying complex threads.</p>
</li>
<li><p><strong>Portable:</strong> Golang can be compiled for any operating system and architecture. This is different from other languages that need to compile code into bytecode which only runs on the same platform they were built in.</p>
</li>
</ol>
<h2 id="heading-does-any-company-use-golang">Does any company use GoLang?</h2>
<p>Yeah, it is used more than you think. Here are some companies which uses GO.</p>
<ul>
<li><h3 id="heading-google"><strong>Google</strong></h3>
</li>
</ul>
<p>Not a surprise, Golang was developed by Google Engineers and is often used in internal projects. Google Chrome and Google Earth were created in this way.</p>
<ul>
<li><h3 id="heading-uber"><strong>Uber</strong></h3>
</li>
</ul>
<p>One of the biggest companies using Golang is <strong>Uber</strong>. It is used there for the <em>geofence</em> service, which serves the user’s location and product availability. Geofence makes it possible to precisely define the area with special requirements (e.g. taking into account places such as airports) and to implement dynamic prices.</p>
<ul>
<li><h3 id="heading-twitch"><strong>Twitch</strong></h3>
</li>
</ul>
<p>In Twitch, Go is used for the most-loaded systems. It is appreciated for its simplicity, security, efficiency and readability, which means that it perfectly manages problems encountered when displaying live video and simultaneous chats of a large number of users</p>
<ul>
<li><h3 id="heading-daily-motion"><strong>Daily Motion</strong></h3>
</li>
</ul>
<p>Dailymotion is a video streaming website. Thanks to Golang, among others, automation of APIs has been improved. </p>
<p>This language makes it possible to carry out a large number of automation tests, which would otherwise cause huge loads. All because of Golang simplicity and its performance, as well as the possibility of static type checking.</p>
<h2 id="heading-advantages-of-golang">Advantages of GoLang</h2>
<p><img src="https://media4.giphy.com/media/3oKIPbNb1vWdftiVLq/giphy.gif?cid=ecf05e47yvz5bq9gm8kj3mob0mxp125ko2psjd3pf2edm567&amp;rid=giphy.gif&amp;ct=g" alt /></p>
<ul>
<li>Golang is better than other programming languages, therefore it reduces development time considerably through error checking, concurrency handling, simplifying threads and go routines that are scalable.</li>
<li>It allows concurrent programming which is a big draw for companies who want to save time and resources.</li>
<li>Golang has a solid standard library that includes everything developers need from math, strings, net/web connections to the more advanced topics of crypto and database access.</li>
<li>Standard libraries are one less thing you have to worry about when using Golang as they already contain all the code necessary for common tasks like reading input or writing output; so no extra coding required.</li>
<li>The syntax is simple enough too with just basic statements being allowed without curly brackets in favor of go-routines. Allowing programmers to focus on what their real goal is the logic and not how it’s written down.</li>
</ul>
<h2 id="heading-disadvantages-of-golang">Disadvantages of GoLang</h2>
<p><img src="https://media4.giphy.com/media/wVVugCi5bUiRb4ioP2/giphy.gif?cid=ecf05e47f5llcjojueup4lcsgv9fnnh8tes7m94tmx6c9pt4&amp;rid=giphy.gif&amp;ct=g" alt /></p>
<ul>
<li><p>There are some security concerns with Golang. Since it’s not widely used in many organizations and because there are more bugs as well as less secure coding practices compared to other languages. This means that software developers need to take extra precautions when developing code for Golang-based applications.</p>
</li>
<li><p>Golang is not an easy language due to its minimalistic style which can make debugging difficult (not impossible). Dependencies need installing (unlike with Java) so there may be some limitations when working from home or public machines such as libraries you can’t find locally.</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>According to me GoLang is highly effective, fast and adds a massive value in complex applications. And since it's introduction, GoLang has gained popularity and got famousin many business giants, like Netflix, Uber, BBC, etc. With a steady growing user base, soon a majority of companies will need to switch to Golang. </p>
]]></content:encoded></item><item><title><![CDATA[My first hacktoberfest: first time contributing to open-source]]></title><description><![CDATA[My story of contributions and open-source goes back to August and not October. My first year of college ended that month and I was very happy because I got almost 2 weeks doing nothing, watching Netflix, and enjoying homemade food. One of my friends,...]]></description><link>https://blogs.pranavtripathi.me/my-first-hacktoberfest</link><guid isPermaLink="true">https://blogs.pranavtripathi.me/my-first-hacktoberfest</guid><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[hacktoberfest2022]]></category><category><![CDATA[#hacktoberfest ]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[#BlogsWithCC on Hashnode]]></category><dc:creator><![CDATA[Pranav Tripathi]]></dc:creator><pubDate>Fri, 21 Oct 2022 13:58:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1667309185373/ooCmHJeyu.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>My story of contributions and open-source goes back to August and not October. My first year of college ended that month and I was very happy because I got almost 2 weeks doing nothing, watching Netflix, and enjoying homemade food. One of my friends, <a target="_blank" href="https://twitter.com/anshumshukla">Anshum Shukla</a> showed me a post on LinkedIn of a guy named <a target="_blank" href="https://twitter.com/kunalstwt">Kunal Kushwaha</a>, and I was pretty ignorant about it, because who's gonna watch some LinkedIn post just before vacation, but was forced to do so. That one post changed the way I was looking at my future, I explored the immense possibilities opened by open-source contributions, learning in public, and projects. </p>
<p>After going through a lot of search results, YouTube videos, and reading multiple blogs, I somewhat knew what is the importance of open-source. It possibly seems dreadful and daunting to read and search multiple lines of code but it is not what it seems. It is very easy to start if you have the right guidance and a welcoming community, both of it was provided with twitter.</p>
<p>So I started working on my skills and parallelly started Web Development. One day I came across a tweet by <a target="_blank" href="https://twitter.com/eddiejaoude">Eddie Jaoude</a> on Hacktoberfest, and again my fingers ran through the keyboard searching for what it meant.</p>
<h3 id="heading-what-is-hacktoberfest">What is Hacktoberfest?</h3>
<p>Spoiler: It is not related to Hacking or something like that. </p>
<p><a target="_blank" href="https://hacktoberfest.com">Hacktoberfest</a> is a month-long event that celebrates open-source contributions from 1st October to 31st October. It is presented by DigitalOcean with support from AppWrite and Docker. During this month you're encouraged to contribute to your favorite repositories marked with the label Hacktoberfest. On successfully making four pull requests merged you get swags that include a very cool T-shirt from the Hacktoberfest team, but my objective was never to get a T-shirt.</p>
<h3 id="heading-my-first-pull-request">My First Pull Request</h3>
<p>So I was actively participating and joining some VCs in a discord community named <a target="_blank" href="https://discord.gg/TZXkstadj3">SuperContributors</a> and from there I saw a project which was basically an <a target="_blank" href="https://github.com/nishantattrey07/nishantattrey07.github.io">HTML cheatsheet</a> to help people in HTML. 
I <a target="_blank" href="https://github.com/nishantattrey07/nishantattrey07.github.io/pull/9">added</a> a section that tells about the text formatting that can be done using HTML tags.</p>
<h3 id="heading-open-source-with-pradumna-sarafhttpstwittercompradumnasaraf">Open-Source With <a target="_blank" href="https://twitter.com/pradumna_saraf">Pradumna Saraf</a></h3>
<p>Just three-four days before the Hacktoberfest started, I saw this <a target="_blank" href="https://github.com/Pradumnasaraf/open-source-with-pradumna">repository</a> and saw one issue which I thought was solvable and asked to get assigned (also came to know that it is a good practice to ask the maintainer to assign you the issue before start working on it). Solved it and learned how to use GitHub pages, as my issue worked around it.</p>
<p>This repo is just so awesome for learning new things, if you're a beginner just like me, go on to <a target="_blank" href="https://oswp.study">this</a> page and learn various things which are necessary for getting used to open-source contributions.</p>
<h3 id="heading-1-2-3-4-im-on-the-roll">1 2 3 4.. I'm on the roll</h3>
<p>On October 12, my four PRs got merged and were through the 7 days verification period. I was more than happy but didn't stop learning about new things, getting better 4 PRs weren't the end of the learning stage, it was merely the beginning of a very long and awesome journey.</p>
<p>My fifth PR was on an issue I raised after going through the page, the best part was maintainer was already going to raise it but I did it before him, it was like I already read his mind. Any guesses who was the owner/maintainer of the repository, none other than <a target="_blank" href="https://twitter.com/pradumna_saraf">Pradumna Saraf</a>.</p>
<h3 id="heading-supercontributors">SuperContributors</h3>
<p><a target="_blank" href="https://twitter.com/SuperContri_twt">SuperContributors</a> is a community, which deserves a special place in this blog. It is a totally beginner-friendly community, which helps people like me to learn various tech-related stuff. Amazing folks like <a target="_blank" href="https://twitter.com/SuperAayush14">Aayush Sharma</a>, <a target="_blank" href="https://twitter.com/bhavya_58">Bhavya Sachdeva</a>, <a target="_blank" href="https://twitter.com/ChiragV01">Chirag Varshney</a>, <a target="_blank" href="https://twitter.com/jai_solania_29">Jaideep Solania</a>, <a target="_blank" href="https://twitter.com/gola_kanika">Kanika Gola</a>, and many other faces are always eager to help beginners and let them grow.</p>
<h3 id="heading-my-first-meet-up">My first meet-up</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1666346982696/1769R-uy8.jpg" alt="meetup.jpg" class="image--center mx-auto" /></p>
<p>As October wasn't already good enough my application for the first meet-up got accepted. The day was 16 October, I have to go to HUDA city center, Gurugram, and got the amazing company of my friend Anshum Shukla. The meetup was organized by Solana and hosted by <a target="_blank" href="https://hackthisfall.tech/">Hack This Fall</a>.</p>
<p>So the meet-up was really nice and I had a total fanboy feeling inside me. Seeing so amazing folks in person, meeting them, and asking whatever doubts I had. It was mesmerizing to see such good people in one place. </p>
<p>The whole theme of the meet-up was around Hacktoberfest, there were sessions about git, GitHub, and open-source. What are good contributions, and what are bad contributions?</p>
<p>A talk by Aditya Oberoi and Haimantika about appwrite, which provides backend-as-a-service to developers.</p>
<p>In a talk by Prakarsh, he told about what Solana provides to developers. Solana is a decentralized blockchain built to enable scalable, user-friendly apps for the world.</p>
<p>In a nutshell, the overall meet-up was probably the best day of this year.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Hacktoberfest isn't an event to complete 4 PRs or compete with who's gonna complete the target of 4 PRs. All I learned was code to contribute not to compete. Don't do open-source for the sake of a T-shirt. You might get a better one in a market or someplace. Open source is a pool of wisdom, you either can take a dip and learn from that or you can add your bucket of learning to it. Both will make you grow and be better.</p>
]]></content:encoded></item></channel></rss>