<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mitansh Panchal</title>
    <description>The latest articles on DEV Community by Mitansh Panchal (@looph0le).</description>
    <link>https://dev.to/looph0le</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F905375%2Fad58889d-0e38-4a92-a841-aa8aa7994592.jpg</url>
      <title>DEV Community: Mitansh Panchal</title>
      <link>https://dev.to/looph0le</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/looph0le"/>
    <language>en</language>
    <item>
      <title>How to Implement Video Streaming Services: A Behind-the-Scenes Look</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Tue, 04 Mar 2025 06:24:46 +0000</pubDate>
      <link>https://dev.to/looph0le/how-video-streaming-services-work-a-behind-the-scenes-look-37j1</link>
      <guid>https://dev.to/looph0le/how-video-streaming-services-work-a-behind-the-scenes-look-37j1</guid>
      <description>&lt;p&gt;Streaming video has become a cornerstone of modern entertainment, powering platforms like Netflix, YouTube, and Twitch. But how does a massive video file get from a server to your screen seamlessly, even over shaky internet connections? In this blog, we’ll peel back the curtain on video streaming services, exploring how they break videos into chunks, manage buffering on your device, and optimize the experience for millions of users.&lt;/p&gt;




&lt;h2&gt;
  
  
  Breaking Down Videos into Chunks
&lt;/h2&gt;

&lt;p&gt;When you upload a video to a streaming platform, it doesn’t sit on a server as one giant file waiting to be sent whole. Instead, the service processes it into smaller, manageable pieces—a process critical to efficient delivery.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Upload and Encoding&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once a video is uploaded, the server encodes it into multiple formats and quality levels (e.g., 240p, 720p, 4K). This creates versions suited for different devices and network speeds.&lt;/li&gt;
&lt;li&gt;Each version is then split into &lt;strong&gt;chunks&lt;/strong&gt;—short segments, typically 2–10 seconds long.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chunking Process&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The original file (e.g., a 1-hour MP4) is divided into a sequence of smaller files or segments.&lt;/li&gt;
&lt;li&gt;Metadata (like a playlist or manifest file) is generated, listing where each chunk lives and in what order they should play.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Storage&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chunks are stored on a content delivery network (CDN)—a distributed set of servers worldwide—to reduce latency by serving them from a location near the viewer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s a simplified pseudocode representation of this process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// On Video Upload
function processVideoUpload(videoFile):
    // Encode into multiple qualities
    qualities = ["240p", "720p", "1080p"]
    encodedVideos = []
    for quality in qualities:
        encodedVersion = encodeVideo(videoFile, quality)
        encodedVideos.append(encodedVersion)

    // Split into chunks
    chunkDuration = 5  // Seconds per chunk
    chunkedVideos = []
    for encodedVideo in encodedVideos:
        chunks = splitIntoChunks(encodedVideo, chunkDuration)
        chunkedVideos.append(chunks)

    // Generate manifest file
    manifest = createManifest(chunkedVideos)
    storeOnCDN(chunkedVideos, manifest)

// When Client Requests Video
function serveVideo(request):
    manifest = fetchManifestFromCDN(request.videoId)
    sendToClient(manifest)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Chunks?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Smaller files are easier to download incrementally.&lt;/li&gt;
&lt;li&gt;If your connection drops, you don’t lose the whole video—just the current chunk.&lt;/li&gt;
&lt;li&gt;Chunks enable adaptive bitrate streaming (more on that later), letting the player switch quality mid-stream.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you hit “play,” your device fetches the manifest file, which tells it where to grab each chunk in sequence. The server streams these chunks one by one, stitching them together invisibly on your end.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Buffering Works and Client-Side Management
&lt;/h2&gt;

&lt;p&gt;Buffering is the unsung hero of streaming—those moments when your player loads a bit of video ahead of time to keep playback smooth. But how does it actually work?&lt;/p&gt;

&lt;h3&gt;
  
  
  How Buffering Works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Preloading Chunks&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you start a video, the client (your browser or app) doesn’t wait for the entire file. Instead, it downloads the first few chunks into a buffer—a small memory pool—before playback begins.&lt;/li&gt;
&lt;li&gt;As you watch, it keeps fetching chunks in the background to stay ahead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Buffer Size&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The buffer holds enough video (e.g., 10–30 seconds) to handle brief network hiccups without pausing playback.&lt;/li&gt;
&lt;li&gt;If the buffer runs dry (download speed &amp;lt; playback speed), you see the dreaded “buffering” spinner.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Adaptive Playback&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client monitors your network speed and adjusts quality. If it detects slowdown, it might switch to a lower-quality chunk to keep the buffer full.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s pseudocode for a basic buffering system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Client-Side Buffering Logic
function playVideo(manifest):
    buffer = initializeBuffer()  // Empty buffer, e.g., 20s capacity
    currentPosition = 0  // Playback time in seconds
    quality = selectInitialQuality(networkSpeed)

    // Start preloading
    while playbackActive:
        if buffer.spaceAvailable() and not buffer.full():
            nextChunk = fetchChunk(manifest, currentPosition, quality)
            buffer.add(nextChunk)

        if buffer.hasEnoughData() or buffer.full():
            playFromBuffer(buffer, currentPosition)
            currentPosition = currentPosition + chunkDuration

        // Monitor network and adjust
        currentSpeed = measureNetworkSpeed()
        if currentSpeed &amp;lt; playbackRate and buffer.low():
            quality = downgradeQuality(quality)
        else if currentSpeed &amp;gt; playbackRate and buffer.nearlyFull():
            quality = upgradeQuality(quality)

function onNetworkDrop():
    if buffer.empty():
        pausePlayback()
        showBufferingSpinner()
    else:
        continuePlaybackFromBuffer()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Client-Side Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Adjustment&lt;/strong&gt;: The player uses algorithms to predict how much buffer is needed based on network jitter (variability in speed).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Experience&lt;/strong&gt;: If the buffer empties, playback pauses to rebuild it. Smart clients might lower quality proactively to avoid this.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Storage&lt;/strong&gt;: Some apps cache chunks locally (e.g., on your device) to speed up replays or handle offline viewing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Buffering is a balancing act: too small, and you risk interruptions; too large, and you waste bandwidth preloading video you might never watch.&lt;/p&gt;




&lt;h2&gt;
  
  
  Optimizing Video Streaming Services
&lt;/h2&gt;

&lt;p&gt;Streaming services face constant pressure to deliver fast, high-quality video without breaking the bank. Optimization happens at multiple levels—server, network, and client. Here are some key strategies:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Adaptive Bitrate Streaming (ABR)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Encode each chunk at multiple bitrates (e.g., 500 kbps, 2 Mbps, 5 Mbps). The client picks the best quality based on real-time network conditions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Reduces buffering by dropping to lower quality during slowdowns, then scaling back up when bandwidth allows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pseudocode&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function fetchNextChunk(manifest, position, networkSpeed):
      availableQualities = manifest.getQualities()
      bestQuality = selectQualityBasedOnSpeed(availableQualities, networkSpeed)
      return downloadChunk(manifest, position, bestQuality)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Content Delivery Networks (CDNs)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Store chunks on servers close to users (e.g., Cloudflare, Akamai). A viewer in Tokyo hits a Tokyo-based server, not one in New York.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Cuts latency and reduces load on origin servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Efficient Encoding
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Use modern codecs like H.265 (HEVC) or AV1 instead of H.264. These compress video better, shrinking chunk sizes without sacrificing quality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Less bandwidth per chunk, faster downloads, happier buffers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Client-Side Caching
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Cache frequently accessed chunks (e.g., intros, popular scenes) on the user’s device or in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Reduces server requests, especially for rewatches.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Predictive Preloading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Use machine learning to guess which video (or chunks) a user might watch next and preload them during idle time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pseudocode&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function preloadNextVideo(userHistory):
      predictedVideo = predictNextWatch(userHistory)
      initialChunks = fetchInitialChunks(predictedVideo, lowQuality)
      storeInBackgroundCache(initialChunks)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Rate Limiting and Throttling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Cap bandwidth for users on slow connections to prioritize quality over quantity, or limit excessive rewinds/seeks to reduce server strain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Keeps costs predictable during spikes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Progressive Download Fallback
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: For less critical content (e.g., tutorials), allow full chunk downloads in the background while playing, rather than pure streaming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit&lt;/strong&gt;: Simpler for stable networks, less server overhead.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Video streaming services are a marvel of distributed systems and clever engineering. By breaking videos into chunks, they make massive files manageable and enable seamless delivery over the internet. Buffering keeps playback smooth on the client side, adapting to network hiccups with a mix of preloading and quality tweaks. And through optimizations like ABR, CDNs, and smart encoding, providers ensure you get your cat videos or 4K movies with minimal lag—at scale.&lt;/p&gt;

&lt;p&gt;Next time you hit “play,” think about the army of chunks racing from a server somewhere, filling your buffer just in time to keep the show going. It’s not magic—it’s just really good tech.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>architecture</category>
      <category>aws</category>
      <category>microservices</category>
    </item>
    <item>
      <title>When Should You Consider Using Microservices?</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Sun, 23 Feb 2025 08:15:44 +0000</pubDate>
      <link>https://dev.to/looph0le/when-should-you-consider-using-microservices-2hc9</link>
      <guid>https://dev.to/looph0le/when-should-you-consider-using-microservices-2hc9</guid>
      <description>&lt;p&gt;Microservices are a hot topic in software development, but they’re not a magic bullet. They can transform how you build and scale applications, or they can bog you down in complexity if you adopt them at the wrong time. So, when does it make sense to ditch the old-school monolith and break your app into smaller, independent pieces? Let’s walk through the signs and scenarios, with some plain-English explanations of the jargon along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Microservices, Anyway?
&lt;/h2&gt;

&lt;p&gt;Microservices are a way of designing an application as a &lt;strong&gt;collection of small, self-contained services&lt;/strong&gt;. Each service does one job—like handling payments, managing user logins, or serving up content—and runs independently. They talk to each other over a network (usually via APIs) instead of being glued together in one big codebase. Compare that to a monolith, where everything—your app’s frontend, backend, database logic—lives in a single, unified program. Think of a monolith as a Swiss Army knife: versatile but bulky. Microservices? They’re a set of specialized tools, each sharpened for its task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Major usecase
&lt;/h2&gt;

&lt;p&gt;If your development team is growing and you’ve got multiple people (or squads) working on the same app, a monolith can turn into a coordination nightmare. Imagine one team tweaking the payment system while another’s revamping the user dashboard—all in the same codebase. Every change risks breaking something unrelated, and merging code becomes a game of whack-a-mole.&lt;/p&gt;

&lt;p&gt;Microservices let you split the app into domains—logical chunks like “payments” or “authentication”—and assign each to its own service. Teams can then work in parallel, deploying their service without touching the others. It’s like giving each crew their own sandbox instead of sharing one crowded playground.&lt;/p&gt;

&lt;p&gt;Deploying just means pushing your code live so users can access it. In a monolith, you deploy the whole app at once. With microservices, you deploy only the service you’ve changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your App’s Needs Don’t Scale Evenly
&lt;/h2&gt;

&lt;p&gt;Not every part of your app gets the same workout. Maybe your payment system gets hammered during a flash sale, but your blog section just sits there quietly. In a monolith, scaling up means scaling everything—you’re renting a bigger server for the whole app, even the parts that don’t need it. That’s wasteful.&lt;/p&gt;

&lt;p&gt;With microservices, you can scale each piece independently. Need more juice for payments? Spin up extra instances of that service alone. This is where horizontal scaling comes in: adding more machines (or containers) to handle load, rather than beefing up one giant server. Cloud platforms like AWS or Kubernetes make this a breeze—but it’s overkill if your app’s still small and predictable.&lt;/p&gt;

&lt;p&gt;Scaling is about handling more users or traffic. Horizontal scaling adds more servers; vertical scaling upgrades the one you’ve got.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploys Are Slow and Risky
&lt;/h2&gt;

&lt;p&gt;Ever dread pushing a tiny update because it means rebuilding and redeploying your entire app? In a monolith, even a one-line fix can trigger a full test suite and a nail-biting rollout. If something breaks, good luck figuring out what went wrong in that massive tangle of code.&lt;/p&gt;

&lt;p&gt;Microservices shrink the blast radius. Each service is its own mini-app with its own codebase and deployment pipeline. A bug in the login service won’t crash your checkout flow. Plus, smaller services are faster to test and deploy, so you can ship updates more often without sweating bullets.&lt;/p&gt;

&lt;p&gt;A codebase is all the source code for a project. A deployment pipeline is the automated process that takes your code from your laptop to the live app.&lt;/p&gt;

&lt;h2&gt;
  
  
  One Tech Stack Doesn’t Fit All
&lt;/h2&gt;

&lt;p&gt;Monoliths lock you into one programming language or framework. Built your app in Java? Great—until you realize Python’s machine-learning libraries would be perfect for your new analytics feature. With a monolith, you’re stuck twisting Java into knots or rewriting everything.&lt;/p&gt;

&lt;p&gt;Microservices let each service pick its own tech stack. Your payment system could stay in Java for reliability, while your analytics service uses Python for data crunching. It’s like letting each chef in a kitchen use their favorite tools instead of forcing them all to wield the same spatula.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Not to Use Microservices
&lt;/h2&gt;

&lt;p&gt;Hold up—don’t start smashing your app apart just yet. Microservices come with trade-offs. They’re a distributed system, meaning your app’s now spread across multiple services talking over a network. That introduces headaches like network latency (delays in communication), data consistency (keeping everything in sync), and extra monitoring to track what’s breaking where. If your app’s simple or your team’s small, these costs might outweigh the benefits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Better Practice
&lt;/h2&gt;

&lt;p&gt;Start with a monolith. It’s easier to build, test, and deploy when you’re small or prototyping. Only when you hit real pain points—like slow deploys, team bottlenecks, or uneven scaling—should you consider refactoring into microservices. As the saying goes: &lt;strong&gt;&lt;em&gt;“Monoliths are your friend until they’re not.”&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>backend</category>
      <category>architecture</category>
      <category>systems</category>
    </item>
    <item>
      <title>How to Set Up a PostgreSQL Database on a VPS and Access It Remotely</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Sun, 08 Sep 2024 06:41:13 +0000</pubDate>
      <link>https://dev.to/looph0le/how-to-set-up-a-postgresql-database-on-a-vps-and-access-it-remotely-5f7i</link>
      <guid>https://dev.to/looph0le/how-to-set-up-a-postgresql-database-on-a-vps-and-access-it-remotely-5f7i</guid>
      <description>&lt;p&gt;Setting up a PostgreSQL database on a Virtual Private Server (VPS) is an essential skill for developers and system administrators who want to manage databases remotely. This guide will walk you through the process of setting up PostgreSQL on a Debian 12 server and configuring it for remote access. &lt;/p&gt;

&lt;h2&gt;
  
  
  1: Create a VPS
&lt;/h2&gt;

&lt;p&gt;To get started, you’ll need a VPS. You can use any cloud provider, but for this guide, we'll assume you're using Vultur. The first step is to create a new VPS instance and select &lt;strong&gt;Debian 12&lt;/strong&gt; as your server operating system.&lt;/p&gt;

&lt;h2&gt;
  
  
  2: Install PostgreSQL
&lt;/h2&gt;

&lt;p&gt;Once your VPS is up and running, connect to it via SSH. Then, update your package list and install PostgreSQL with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command installs PostgreSQL and its associated packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  3: Configure PostgreSQL for Remote Access
&lt;/h2&gt;

&lt;p&gt;By default, PostgreSQL is configured to only allow connections from the local system. To enable remote connections, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Edit the &lt;code&gt;postgresql.conf&lt;/code&gt; file&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open the configuration file located at &lt;code&gt;/etc/postgresql/16/main/postgresql.conf&lt;/code&gt; (the version number &lt;code&gt;16&lt;/code&gt; might vary depending on your PostgreSQL version).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/postgresql/16/main/postgresql.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Locate the line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   #listen_addresses = 'localhost'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uncomment it and change &lt;code&gt;localhost&lt;/code&gt; to &lt;code&gt;*&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   listen_addresses = '*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This change allows PostgreSQL to listen for connections on all available IP addresses.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Edit the &lt;code&gt;pg_hba.conf&lt;/code&gt; file&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, you'll need to modify the &lt;code&gt;pg_hba.conf&lt;/code&gt; file to allow remote access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/postgresql/16/main/pg_hba.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following line to the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   host    all             all             0.0.0.0/0               md5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line allows all users (&lt;code&gt;all&lt;/code&gt;) from any IP address (&lt;code&gt;0.0.0.0/0&lt;/code&gt;) to connect to any database (&lt;code&gt;all&lt;/code&gt;) using password authentication (&lt;code&gt;md5&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  4: Restart PostgreSQL
&lt;/h2&gt;

&lt;p&gt;After making these changes, restart the PostgreSQL service to apply the new configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5: Configure the Firewall
&lt;/h2&gt;

&lt;p&gt;To allow remote connections to your PostgreSQL server, you need to ensure that your firewall permits traffic on port &lt;code&gt;5432&lt;/code&gt; (the default PostgreSQL port). Use the following command to allow traffic on this port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow 5432/tcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command opens port 5432 for TCP connections, enabling remote access to your PostgreSQL database.&lt;/p&gt;

&lt;h2&gt;
  
  
  6: Connect to Your PostgreSQL Database Remotely
&lt;/h2&gt;

&lt;p&gt;With everything configured, you can now connect to your PostgreSQL database remotely using a PostgreSQL client like &lt;code&gt;psql&lt;/code&gt;, DBeaver, or pgAdmin. Use the following connection details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Host&lt;/strong&gt;: The IP address of your VPS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt;: 5432 (or the port you configured).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Username&lt;/strong&gt;: Your PostgreSQL username.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Password&lt;/strong&gt;: Your PostgreSQL password.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt;: The name of the database you want to connect to.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Setting up PostgreSQL on a VPS and configuring it for remote access is a straightforward process that gives you the flexibility to manage your databases from anywhere. By following the steps outlined in this guide, you'll have a fully functional PostgreSQL server accessible from any machine.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>linux</category>
      <category>postgres</category>
      <category>database</category>
    </item>
    <item>
      <title>Shell scripting to change wallpaper - Wallhaven API</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Sun, 01 Sep 2024 18:26:24 +0000</pubDate>
      <link>https://dev.to/looph0le/shell-scripting-to-change-wallpaper-wallhaven-api-gb1</link>
      <guid>https://dev.to/looph0le/shell-scripting-to-change-wallpaper-wallhaven-api-gb1</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;Changing your desktop wallpaper regularly can be a fun way to keep your workspace fresh and inspiring. Automating this task through shell scripting can save time and effort, allowing your system to change wallpapers based on your preferences without manual intervention. In this guide, we'll explore how to use shell scripting with the Wallhaven API to automatically change your wallpaper on a Linux system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsvlo5g2x8qao134nsv1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsvlo5g2x8qao134nsv1.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1culzm56uf3vs22iiyeq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1culzm56uf3vs22iiyeq.png" alt=" " width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is Shell Scripting?
&lt;/h2&gt;

&lt;p&gt;Shell scripting is a way to automate tasks in a Unix-like operating system by writing a series of commands in a file that can be executed by the shell. It allows users to automate repetitive tasks, making it a powerful tool for system administration and everyday tasks.&lt;/p&gt;

&lt;p&gt;Shell scripting is highly useful for automating small tasks in Linux, such as system maintenance, task scheduling, data processing, and more. It helps users perform operations more efficiently, reducing manual effort and the possibility of errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What is the Wallhaven API?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction to Wallhaven&lt;/strong&gt;: Wallhaven is a popular platform known for its vast collection of high-quality wallpapers. Users can explore a wide range of wallpapers, including themes like nature, abstract, anime, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wallhaven API&lt;/strong&gt;: The Wallhaven API provides programmatic access to the Wallhaven database, allowing users to search for wallpapers based on specific criteria such as tags, categories, and resolutions. This API makes it possible to fetch wallpaper URLs and download images directly through scripts or applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API Key&lt;/strong&gt;: To use the Wallhaven API, you need an API key, which you can obtain by creating a free account on Wallhaven. The API key is used to authenticate requests and access the API's features.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Using &lt;code&gt;curl&lt;/code&gt; in Shell Scripting to Fetch API Data
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction to &lt;code&gt;curl&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;curl&lt;/code&gt; is a command-line tool used for transferring data to or from a server using various protocols, including HTTP, HTTPS, FTP, and more. It's commonly used in shell scripting for interacting with APIs, downloading files, and testing server responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basics of Using &lt;code&gt;curl&lt;/code&gt; with APIs&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The basic syntax for making a GET request with &lt;code&gt;curl&lt;/code&gt; is:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl &lt;span class="nt"&gt;-X&lt;/span&gt; GET &lt;span class="s2"&gt;"URL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;For APIs that require headers or authentication, you can add options like &lt;code&gt;-H&lt;/code&gt; for headers and &lt;code&gt;-d&lt;/code&gt; for data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Fetching Data from Wallhaven API&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;curl&lt;/code&gt; to fetch data from the Wallhaven API by sending a GET request to the API endpoint.&lt;/li&gt;
&lt;li&gt;Handle headers and parse JSON responses using tools like &lt;code&gt;jq&lt;/code&gt;, which helps extract specific data points from the JSON output.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Creating the Shell Script to Change the Wallpaper
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tools Needed&lt;/strong&gt;: &lt;code&gt;curl&lt;/code&gt; for making API requests, &lt;code&gt;jq&lt;/code&gt; for parsing JSON responses, a command to set the wallpaper (&lt;code&gt;feh&lt;/code&gt;, &lt;code&gt;gsettings&lt;/code&gt;, &lt;code&gt;swww&lt;/code&gt; for Wayland), &lt;code&gt;aria2c&lt;/code&gt; for downloading images, and &lt;code&gt;wal&lt;/code&gt; for generating themes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Key&lt;/strong&gt;: A valid Wallhaven API key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Script Breakdown&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# Define your Wallhaven API key&lt;/span&gt;
&lt;span class="nv"&gt;KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_API_KEY"&lt;/span&gt;

&lt;span class="c"&gt;# Clear previous wallpapers from the cache&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; /home/looph0le/.cache/wallhaven&lt;span class="k"&gt;*&lt;/span&gt;

&lt;span class="c"&gt;# Accept the wallpaper name or search keyword as an argument&lt;/span&gt;
&lt;span class="nv"&gt;wallname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;

&lt;span class="c"&gt;# Check if a search keyword is provided&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$wallname&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 1 &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="c"&gt;# Fetch wallpaper URL using the Wallhaven API&lt;/span&gt;
  &lt;span class="nv"&gt;imageUrl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"https://wallhaven.cc/api/v1/search?apikey=&lt;/span&gt;&lt;span class="nv"&gt;$KEY&lt;/span&gt;&lt;span class="s2"&gt;&amp;amp;purity=111&amp;amp;categories=111&amp;amp;ratios=16x9&amp;amp;sorting=random&amp;amp;q=&lt;/span&gt;&lt;span class="nv"&gt;$wallname&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | jq .data[].path | &lt;span class="nb"&gt;shuf&lt;/span&gt; &lt;span class="nt"&gt;-n1&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

  &lt;span class="c"&gt;# Format the URL link&lt;/span&gt;
  &lt;span class="nv"&gt;imageLink&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$imageUrl&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;&lt;span class="s1"&gt;'"'&lt;/span&gt; &lt;span class="nt"&gt;-f2&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

  &lt;span class="c"&gt;# Download the wallpaper&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$imageLink&lt;/span&gt;
  aria2c &lt;span class="nt"&gt;-d&lt;/span&gt; ~/.cache/ &lt;span class="nv"&gt;$imageLink&lt;/span&gt;

  &lt;span class="c"&gt;# Generate a theme using pywal&lt;/span&gt;
  wal &lt;span class="nt"&gt;-i&lt;/span&gt; ~/.cache/wallhaven&lt;span class="k"&gt;*&lt;/span&gt;

  &lt;span class="c"&gt;# Set the wallpaper using swww (a wallpaper utility for Wayland)&lt;/span&gt;
  swww query &lt;span class="o"&gt;||&lt;/span&gt; swww init
  swww img ~/.cache/wallhaven&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="nt"&gt;--transition-fps&lt;/span&gt; 60 &lt;span class="nt"&gt;--transition-type&lt;/span&gt; outer &lt;span class="nt"&gt;--transition-duration&lt;/span&gt; 3

  &lt;span class="c"&gt;# Reload Waybar (status bar for Wayland)&lt;/span&gt;
  sh ~/.config/waybar/launch.sh
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Testing and Running the Script
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Execution&lt;/strong&gt;: Save the script with a &lt;code&gt;.sh&lt;/code&gt; extension, make it executable using:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;chmod&lt;/span&gt; +x change_wallpaper.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the script with a keyword to search for a specific type of wallpaper:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  ./change_wallpaper.sh &lt;span class="s2"&gt;"nature"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scheduling with Cron&lt;/strong&gt;: To automate the wallpaper change, add the script to your &lt;code&gt;crontab&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a line to run the script every hour:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  0 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /path/to/change_wallpaper.sh &lt;span class="s2"&gt;"nature"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Conclusion
&lt;/h2&gt;

&lt;p&gt;We have explored how to automate wallpaper changes using shell scripting and the Wallhaven API. By leveraging tools like &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;jq&lt;/code&gt;, and &lt;code&gt;aria2c&lt;/code&gt;, and using utilities for setting wallpapers, you can easily customize your desktop with new wallpapers automatically.&lt;br&gt;
Feel free to modify the script to suit your preferences, such as filtering wallpapers by categories, tags, or resolutions. Explore other API options and enhance your script with additional features.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
      <category>learning</category>
    </item>
    <item>
      <title>Understanding OAuth 2.0</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Thu, 04 Jul 2024 03:58:12 +0000</pubDate>
      <link>https://dev.to/looph0le/understanding-oauth-20-3i8b</link>
      <guid>https://dev.to/looph0le/understanding-oauth-20-3i8b</guid>
      <description>&lt;h2&gt;
  
  
  What is OAuth 2.0?
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 is an authorization framework that allows third-party services to exchange access to user information without revealing the user’s credentials. Instead of sharing credentials, OAuth 2.0 uses access tokens to grant access. This mechanism is widely adopted by major platforms like Google, Facebook, and GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Concepts and Components
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Resource Owner (User)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The resource owner is the user who owns the data stored on the resource server. They grant access to this data to third-party applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Client (Application)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The client is the third-party application that wants to access the user's data on the resource server. It needs authorization from the resource owner to obtain access tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Authorization Server&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The authorization server is responsible for authenticating the resource owner and issuing access tokens to the client after successful authentication and authorization.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Resource Server&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The resource server hosts the protected resources and accepts access tokens from the client to serve the requested resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Access Token&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;An access token is a string representing the authorization granted to the client. It is issued by the authorization server and used by the client to access protected resources on the resource server.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Refresh Token&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A refresh token is used to obtain a new access token without requiring the resource owner to re-authenticate. This enhances user experience by maintaining seamless access.&lt;/p&gt;

&lt;h2&gt;
  
  
  OAuth 2.0 Authorization Flow
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 supports several authorization flows tailored for different scenarios. The most common flows are:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Authorization Code Grant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The authorization code grant is suitable for web applications and involves the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Authorization Request&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client directs the resource owner to the authorization server's authorization endpoint.&lt;/li&gt;
&lt;li&gt;The resource owner authenticates and grants permission.&lt;/li&gt;
&lt;li&gt;The authorization server redirects the resource owner to the client with an authorization code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token Exchange&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client exchanges the authorization code for an access token by making a request to the authorization server's token endpoint.&lt;/li&gt;
&lt;li&gt;The authorization server verifies the authorization code and issues an access token (and optionally a refresh token).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Resource&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client uses the access token to access protected resources on the resource server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Implicit Grant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The implicit grant is optimized for client-side applications, such as single-page applications (SPAs). It omits the token exchange step, directly issuing an access token.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Authorization Request&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client directs the resource owner to the authorization server's authorization endpoint.&lt;/li&gt;
&lt;li&gt;The resource owner authenticates and grants permission.&lt;/li&gt;
&lt;li&gt;The authorization server redirects the resource owner to the client with an access token embedded in the URL fragment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Resource&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client extracts the access token from the URL fragment and uses it to access protected resources on the resource server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Resource Owner Password Credentials Grant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This flow is used in highly trusted applications, such as the official client of a service, where the resource owner’s credentials are directly shared with the client.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Credentials Submission&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client collects the resource owner's username and password.&lt;/li&gt;
&lt;li&gt;The client sends these credentials to the authorization server's token endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token Issuance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The authorization server verifies the credentials and issues an access token (and optionally a refresh token).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Resource&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client uses the access token to access protected resources on the resource server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Client Credentials Grant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The client credentials grant is used for server-to-server communication, where the client is acting on its own behalf rather than on behalf of a user.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token Request&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client sends its own credentials to the authorization server's token endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token Issuance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The authorization server verifies the client credentials and issues an access token.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Resource&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client uses the access token to access protected resources on the resource server.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Security Considerations
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 addresses various security concerns through several mechanisms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scopes:&lt;/strong&gt; Define the level of access requested by the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Parameter:&lt;/strong&gt; Prevents CSRF attacks by maintaining state between the client and authorization server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PKCE (Proof Key for Code Exchange):&lt;/strong&gt; Enhances security in public clients by mitigating interception attacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 has revolutionized the way third-party applications interact with user data, providing a secure and scalable framework for authorization. Understanding its components, flows, and security measures is essential for developers to implement OAuth 2.0 effectively. By leveraging OAuth 2.0, applications can enhance user experience and data security, fostering trust and reliability in digital interactions.&lt;/p&gt;

&lt;p&gt;Whether you're developing a web application, a mobile app, or a server-to-server integration, OAuth 2.0 offers a versatile and robust solution for managing authorization in the modern digital landscape.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>systems</category>
      <category>backend</category>
    </item>
    <item>
      <title>What can you make using JavaScript ?</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Thu, 19 Jan 2023 06:20:12 +0000</pubDate>
      <link>https://dev.to/looph0le/what-can-you-make-using-javascript--gob</link>
      <guid>https://dev.to/looph0le/what-can-you-make-using-javascript--gob</guid>
      <description>&lt;p&gt;JavaScript is a versatile programming language that can be used to build a wide range of applications. Here are just a few examples of what you can build using JavaScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Websites&lt;/strong&gt;: JavaScript can be used to create dynamic, interactive websites. You can use JavaScript to create responsive designs, animations, and user interfaces.&lt;br&gt;
Web Applications: JavaScript can be used to build web applications that run in a browser. These apps can include anything from simple calculators to full-fledged e-commerce platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mobile Applications&lt;/strong&gt;: JavaScript can be used to build mobile apps through frameworks such as React Native, Ionic, or PhoneGap.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Desktop Applications&lt;/strong&gt;: JavaScript can be used to build desktop apps through frameworks such as Electron. Electron allows you to build cross-platform desktop apps using JavaScript, HTML, and CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Games&lt;/strong&gt;: JavaScript can be used to create games that run in a browser. You can use JavaScript to create simple games like Tetris or more complex games like 3D first-person shooters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Machine Learning&lt;/strong&gt;: JavaScript can be used to build machine learning applications with libraries such as TensorFlow.js.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internet of Things (IoT)&lt;/strong&gt; : JavaScript can be used to build IoT applications using libraries such as Johnny-Five.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Back-end Development&lt;/strong&gt;: JavaScript can be used to build server-side applications using Node.js. Node.js allows you to run JavaScript on a server, which is useful for building back-end services such as APIs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Overall, JavaScript is a powerful tool that can be used to build a wide range of applications. With its versatility and continued growth, it has become one of the most popular programming languages in the world.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Computer Science in Academia</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Tue, 03 Jan 2023 19:19:23 +0000</pubDate>
      <link>https://dev.to/looph0le/computer-science-in-academia-41n4</link>
      <guid>https://dev.to/looph0le/computer-science-in-academia-41n4</guid>
      <description>&lt;p&gt;Computer Science as a field of study has been around for decades, but it has only recently become a mainstream topic of discussion. This is because the advancements in technology in the past few decades have made it possible for people to interact with computers in ways that were previously unimaginable. As a result, the demand for individuals with a strong understanding of computer science has skyrocketed, making it a highly sought after field of study in academia.&lt;/p&gt;

&lt;p&gt;But what exactly is computer science and what do those who study it do? At its core, computer science is the study of the design, development, and use of computers and computer systems. This includes everything from the hardware and software that make up a computer to the algorithms and programming languages used to create software applications.&lt;/p&gt;

&lt;p&gt;There are many different subfields within computer science, including artificial intelligence, human-computer interaction, and computer security. Those who study computer science may choose to specialize in one of these areas or choose a more general course of study.&lt;/p&gt;

&lt;p&gt;One of the major advantages of studying computer science in academia is the opportunity to work with and learn from experts in the field. Professors and researchers in computer science are often at the forefront of technological advancements, and students have the opportunity to work with them on research projects and gain valuable hands-on experience.&lt;/p&gt;

&lt;p&gt;In addition to the practical skills gained through coursework and research, studying computer science in academia also provides students with a strong foundation in theoretical concepts. This is important because it helps students understand the underlying principles behind the technology they are working with, rather than simply learning how to use it.&lt;/p&gt;

&lt;p&gt;Overall, studying computer science in academia is a great choice for individuals who are interested in the field and want to gain a strong foundation in the concepts and technologies that drive it. Whether you are looking to enter the workforce after graduation or pursue further studies, a degree in computer science from a reputable academic institution can open many doors and provide a strong foundation for a successful career.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Why javascript for everything?</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Wed, 28 Dec 2022 23:08:30 +0000</pubDate>
      <link>https://dev.to/looph0le/why-javascript-for-everything-19m</link>
      <guid>https://dev.to/looph0le/why-javascript-for-everything-19m</guid>
      <description>&lt;p&gt;JavaScript is a programming language that is essential for modern web development. It is a versatile language that can be used to build a wide range of applications, from simple websites to complex web-based systems. Here are a few reasons why you should consider learning JavaScript:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Demand for JavaScript developers is high: JavaScript is one of the most popular programming languages in the world, and there is a high demand for developers who are proficient in it. According to a survey by the website Indeed, JavaScript is the most sought-after programming language by employers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's easy to learn: JavaScript is a relatively easy language to learn, especially for those who already have some programming experience. There are many resources available online, including tutorials, videos, and online courses, to help you get started.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's versatile: JavaScript can be used for a wide range of applications, including web development, mobile app development, and even desktop applications. This versatility makes it a valuable skill to have in your toolkit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's constantly evolving: The JavaScript ecosystem is constantly evolving, with new libraries and frameworks being developed all the time. This means that there is always something new to learn, and you can stay up-to-date with the latest developments in the field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's fun: JavaScript is a fun language to work with, and it allows you to build interactive and engaging websites and applications. This can make learning and using it a rewarding and enjoyable experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In conclusion, learning JavaScript is a valuable skill that can open up a wide range of opportunities for you as a developer. It is a versatile language that is in high demand, easy to learn, and constantly evolving. Whether you are a beginner or an experienced developer, learning JavaScript is a great investment in your career.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Why i use Arch other than any Linux distribution and you should NOT as a noob ?</title>
      <dc:creator>Mitansh Panchal</dc:creator>
      <pubDate>Mon, 08 Aug 2022 16:16:49 +0000</pubDate>
      <link>https://dev.to/looph0le/why-i-use-arch-other-than-any-linux-distribution-and-you-should-not-as-a-noob--30dm</link>
      <guid>https://dev.to/looph0le/why-i-use-arch-other-than-any-linux-distribution-and-you-should-not-as-a-noob--30dm</guid>
      <description>&lt;h2&gt;
  
  
  First of all, why even Linux &amp;lt;?&amp;gt;
&lt;/h2&gt;

&lt;p&gt;If you have been using computers enough, you seem to have no reason to switch a whole new operating systems.&lt;br&gt;
There might be some reasons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows just works, Which is true.&lt;/li&gt;
&lt;li&gt;Linux just seems too much learning!&lt;/li&gt;
&lt;li&gt;I'm comfortable with windows, thanks!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Today i want to share few things with you guys that changed from introduction of Linux in my programming career.&lt;/p&gt;

&lt;p&gt;Let's be straight here, Linux is cool. When you see someone using it you already assume he must be a genius. All those terminals open on the screen, text running through it.&lt;br&gt;
But in reality all hes doing is just running update commands or cmatrix[A matrix effect on the terminal].&lt;/p&gt;

&lt;p&gt;The thing is, you can also it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;linux is not hard.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You don't have to star hard. Thats what i have seen people do while moving new to linux.&lt;br&gt;
They want to run Arch linux on the first go because they want the best distro.&lt;br&gt;
No doubt Arch is the distro to go for but its too early for that. Getting an idea on what your going in is important.&lt;br&gt;
Learning how things work is important.&lt;br&gt;
Knowing the new environment is what should be the goal. &lt;/p&gt;

&lt;p&gt;If you want to get in, without having to know anything about linux.&lt;br&gt;
Just get a Ubuntu installed. and use it.&lt;br&gt;
Use for chilling, browsing web. get use to the new environment. And trust me once you get it, you dont wanna look back to windows.&lt;/p&gt;

&lt;p&gt;And about the command line.&lt;br&gt;
I'll say once you get the linux environment you'll learn the tools too.&lt;br&gt;
Just be patient and relax. Relax with linux and you will not need to learn it.&lt;/p&gt;

&lt;p&gt;Thanks for reading !&lt;/p&gt;

</description>
      <category>linux</category>
      <category>productivity</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
