<?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>Forem: Nkwochamaureen</title>
    <description>The latest articles on Forem by Nkwochamaureen (@nkwochamaureen).</description>
    <link>https://forem.com/nkwochamaureen</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%2F3200778%2F24fd3c95-d560-4301-8ed1-9222bc5d13d7.jpg</url>
      <title>Forem: Nkwochamaureen</title>
      <link>https://forem.com/nkwochamaureen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nkwochamaureen"/>
    <language>en</language>
    <item>
      <title>Job market is crazy so i decided to hop on the hackattic.com challenge</title>
      <dc:creator>Nkwochamaureen</dc:creator>
      <pubDate>Mon, 13 Apr 2026 01:59:49 +0000</pubDate>
      <link>https://forem.com/nkwochamaureen/job-market-is-crazy-so-i-decided-to-hop-on-the-hackatticcom-challenge-42gh</link>
      <guid>https://forem.com/nkwochamaureen/job-market-is-crazy-so-i-decided-to-hop-on-the-hackatticcom-challenge-42gh</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/Nkwochamaureen/Redis-hackattic" rel="noopener noreferrer"&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%2Fmsguadoi9zy2cwx9pds2.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%2Fmsguadoi9zy2cwx9pds2.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;# Redis RDB Binary Parser &amp;amp; Data Extractor&lt;/p&gt;

&lt;h2&gt;
  
  
  📌 Project Overview
&lt;/h2&gt;

&lt;p&gt;This project is a high-performance binary parser built to interact with Redis RDB (Redis Database) snapshots. The goal was to programmatically fetch a raw, base64-encoded RDB dump from an API, "heal" a corrupted binary header, and traverse the byte stream to extract specific metadata without using standard Redis tools.&lt;/p&gt;

&lt;p&gt;This challenge mimics real-world Cloud Disaster Recovery scenarios where an engineer must recover data from a corrupted backup or perform offline analysis of database snapshots for cost and performance optimization.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Technical Challenges &amp;amp; Solutions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Binary Header "Healing"&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The RDB snapshots provided were intentionally tampered with by corrupting the "Magic Bytes" (the first 9 bytes of the file).&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; I implemented a fix that manually overwrites the corrupted header with a valid &lt;code&gt;REDIS0007&lt;/code&gt; signature, allowing the binary stream to be processed by custom logic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Variable-Length Encoding Logic&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Redis saves space by using a complex length-encoding scheme where the first two bits of a byte determine how many subsequent bytes represent a length or a special integer type.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Built a bit-masking logic to decode 6-bit, 14-bit, and 32-bit lengths, ensuring the parser never "loses its place" in the stream.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;State-Machine Byte Parsing&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The parser functions as a state machine, walking through the binary data and responding to specific opcodes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0xFE&lt;/code&gt;: Database Selector (used to track the total &lt;code&gt;db_count&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0xFD&lt;/code&gt; &amp;amp; &lt;code&gt;0xFC&lt;/code&gt;: Expiry timestamps in Seconds/Milliseconds&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0xFF&lt;/code&gt;: End of File marker&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Handling Optimized Data Blobs (Ziplists / Intsets)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Modern Redis versions store collections (Sets, Lists, Hashes) as single "encoded blobs" rather than individual strings to save RAM.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Developed a robust &lt;code&gt;skip_value&lt;/code&gt; function to handle both "Old Style" collections and "Modern" encoded types (&lt;code&gt;Types 9-14&lt;/code&gt;), preventing buffer overruns and &lt;code&gt;IndexError&lt;/code&gt;s.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🚀 Key Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Emoji Detection:&lt;/strong&gt; Scans for non-ASCII key names in the binary stream to identify and extract unique emoji-based keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TTL Extraction:&lt;/strong&gt; Captures and converts Unix timestamps from binary to human-readable / millisecond formats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Key Typing:&lt;/strong&gt; Identifies the internal Redis data type (&lt;code&gt;String&lt;/code&gt;, &lt;code&gt;Hash&lt;/code&gt;, &lt;code&gt;Set&lt;/code&gt;, etc.) for any specific key requested by the requirements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud-Ready Security:&lt;/strong&gt; Implements &lt;code&gt;.env&lt;/code&gt; project isolation to handle API access tokens securely.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>backend</category>
      <category>career</category>
      <category>database</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
