<?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: Dhravya</title>
    <description>The latest articles on DEV Community by Dhravya (@dhravya).</description>
    <link>https://dev.to/dhravya</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%2F752901%2F31c74da2-8ec6-47e9-b90c-f422a71a102b.png</url>
      <title>DEV Community: Dhravya</title>
      <link>https://dev.to/dhravya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhravya"/>
    <language>en</language>
    <item>
      <title>Supermemory - ChatGPT for your bookmarks</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Mon, 15 Apr 2024 01:04:16 +0000</pubDate>
      <link>https://dev.to/dhravya/supermemory-chatgpt-for-your-bookmarks-4nc7</link>
      <guid>https://dev.to/dhravya/supermemory-chatgpt-for-your-bookmarks-4nc7</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/devteam/join-us-for-the-cloudflare-ai-challenge-3000-in-prizes-5f99"&gt;Cloudflare AI Challenge&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built a way to build your own second brain, using Cloudflare Vectorize and Workers AI. &lt;/p&gt;

&lt;p&gt;Here's the idea&lt;br&gt;
Build your own second brain with supermemory. It's a ChatGPT for your bookmarks. Import tweets or save websites and content using the chrome extension (the extension on webstore is not updated, please use the one in the repo)&lt;/p&gt;

&lt;p&gt;Well, here's the thing - me and @yxshv save a lot of content on the internet.&lt;/p&gt;

&lt;p&gt;Twitter bookmarks, websites, snippets, etc.&lt;/p&gt;

&lt;p&gt;But we never look back to it - to us, it's like throwing information in the void.&lt;/p&gt;

&lt;p&gt;Supermemory fixes this.&lt;/p&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;



&lt;p&gt;Here's the deployed demo - &lt;a href="https://supermemory.dhr.wtf" rel="noopener noreferrer"&gt;https://supermemory.dhr.wtf&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;And here's the demo video &lt;a href="https://www.loom.com/share/23b56648da3d4d8080b542a60cb9c8b6" rel="noopener noreferrer"&gt;https://www.loom.com/share/23b56648da3d4d8080b542a60cb9c8b6&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  My Code
&lt;/h2&gt;

 


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/supermemoryai" rel="noopener noreferrer"&gt;
        supermemoryai
      &lt;/a&gt; / &lt;a href="https://github.com/supermemoryai/supermemory" rel="noopener noreferrer"&gt;
        supermemory
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Build your own second brain with supermemory. It's a ChatGPT for your bookmarks. Import tweets or save websites and content using the chrome extension.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/b2724bc1e4a10b817ac238ff6899012ac47113e16ab84c9f6f0e29960d6716b4/68747470733a2f2f73757065726d656d6f72792e61692f6f672d696d6167652e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/b2724bc1e4a10b817ac238ff6899012ac47113e16ab84c9f6f0e29960d6716b4/68747470733a2f2f73757065726d656d6f72792e61692f6f672d696d6167652e706e67" alt="og image"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;SuperMemory&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Interested in helping build the best second brain for everyone? Join the discord &lt;a href="https://discord.gg/2X2XsKz5AU" rel="nofollow noopener noreferrer"&gt;https://discord.gg/2X2XsKz5AU&lt;/a&gt;. Contributions welcome.&lt;/p&gt;
&lt;div&gt;
  &lt;a href="https://github.com/Dhravya/Supermemory/stargazers" rel="noopener noreferrer"&gt;
    &lt;img src="https://camo.githubusercontent.com/8c92445e486972406f293ffa6ae274aeba6b3562b07db2aa06a22b0a9b48cc73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f446872617679612f53757065726d656d6f72793f7374796c653d666c61742d737175617265266c6f676f3d676974687562" alt="GitHub stars"&gt;
  &lt;/a&gt;
  &lt;a href="https://github.com/Dhravya/Supermemory/network/members" rel="noopener noreferrer"&gt;
    &lt;img src="https://camo.githubusercontent.com/e515526e8fce5eaf948f1417e22cb865078f2848da8dbf0fa309aa58141e965f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f446872617679612f73757065726d656d6f72793f7374796c653d666c61742d737175617265266c6f676f3d67697468756226636f6c6f723d386165386666" alt="GitHub forks"&gt;
  &lt;/a&gt;
  &lt;a href="https://github.com/Dhravya/Supermemory/graphs/contributors" rel="noopener noreferrer"&gt;
    &lt;img src="https://camo.githubusercontent.com/d001b95d1a7ce28873ccb80fdafc1327e6ec3832ea8c44e1866856e25bed4d92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f446872617679612f53757065726d656d6f72793f7374796c653d666c61742d737175617265266c6f676f3d676974687562" alt="GitHub contributors"&gt;
  &lt;/a&gt;
  &lt;a href="https://chrome.google.com/webstore/detail/supermemory/afpgkkipfdpeaflnpoaffkcankadgjfc" rel="nofollow noopener noreferrer"&gt;
    &lt;img src="https://camo.githubusercontent.com/2457c37517eb0d94adc2fea0b5eda5bb6c0df39311c8442bd32b8e9d2ac5d950/68747470733a2f2f696d672e736869656c64732e696f2f6368726f6d652d7765622d73746f72652f762f616670676b6b69706664706561666c6e706f6166666b63616e6b6164676a66633f7374796c653d666c61742d73717561726526636f6c6f723d79656c6c6f77" alt="Chrome Web Store"&gt;
  &lt;/a&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;👀 What is this?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Build your own second brain with supermemory. It's a ChatGPT for your bookmarks. Import tweets or save websites and content using the &lt;a href="https://chromewebstore.google.com/detail/supermemory/afpgkkipfdpeaflnpoaffkcankadgjfc?hl=en-GB&amp;amp;authuser=0" rel="nofollow noopener noreferrer"&gt;Chrome extension&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Well, here's the thing - me and @yxshv save a &lt;em&gt;lot&lt;/em&gt; of content on the internet.&lt;/p&gt;
&lt;p&gt;Twitter bookmarks, websites, snippets, etc.&lt;/p&gt;
&lt;p&gt;But we never look back to it - to us, it's like throwing information in the void.&lt;/p&gt;
&lt;p&gt;Supermemory fixes this.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Key Features&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;💡 &lt;strong&gt;Ideation&lt;/strong&gt;: Capture and save ideas effortlessly.&lt;/li&gt;
&lt;li&gt;🔖 &lt;strong&gt;Bookmarks&lt;/strong&gt;: Import, organize, and resurface bookmarks when needed.&lt;/li&gt;
&lt;li&gt;📇 &lt;strong&gt;Contacts&lt;/strong&gt;: Store and manage information about people you know.&lt;/li&gt;
&lt;li&gt;🐦 &lt;strong&gt;Twitter Bookmarks&lt;/strong&gt;: Import and utilize your saved tweets.&lt;/li&gt;
&lt;li&gt;🔍 &lt;strong&gt;Powerful Search&lt;/strong&gt;: Quickly find any saved information.&lt;/li&gt;
&lt;li&gt;💬 &lt;strong&gt;Chat with Collections&lt;/strong&gt;: Interact with specific knowledge bases.&lt;/li&gt;
&lt;li&gt;🖼️ &lt;strong&gt;Knowledge Canvas&lt;/strong&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/supermemoryai/supermemory" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;It all started when I saw this company in YC batch 2024 (&lt;a href="https://zenfetch.com" rel="noopener noreferrer"&gt;https://zenfetch.com&lt;/a&gt;) - I was determined that I can make something like that, even better, and open source it. &lt;/p&gt;

&lt;p&gt;So, over the weekend, I built the version 0 of supermemory (and i called it anycontext) - it wasn't great. Very buggy and far from useful. But the bottom line was - I built a competitor to zenfetch in just a weekend.&lt;/p&gt;

&lt;p&gt;Then, one day, I opened dev.to and found out about the cloudflare dev challenge! Hell yes! I've been a big fan of cloudflare and winning this would be amazing. So, I reached out to &lt;a class="mentioned-user" href="https://dev.to/yxsh"&gt;@yxsh&lt;/a&gt; for his help. Yash is an amazing design engineer and was able to completely redesign and revamp the user interface in just about 15 days, even though he's fully busy with classes and studies!!!&lt;/p&gt;

&lt;p&gt;We also revamped the entire database, vector store, and even the AI generation to make it as good as possible. Added support for notes and spaces. Added import twitter bookmarks option.&lt;/p&gt;

&lt;p&gt;As we did, the architecture became more and more complex, and seeing everything work so perfectly was just such an amazing feeling.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z5r14cyhtwbb2j9hjuq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z5r14cyhtwbb2j9hjuq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, Supermemory is the true second brain for both of us. Saving and forgetting content is a thing of the past.&lt;/p&gt;

&lt;p&gt;So, are you ready to supercharge your memory? Go to &lt;a href="https://supermemory.dhr.wtf" rel="noopener noreferrer"&gt;https://supermemory.dhr.wtf&lt;/a&gt; and try it out for yourself!&lt;/p&gt;

&lt;p&gt;Teammates:&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/dhravya"&gt;@dhravya&lt;/a&gt;, &lt;a class="mentioned-user" href="https://dev.to/yxsh"&gt;@yxsh&lt;/a&gt; &lt;/p&gt;

</description>
      <category>cloudflarechallenge</category>
      <category>devchallenge</category>
      <category>ai</category>
    </item>
    <item>
      <title>Need some advice!</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Thu, 02 Feb 2023 06:52:48 +0000</pubDate>
      <link>https://dev.to/dhravya/need-some-advice-mm1</link>
      <guid>https://dev.to/dhravya/need-some-advice-mm1</guid>
      <description>&lt;p&gt;Twitter just announced that there will no longer be free access to the twitter API. (&lt;a href="https://twitter.com/TwitterDev/status/1621026986784337922" rel="noopener noreferrer"&gt;https://twitter.com/TwitterDev/status/1621026986784337922&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Hi! I'm Dhravya - a 17 year old maker. I have a small twitter tool - &lt;a href="https://twitter.com/poet_this" rel="noopener noreferrer"&gt;https://twitter.com/poet_this&lt;/a&gt;, which includes the website &lt;a href="https://tweets.beauty" rel="noopener noreferrer"&gt;https://tweets.beauty&lt;/a&gt; and the API &lt;a href="https://api.tweets.beauty" rel="noopener noreferrer"&gt;https://api.tweets.beauty&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I got some donations at the start which helped me pay for the hosting costs, but that's been it.&lt;/p&gt;

&lt;p&gt;And the main problems start here.&lt;br&gt;
I'm a student and indie developer, and I have crucial examinations coming up in just 20 days. I wanted to monetise the bot after exams to create a revenue stream for myself, but the timing is very, very bad.&lt;/p&gt;

&lt;p&gt;So, what do I do?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loss for a couple of months and monetise later&lt;/li&gt;
&lt;li&gt;Sell the project + twitter acc and start with a new side project right after the exams&lt;/li&gt;
&lt;li&gt;Ask for donations and keep the project free for as long as I can&lt;/li&gt;
&lt;li&gt;Start selling the entire codebase to multiple people (on license basis? not sure.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I choose to sell the project, where do I sell a side project? How do I get buyers?&lt;/p&gt;

&lt;p&gt;Here's why I kept my project free:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proof of work.&lt;/li&gt;
&lt;li&gt;I wanted the maximum number of users so that I could have a boost for later projects&lt;/li&gt;
&lt;li&gt;It wasn't expensive to host or difficult to make, and I don't think I could provide enough value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What do you think? Any advice would be greatly appreciated!&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Deploy your functions and use them everywhere⚡⚡</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Fri, 20 Jan 2023 14:54:37 +0000</pubDate>
      <link>https://dev.to/dhravya/deploy-your-functions-and-use-them-everywhere-43p3</link>
      <guid>https://dev.to/dhravya/deploy-your-functions-and-use-them-everywhere-43p3</guid>
      <description>&lt;p&gt;A beginners tutorial written in a funny way - You'll learn how to get started with cloudflare workers, and IOS shortcuts (and hopefully also get a laugh!)&lt;/p&gt;

&lt;p&gt;I had a small API that me and my friends wrote in Python FastAPI - I hosted that API on my server. But the entire API was kinda useless so I shut it down.&lt;/p&gt;

&lt;p&gt;I did the unthinkable. I forgot that one of my favorite functions, &lt;a href="https://gist.github.com/Dhravya/34e68e21bd33cf8ec19999ebe3ad2f1b" rel="noopener noreferrer"&gt;owofy.py&lt;/a&gt; was part of that project. After almost one year, I began on a quest to revive it. &lt;/p&gt;

&lt;p&gt;It was a silly function that basically creates a funny "owofied" piece of text.&lt;br&gt;
&lt;code&gt;Oh... Hai thewe (。O⁄ ⁄ω⁄ ⁄ O。)It was a siwly function that basically creates a funny "owofied" piece of text. UwU&lt;/code&gt;&lt;br&gt;
uhhhh... yeah, you get it.&lt;/p&gt;

&lt;p&gt;I NEEDED to revive it. At all costs. I needed that in my phone, laptop everywhere. I had to harness the power of uwufying. It was my path to enlightenment. Without the owofy API, I would remain plebeian for eternity.&lt;/p&gt;

&lt;p&gt;So, let's do this! Let's create a typescript function that uwufies text, set up cloudflare workers and create an IOS shortcut so that we can uwufy text everywhere 😱😱&lt;/p&gt;

&lt;p&gt;If you don't know what a cloudflare worker is, or what IOS shortcuts are, this blog isn't...&lt;br&gt;
jk. Don't worry. I'll explain it all. &lt;/p&gt;
&lt;h2&gt;
  
  
  Owofying text
&lt;/h2&gt;

&lt;p&gt;Let's start with creating the owofy function itself. We need to take text, and use start with a dumb "Haiii OwO"-like phrase. add suffixes to words, replace "why" with "wai" and stuff. OK I won't bore you with the function itself, it's pretty simple.&lt;/p&gt;

&lt;p&gt;I totally didn't take the help of ChatGPT and github copilot because I was having an issue with typescript and was trying to be extra cool solving it with generics.&lt;br&gt;
totally not. &lt;/p&gt;

&lt;p&gt;Anyways! &lt;a href="https://gist.github.com/Dhravya/569eee563066c1919714eaeb6c9c8c8d" rel="noopener noreferrer"&gt;Here's the TS code&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  WTF is a cloudflare worker?
&lt;/h2&gt;

&lt;p&gt;To understand cloudflare workers, we need to understand what "serverless" is.&lt;/p&gt;

&lt;p&gt;In short, serverless is a way to deploy code without having to manage a server.&lt;/p&gt;

&lt;p&gt;OH- I hear that. You need an analogy.&lt;br&gt;
You own a kitchen because you really like pizzas. You purchased the land (server), you hired a chef - or learnt how to make food yourself (system admin), and you are also the one who mops the floors and maintain the kitchen, keep it neat and clean. Your kitchen could burn down btw. &lt;/p&gt;

&lt;p&gt;or, you can just order food from a food delivery app. Give it your exact recipe, pay for the food and delivery. And you get your pizza without any hassle. The difference is, ordering is much cheaper because the same network of kitchens provides pizza to a lot of other people. They have the best chefs, the fastest ovens, the best delivery network. Even if one of their kitchens burn down, all the others will stay active.&lt;/p&gt;

&lt;p&gt;Got it? Cloudflare is, infact, the biggest "pizza provider" in the world. &lt;br&gt;
Or in other words, Cloudflare has it's servers EVERYWHERE. You can't really move your own pizza kitchen, or make thousands of kitchens all around the world.&lt;/p&gt;

&lt;p&gt;That's the power of serverless. Amazing performance, reliability, speed and scale, while also being convenient to use.&lt;br&gt;
Does that mean serverless has no servers? Nope! Obviously, the servers do exist somewhere, they are just abstracted away and we don't need to deal with all that.&lt;/p&gt;
&lt;h3&gt;
  
  
  OK, NOW GETTING TO THE PROGRAMMING AGAIN.
&lt;/h3&gt;

&lt;p&gt;Hey, this is very important - &lt;em&gt;extremely&lt;/em&gt; important for our path to enlightenment. Yes, &lt;em&gt;you have to join me&lt;/em&gt;. Together, we can uwufy the entire internet.&lt;br&gt;
CODE ALONG!! Don't just read, you won't get anything.&lt;/p&gt;



&lt;p&gt;Let get stuff done first:&lt;br&gt;
First, &lt;a href="https://cloudflare.com" rel="noopener noreferrer"&gt;Create a Cloudflare account&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, now, we have to do some installations (you could just do everything on the cloudflare dashboard but that would be cringe)&lt;/p&gt;

&lt;p&gt;First, &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;install &lt;code&gt;nodejs&lt;/code&gt;&lt;/a&gt; if you don't have it yet (We would need NPM to download &lt;code&gt;wrangler&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;What is wrangler? It's basically a tool that cloudflare has made to make our lives easier. It helps us make cloudflare workers. &lt;/p&gt;

&lt;p&gt;Let's install wrangler (run this in your terminal) -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g wrangler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;(the &lt;code&gt;-g&lt;/code&gt; flag is the global flag, it means that wrangler will be available globally, and you can run it with the &lt;code&gt;wrangler&lt;/code&gt; command)&lt;/p&gt;

&lt;p&gt;Now, log into wrangler with your cloudflare account.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wrangler login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Creating the worker
&lt;/h3&gt;

&lt;p&gt;Congratulations! We have taken the first step to enlightenment. The uwufication of the universe. Now let's start a project.&lt;/p&gt;

&lt;p&gt;Use the command &lt;code&gt;wrangler init owofy-the-world&lt;/code&gt;&lt;br&gt;
It will ask you some questions. It's your choice if you want to use typescript!!! In this project, I have used typescript because js isn't my cup of tea ☕&lt;/p&gt;

&lt;p&gt;BTW - If you want to code in python or some other language, check this out - &lt;a href="https://developers.cloudflare.com/workers/platform/languages/" rel="noopener noreferrer"&gt;Languages supported by workers&lt;/a&gt;&lt;br&gt;
I'll be completely honest, the python one seems completely broken. But other than that, all languages work!&lt;/p&gt;

&lt;p&gt;This will create a folder named &lt;code&gt;owofy-the-world&lt;/code&gt;. Open your editor in that folder&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%2Fumv8530tlspognbpp1fm.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%2Fumv8530tlspognbpp1fm.png" alt="Wrangler project config" width="800" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should have a file called &lt;code&gt;src/index.js&lt;/code&gt; (or &lt;code&gt;.ts&lt;/code&gt;), and a file called &lt;code&gt;wrangler.toml&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let's understand!&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Path: src/index.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ExecutionContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello World!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Over here, the function is exporting a &lt;code&gt;fetch()&lt;/code&gt; function - Which has &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;request&lt;/code&gt; - so we can access stuff about the &lt;em&gt;request itself&lt;/em&gt; things like URL, HTTP headers, HTTP method, and stuff.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;env&lt;/code&gt; - Any variables we might need (for things like KV database)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ctx&lt;/code&gt; - The &lt;em&gt;context&lt;/em&gt; of the execution (don't worry about this for now)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First of all, to owofy, we need the params. &lt;br&gt;
Let's say, I pass the text like this:&lt;br&gt;
&lt;code&gt;website.com/?text=Here's the text to be owofied&lt;/code&gt;&lt;br&gt;
How do we get the stuff after &lt;code&gt;text=&lt;/code&gt; 🤔 &lt;/p&gt;

&lt;p&gt;Wait - it's part of the URL! Let's just parse the URL and get the text out of it!&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%2F1i2inssnygr29r38l441.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%2F1i2inssnygr29r38l441.png" alt="index.ts- export default {&amp;lt;br&amp;gt;
  async fetch(request: Request, env: any, ctx: ExecutionContext) {&amp;lt;br&amp;gt;
    const text = new URL(request.url).searchParams.get('text');&amp;lt;br&amp;gt;
  },&amp;lt;br&amp;gt;
};" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;COOL! You can take any number of params, any param in general. You can even have authorization with headers, run your own functions and return whatever you want to!&lt;/p&gt;

&lt;p&gt;But we are on a mission, soldier. We NEED to owofy the text! So, we'll just put our function there...&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;owofy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{...}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ExecutionContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;searchParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;owofy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You betrayed me. no text!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is IT! YES! It's that easy to create a cloudflare function. Now, imagine all the things you could do with it. One of my friends, Mohit, wrote a really good blog post on one such use case - &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/just_moh_it" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F824670%2Fb5861ff3-dc14-4ae0-952f-e582a90c3cef.png" alt="just_moh_it"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/just_moh_it/how-to-serve-any-website-from-your-own-domain-for-free-44l9" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How to serve *any* website from your own domain (for free!)&lt;/h2&gt;
      &lt;h3&gt;Mohit Yadav ・ Aug 13 '22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;Cloudflare also has a lot of &lt;a href="https://developers.cloudflare.com/workers/examples" rel="noopener noreferrer"&gt;examples&lt;/a&gt; that you should check out!!!&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying the worker
&lt;/h3&gt;

&lt;p&gt;Just use the command &lt;code&gt;wrangler publish&lt;/code&gt;. Yes. that's literally it. That's right - You don't need to anything. &lt;br&gt;
Now you can sit peacefully, and owofy all the text you can in the world. &lt;/p&gt;

&lt;p&gt;This will be published on a &lt;code&gt;yourname.workers.dev&lt;/code&gt; URL - ughh, that's ugly! To change the world, we need to put it on &lt;code&gt;owo.customdomain.com&lt;/code&gt;! &lt;br&gt;
You can add a custom domain, custom routes and a lot more in the cloudflare dashboard workers page.&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%2Fxkce77z31tqkes75x93a.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%2Fxkce77z31tqkes75x93a.png" alt="Custom domain" width="800" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  WTF is an IOS shortcut?
&lt;/h2&gt;

&lt;p&gt;I know not everyone uses IOS so I'll keep this short! &lt;br&gt;
IOS shortcuts are automations that you can run on your mac or iphone. Creating shortcuts is probably the most easiest things to do now - and it's really fun! &lt;/p&gt;

&lt;p&gt;"Hey siri, make this cringe"&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use text from clipboard&lt;br&gt;
Get contents of URL &lt;code&gt;yourname.workers.dev/?text={ClipboardText}&lt;/code&gt;&lt;br&gt;
Copy content to clipboard.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it. Here's the shortcut I made - &lt;a href="https://www.icloud.com/shortcuts/48917df04e4c4838864d5a29b698c2cf" rel="noopener noreferrer"&gt;https://www.icloud.com/shortcuts/48917df04e4c4838864d5a29b698c2cf&lt;/a&gt; &lt;br&gt;
Feel free to use it. Copy any text and say "hey siri, make this cringe"&lt;/p&gt;

&lt;h3&gt;
  
  
  That's it!!!
&lt;/h3&gt;

&lt;p&gt;If you liked this post, you'll like other tutorials of mine - follow me &lt;a class="mentioned-user" href="https://dev.to/dhravya"&gt;@dhravya&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I post stuff on &lt;a href="https://twitter.com/dhravyashah" rel="noopener noreferrer"&gt;twitter @DhravyaShah&lt;/a&gt; too, if you're into that.&lt;/p&gt;

&lt;h2&gt;
  
  
  AD
&lt;/h2&gt;

&lt;p&gt;Every time I learn about algorithms, I either forget it the other day or don't understand anything at all. &lt;br&gt;
Luckily, &lt;a href="https://algolab.so" rel="noopener noreferrer"&gt;Algolab&lt;/a&gt; has a very good, video-based, interactive course that will get you from 0 to interview in no time!&lt;/p&gt;

&lt;p&gt;Use my referral link (it supports me too) - &lt;a href="https://algolab.so/p/algorithms-and-data-structure-video-course?affcode=1413380_pkegf5oy" rel="noopener noreferrer"&gt;https://algolab.so/p/algorithms-and-data-structure-video-course?affcode=1413380_pkegf5oy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
    </item>
    <item>
      <title>Creating a Twitter bot in Python using Twitter APIv2 🚀🚀</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Thu, 06 Oct 2022 19:57:52 +0000</pubDate>
      <link>https://dev.to/dhravya/creating-a-twitter-bot-in-python-using-twitter-apiv2-3pjo</link>
      <guid>https://dev.to/dhravya/creating-a-twitter-bot-in-python-using-twitter-apiv2-3pjo</guid>
      <description>&lt;p&gt;When I was migrating &lt;a href="https://twitter.com/poet_this" rel="noopener noreferrer"&gt;@poet_this&lt;/a&gt; twitter bot to use the Twitter API v2, I wasn't able to find any good tutorials that do it, atleast none that worked properly. After the bot's success, many people reached out to me asking how they can also create a twitter by themselves! I'm here to help :)&lt;/p&gt;

&lt;h2&gt;
  
  
  🤔 What we're building
&lt;/h2&gt;

&lt;p&gt;Let's create a twitter bot that replies whenever someone mentions the bot. To keep this simple, we'll just reply with the same text but capitalized.&lt;/p&gt;

&lt;p&gt;What we wanna do:&lt;br&gt;
(original_uploader): This is a cool tweet&lt;br&gt;
(commenter): @ bot (*mentions the bot)&lt;br&gt;
(bot): THIS IS A COOL TWEET&lt;/p&gt;

&lt;p&gt;At the end of this tutorial, I'll also include ways to add more cool features to this, and some ideas for your own cool twitter bot!&lt;/p&gt;
&lt;h2&gt;
  
  
  ⚡ Getting started
&lt;/h2&gt;

&lt;p&gt;First of all, you'll need a Twitter developer account. Sign up for one on &lt;a href="https://developer.twitter.com/en/portal/dashboard" rel="noopener noreferrer"&gt;Twitter Developer dashboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.twitter.com/en/docs/tutorials/step-by-step-guide-to-making-your-first-request-to-the-twitter-api-v2" rel="noopener noreferrer"&gt;Here's a step-by-step guide by Twitter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alright, once we're done with that...&lt;/p&gt;

&lt;p&gt;Let's create a new python project! &lt;/p&gt;
&lt;h2&gt;
  
  
  Setting up the project
&lt;/h2&gt;

&lt;p&gt;I recommend working in a virtual environment. Create a new folder, and open the terminal and use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m venv env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env/Scripts/activate // on windows
source env/bin/activate // on linux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Finally we just need to install the dependencies,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install python-dotenv python-twitter-v2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is the only two dependencies we really need right now. python-dotenv to use environment variables, and python-twitter-v2 to interact with the twitter API!&lt;/p&gt;
&lt;h2&gt;
  
  
  🔐 Authenticating with Twitter
&lt;/h2&gt;

&lt;p&gt;To authenticate with the twitter API with the bot's twitter account, we'll need a few things...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumer key (From developer dashboard)&lt;/li&gt;
&lt;li&gt;Consumer secret (From developer dashboard)&lt;/li&gt;
&lt;li&gt;Access token&lt;/li&gt;
&lt;li&gt;Access token secret&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Technically you can also use a bearer token, but let's keep it simple for now.&lt;/p&gt;

&lt;p&gt;To get access token and secret (for testing), you can create them in the dashboard here:&lt;/p&gt;

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

&lt;p&gt;Make sure that you have the Read and Write permissions, we need that for the bot.&lt;/p&gt;

&lt;p&gt;(If you want to control another account, for example, a bot account, follow these steps to get the access token/secret for another account - &lt;a href="https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens" rel="noopener noreferrer"&gt;https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Once we have all these tokens, create a file, &lt;code&gt;.env&lt;/code&gt; and fill it in, in this fashion -&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONSUMER_KEY=...
CONSUMER_SECRET=...
ACCESS_TOKEN=...
ACCESS_TOKEN_SECRET=...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  👨🏻‍💻 Let's start with the code now!
&lt;/h2&gt;

&lt;p&gt;Let's break the problem into little pieces...&lt;/p&gt;

&lt;p&gt;We want to,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authenticate with Twitter API&lt;/li&gt;
&lt;li&gt;Listen for all mentions&lt;/li&gt;
&lt;li&gt;Reply!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cool, first, let's authenticate&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pytwitter&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;environ&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;env&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotenv&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_dotenv&lt;/span&gt;

&lt;span class="nf"&gt;load_dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# Loads the .env file we created earlier
&lt;/span&gt;
&lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pytwitter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;consumer_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CONSUMER_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;consumer_secret&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CONSUMER_SECRET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;access_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OAUTH_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;access_secret&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OAUTH_TOKEN_SECRET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can check if the bot is properly authenticated by using some endpoint, for example,&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Twitter&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# Should print Response(data=User(id='783214', name='Twitter', username='Twitter'))
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now let's listen for mentions.&lt;br&gt;
There's one thing to keep in mind though - we don't want to reply to ALL mentions. This is because how Twitter works.&lt;/p&gt;

&lt;p&gt;Let's say, I make a tweet and someone comments on it&lt;br&gt;
&lt;code&gt;@DhravyaShah&lt;/code&gt;: Hello world!&lt;br&gt;
&lt;code&gt;@SomeOtherRandomUser&lt;/code&gt;: Hi Dhravya!&lt;/p&gt;

&lt;p&gt;But, instead of just being "Hi Dhravya", it looks like this-&lt;br&gt;
&lt;code&gt;@DhravyaShah&lt;/code&gt;: Hello world!&lt;br&gt;
&lt;code&gt;@SomeOtherRandomUser&lt;/code&gt;: @DhravyaShah Hi Dhravya!&lt;/p&gt;

&lt;p&gt;Notice the difference? This can be a problem in a twitter bot, where it will reply even to the comments under the bot.&lt;br&gt;
We'll fix this by checking if the text is ONLY mentioning the bot, and nothing else. &lt;/p&gt;

&lt;p&gt;How? Just remove all the mentions and check for an empty string!&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="n"&gt;last_tweet_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# Just a variable to keep track of the last tweet we replied to.
&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;mentions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_mentions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BOT_ID&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;# get bot id from tweeterid.com
&lt;/span&gt;                &lt;span class="n"&gt;return_json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;since_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;last_tweet_id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="n"&gt;tweet_fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;conversation_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;entities&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;


            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Cool, now we get a constant stream of mentions, well not really. We get all the mentions after &lt;code&gt;since_id&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;These mentions actually contain a LOT of data. I wanna keep it short so I won't get into the details, but feel free to &lt;code&gt;print()&lt;/code&gt; this once and look through all the fields provided!&lt;/p&gt;

&lt;p&gt;Now let's check if there's any &lt;code&gt;data&lt;/code&gt; and it has the &lt;code&gt;includes&lt;/code&gt; too (&lt;code&gt;includes&lt;/code&gt; has all the extra entities)&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="c1"&gt;# There's no more tweets
&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;reply_to&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="c1"&gt;# If it's not a reply to another tweet
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;conversation_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;in_reply_to_user_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BOT_ID&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="c1"&gt;# Get the parent tweet
&lt;/span&gt;            &lt;span class="n"&gt;tweet_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_tweet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;return_json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;tweet_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;referenced_tweets&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
            &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tweet_&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;


        &lt;span class="c1"&gt;# If tweet is a reply, it's in the format "@user @user @bot"
&lt;/span&gt;        &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                  &lt;span class="n"&gt;mention&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;username&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;mention&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;entities&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mentions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;new_txt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="c1"&gt;# Remove all mentions in the start
&lt;/span&gt;        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;new_txt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new_txt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;new_txt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new_txt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If &lt;code&gt;new_txt&lt;/code&gt; is "" (empty), that means it's a "direct mention" - just a "&lt;a class="mentioned-user" href="https://dev.to/bot"&gt;@bot&lt;/a&gt;" comment. If it's a direct mention, the bot has been explicitly called, which means we can respond.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_txt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_tweet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upper&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;reply_in_reply_to_tweet_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reply_to&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;And finally, let's close the loop and also update the last_tweet_id to the new, last_tweet_id&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;meta&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;newest_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;meta&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                    &lt;span class="n"&gt;last_tweet_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;meta&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;newest_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's basically it! Here's the full code in a &lt;a href="https://gist.github.com/Dhravya/0bdc77bbdece07204afad9219f39e7da" rel="noopener noreferrer"&gt;Github gist&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;You can add more features to the bot my adding "Keywords", just like how &lt;a href="https://twitter.com/poet_this" rel="noopener noreferrer"&gt;@poet_this&lt;/a&gt; works on twitter - The comment "&lt;code&gt;@poet_this blue 2&lt;/code&gt;" (blue 2 being the keyword) generates that particular style of image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finally...
&lt;/h2&gt;

&lt;p&gt;This was just a quick rundown, but now...&lt;br&gt;
Try making a bot yourself! It's a very fun and rewarding process, and you'll learn a lot through it. &lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;br&gt;
You can support me by sponsoring me on Github - &lt;a href="https://github.com/sponsors/Dhravya" rel="noopener noreferrer"&gt;https://github.com/sponsors/Dhravya&lt;/a&gt;&lt;br&gt;
You can follow me on Twitter - &lt;a href="https://twitter.com/dhravyashah" rel="noopener noreferrer"&gt;https://twitter.com/dhravyashah&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>python</category>
      <category>api</category>
      <category>twitter</category>
    </item>
    <item>
      <title>Disco.pics - Free and open source image hosting service</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Sun, 28 Aug 2022 22:50:00 +0000</pubDate>
      <link>https://dev.to/dhravya/discopics-free-and-open-source-image-hosting-service-ia9</link>
      <guid>https://dev.to/dhravya/discopics-free-and-open-source-image-hosting-service-ia9</guid>
      <description>&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;I'm a huge fan of discord, and use it to communicate with my friends, family and teammates. &lt;/p&gt;

&lt;p&gt;One day, a friend of mine told me how he has made a channel just to store and organize his images at one place.&lt;br&gt;
All attachments uploaded to discord have a link automatically generated. These links are shareable, but they are really long. &lt;br&gt;
Discord has a very high-speed content delivery network (CDN) powered by Cloudflare. &lt;/p&gt;

&lt;p&gt;All of this made us think, "Why not create an image hosting that uses discord's CDN?"&lt;/p&gt;

&lt;p&gt;And that's exactly what we did!&lt;br&gt;
But this needed to be BLAZINGLY fast. We wanted to make a good image hosting, with custom embed support, an API, etc. &lt;/p&gt;

&lt;p&gt;This would mean, we have to fetch from the database every time someone loads an image. Redis was the perfect choice for us.&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards!&lt;/p&gt;
&lt;h3&gt;
  
  
  Overview video
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iprpEQD6liM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;p&gt;Typescript&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/discopics" rel="noopener noreferrer"&gt;
        discopics
      &lt;/a&gt; / &lt;a href="https://github.com/discopics/disco.pics" rel="noopener noreferrer"&gt;
        disco.pics
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      An image hosting service with all the customisation you need
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;This project has been discontinued. Use at your own risk&lt;/h1&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Disco.pics&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Fast image hosting made easy.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/269b02ed11a0195d267de278eb744a8be74b30b94285e5b8052a2d4505c58106/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f313031303835373335323634353331363635382f313031333537333933353038383032393830392f696d6167655f323032322d30382d32395f3033353035323336322e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/269b02ed11a0195d267de278eb744a8be74b30b94285e5b8052a2d4505c58106/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f313031303835373335323634353331363635382f313031333537333933353038383032393830392f696d6167655f323032322d30382d32395f3033353035323336322e706e67" alt="Main page"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/ebd58c4d0d28ab43309242cb1a08c92cebef8c9d7cc027f5adb555f6ecd97fb6/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f313031303835373335323634353331363635382f313031333536383633343331343034373632382f31753131382e676966"&gt;&lt;img src="https://camo.githubusercontent.com/ebd58c4d0d28ab43309242cb1a08c92cebef8c9d7cc027f5adb555f6ecd97fb6/68747470733a2f2f63646e2e646973636f72646170702e636f6d2f6174746163686d656e74732f313031303835373335323634353331363635382f313031333536383633343331343034373632382f31753131382e676966" alt="Embed builder"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Overview video&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Here's a short video that explains the project and how it uses Redis:&lt;/p&gt;
&lt;p&gt;[Insert your own video here, and remove the one below]&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=iprpEQD6liM" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/d37a0779d3d042a412c6673a02970ed8abbd1656ea1ec87e594dd2a952931848/68747470733a2f2f646973636f2e706963732f6f672d696d6167652e706e67" alt="Disco.pics"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How it works&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;How the data is stored&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;There are two different schemas, the &lt;code&gt;User&lt;/code&gt; and &lt;code&gt;Image&lt;/code&gt; schema.&lt;/p&gt;
&lt;p&gt;For each user, this is the information that is stored:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;id: string&lt;/li&gt;
&lt;li&gt;email: string&lt;/li&gt;
&lt;li&gt;created_at: date&lt;/li&gt;
&lt;li&gt;token_number: number&lt;/li&gt;
&lt;li&gt;embed_title: string&lt;/li&gt;
&lt;li&gt;embed_site_name: string&lt;/li&gt;
&lt;li&gt;embed_site_url: string&lt;/li&gt;
&lt;li&gt;embed_colour: string&lt;/li&gt;
&lt;li&gt;embed_author_name: string&lt;/li&gt;
&lt;li&gt;embed_desc: string&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;here, the ID is indexed, so we can find users by their ID.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Image&lt;/code&gt; schema is the information that is stored for each image:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;uploaded_by: string&lt;/li&gt;
&lt;li&gt;slug: string&lt;/li&gt;
&lt;li&gt;img_url: string&lt;/li&gt;
&lt;li&gt;uploaded_at: date&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here, &lt;code&gt;slug&lt;/code&gt; and &lt;code&gt;uploaded_by&lt;/code&gt; are indexed.&lt;/p&gt;
&lt;p&gt;Whenever someone visits the &lt;code&gt;/[slug]&lt;/code&gt; route, the &lt;code&gt;Image&lt;/code&gt; schema is queried for the image with the slug.&lt;/p&gt;
&lt;p&gt;Then, using the &lt;code&gt;uploaded_by&lt;/code&gt;…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/discopics/disco.pics" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdisco.pics%2Fog-image.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdisco.pics%2Fog-image.png" alt="OGIMG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F1010857352645316658%2F1013573935088029809%2Fimage_2022-08-29_035052362.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F1010857352645316658%2F1013573935088029809%2Fimage_2022-08-29_035052362.png" alt="Main page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F1010857352645316658%2F1013568634314047628%2F1u118.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F1010857352645316658%2F1013568634314047628%2F1u118.gif" alt="Embed builder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/yxsh"&gt;@yxsh&lt;/a&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries" rel="noopener noreferrer"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight" rel="noopener noreferrer"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to" rel="noopener noreferrer"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
    </item>
    <item>
      <title>How to ask for help</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Sun, 17 Jul 2022 09:09:25 +0000</pubDate>
      <link>https://dev.to/dhravya/how-to-ask-for-help-2690</link>
      <guid>https://dev.to/dhravya/how-to-ask-for-help-2690</guid>
      <description>&lt;p&gt;&lt;em&gt;This blog was originally published on &lt;a href="https://blog.dhravya.dev"&gt;blog.dhravya.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every couple of days, a beginner comes to our programming server, &lt;a href="https://discord.io/code"&gt;The Coding horizon&lt;/a&gt;, and asks for help - That's perfectly OK! Asking for help is natural and is almost necessary for learning. However, you need to HELP OTHERS to help you.&lt;/p&gt;

&lt;p&gt;So here's some points to keep in mind, I'll try to keep it short and simple. You might like my blog about &lt;a href="https://blog.dhravya.dev/learning-to-code"&gt;Learning to code, for beginners&lt;/a&gt; if you enjoyed this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What not to do
&lt;/h2&gt;

&lt;p&gt;Let's start off with some things that you absolutely should not do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Asking people to join a voice call
&lt;/h3&gt;

&lt;p&gt;Many people don't know how to frame their questions very well, so they ask others to join a voice call. Please keep in mind that people that are willing to help you have a life, and they might not be in the situation to join a voice call, or even if they are, they might not be comfortable to - which is mostly the case. &lt;/p&gt;

&lt;p&gt;Framing your questions correctly is all you need to do&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gCSTG0gT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ovhf7tm0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gCSTG0gT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ovhf7tm0a.png" alt="Here's an example from my discord server" width="880" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  "My code doesn't work"
&lt;/h3&gt;

&lt;p&gt;Never ask for help with "just doesn't work". It doesn't help anyone in this situation - elaborate on what exactly doesn't work and why it's not working.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rVlxzq----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/1i106.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rVlxzq----/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/1i106.png" alt="Doesn't work" width="880" height="355"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Pinging random people, giving bribes, and other things
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Leaving the server because you didn't get help immidiately&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is kinda insane - People join a server, ask for help - don't frame their questions properly and then (since no one understood the question in the first place), they leave the server.&lt;/p&gt;

&lt;p&gt;Joining a server just to ask for help isn't a problem here - even I did it as a beginner, and that's how I found amazing people and amazing discord servers. The problem is, leaving the server just because no one knew the answer to your question.&lt;/p&gt;

&lt;p&gt;Ok, let's get to bribes - just yesterday, this happened, this checks out all points of what not to do so far-&lt;/p&gt;

&lt;p&gt;As you can see they also pinged a random person without any context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N0e-anTg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ovsf9o40a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N0e-anTg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ovsf9o40a.png" alt="Person asking for help while giving bribe and pinging random people" width="880" height="692"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Shortly after asking this, they left the server, and I didn't get the chance to help them.&lt;/p&gt;

&lt;p&gt;What to do instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't bribe lol&lt;/li&gt;
&lt;li&gt;Frame your question correctly&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Sending screenshots of your code
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Or worse - sending photos of your laptop screen using your phone...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This happens an awful lot - and it really makes it difficult to get help. Some people just send screenshots, without any context as to what is going on, what's the issue, and what they have tried (More on that later).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3GEuukum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ow38tnc0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3GEuukum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/l5ow38tnc0a.png" alt="Asking for help with screenshots of code" width="880" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What to do instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JUST COPY PASTE &lt;code&gt;CTRL + C&lt;/code&gt; and &lt;code&gt;CTRL + V&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure the code is properly embed, inside triple back ticks (code block)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7Md9v5kN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/1k108.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Md9v5kN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://us-east-1.tixte.net/uploads/img.dhravya.dev/1k108.gif" alt="How to embed properly" width="803" height="129"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What you SHOULD do
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Google before asking
&lt;/h3&gt;

&lt;p&gt;There's a good chance that the problem you're having has already been solved by someone on the internet, you should try to google it first.&lt;/p&gt;
&lt;h3&gt;
  
  
  Don't ask to ask, just ask
&lt;/h3&gt;

&lt;p&gt;Ditch the "Can someone please help me" - Get to the point, ask your question right away.&lt;/p&gt;

&lt;p&gt;Read: &lt;a href="https://dontasktoask.com"&gt;Don't ask to ask&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Frame your questions correctly &lt;a id="framing-your-questions-correctly"&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Ok this is very important - Framing your questions correctly will make it easier for others to understand your question, and you'll be much more likely to get an answer.&lt;/p&gt;

&lt;p&gt;Here's how to do it.&lt;/p&gt;

&lt;p&gt;So every question should have these points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language/Framework/Library you're using &lt;/li&gt;
&lt;li&gt;What you're trying to achieve&lt;/li&gt;
&lt;li&gt;A brief description of the problem&lt;/li&gt;
&lt;li&gt;A relevant code snippet&lt;/li&gt;
&lt;li&gt;In case of a visual problem, a screenshot of the problem (For example, web development-related questions)&lt;/li&gt;
&lt;li&gt;Stack trace, if any&lt;/li&gt;
&lt;li&gt;Solutions you have already tried&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So here's sort of a template you can use for your questions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hey there, I need some help with a &amp;lt;language/framework/library/tool&amp;gt; problem.

I'm trying to &amp;lt;what you're trying to achieve&amp;gt;. But, &amp;lt;A brief description of the problem&amp;gt;.

Here's my code:

&amp;lt;Proper, embedded code :embed using triple back ticks, 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
&lt;br&gt;
your code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upload to pastebin if it's too long&amp;gt;

I've added the screenshots &amp;lt;attach the screenshot&amp;gt;

Here's the error I'm getting:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
I've already tried the following solutions:
&amp;lt;Solutions you have already tried&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;I can almost guarantee that you will get help from someone if you ask in such a format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Be respectful even if you don't get help.
&lt;/h3&gt;

&lt;p&gt;Sometimes, even after all this, your question might be ignored - or maybe no one could help you. That's fine! Please be respectful, even if you don't get help. Don't leave the server, or community, don't be rude.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;Here's a TL;DR of how to ask for help.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Code doesn't work" - Elaborate&lt;/li&gt;
&lt;li&gt;"Can someone please help me" - Get to the point&lt;/li&gt;
&lt;li&gt;Don't ask people to join a voice call, don't ping random people without context, don't give bribes&lt;/li&gt;
&lt;li&gt;Don't send screenshots of your code - Just copy paste &lt;code&gt;CTRL + C&lt;/code&gt; and &lt;code&gt;CTRL + V&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Google before asking&lt;/li&gt;
&lt;li&gt;Frame your questions correctly&lt;/li&gt;
&lt;li&gt;Be respectful (even if you don't get help)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it for today! I hope I provided some value with this blog. I've not been writing since like a month - I'll try to be more consistent again.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>help</category>
    </item>
    <item>
      <title>A whole new developer ecosystem: CakeCutter 🍰</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Fri, 17 Jun 2022 04:36:43 +0000</pubDate>
      <link>https://dev.to/dhravya/a-whole-new-developer-ecosystem-cakecutter-5a3c</link>
      <guid>https://dev.to/dhravya/a-whole-new-developer-ecosystem-cakecutter-5a3c</guid>
      <description>&lt;p&gt;A couple months ago, I wrote a blog &lt;a href="https://dev.to/dhravya/introducing-cakecutter-start-projects-quickly-from-cakes-templates-5adk"&gt;Introducing Cakecutter&lt;/a&gt;, which was, essentially, a modular version for &lt;a href="https://github.com/Dhravya/create-python-project" rel="noopener noreferrer"&gt;create-python-project&lt;/a&gt;. Both of these projects were very easy, because they were just simple projects for me to practice the Rust programming language. I made them and forgot about it. But little did I know, small projects go a long way.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/dhravya" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F752901%2F31c74da2-8ec6-47e9-b90c-f422a71a102b.png" alt="dhravya"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/dhravya/introducing-cakecutter-start-projects-quickly-from-cakes-templates-5adk" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Introducing Cakecutter🍰- Start projects quickly from Cakes (templates)&lt;/h2&gt;
      &lt;h3&gt;Dhravya ・ Mar 9 '22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#rust&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;But then, a couple days ago, &lt;a href="https://dev.to/kekdadabest"&gt;Yash&lt;/a&gt; (who is a fellow admin of the &lt;a href="https://discord.gg/z7MZYhmx6w" rel="noopener noreferrer"&gt;Coding Horizon community&lt;/a&gt; and an amazing developer), texted me, saying that he sees a lot of potential in my little pet project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Cakecutter is cool, let’s make it better”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And that’s exactly what we did.&lt;/p&gt;

&lt;p&gt;We discussed new things we can implement, and decided to rewrite the entire thing in &lt;a href="https://go.dev" rel="noopener noreferrer"&gt;Golang&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Ok, but what exactly &lt;em&gt;is&lt;/em&gt; Cakecutter?
&lt;/h2&gt;

&lt;p&gt;In a nutshell, &lt;code&gt;Cakes&lt;/code&gt; are templates, which contain &lt;em&gt;everything&lt;/em&gt; you need to set up a project. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The file structure of a project (for eg. some boilerplate files, &lt;code&gt;README&lt;/code&gt;, &lt;code&gt;src/&lt;/code&gt; folder) &lt;a href="https://docs.cakes.run/3-create/#file-structure" rel="noopener noreferrer"&gt;[DOCS]&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;File content (for eg. Pre-generated licenses, or boilerplate code) &lt;a href="https://docs.cakes.run/3-create/#file-content" rel="noopener noreferrer"&gt;[DOCS]&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Commands to set up a project (for eg. Downloading dependencies, creating virtual environment) &lt;a href="https://docs.cakes.run/3-create/#running-commands" rel="noopener noreferrer"&gt;[DOCS]&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, questions can be asked when setting up a project. Questions can be a selection between multiple things, or an input. Then, the answers to the questions can be used to fill in a template. &lt;a href="https://docs.cakes.run/4-advance/" rel="noopener noreferrer"&gt;[DOCS]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An example use case for this would be, asking the name of a user to auto-generate license, or you can even generate an entire README file with it!!&lt;/p&gt;

&lt;p&gt;You can create files based on answer to a question, for example, creating a file only if the project is a typescript project. &lt;/p&gt;

&lt;p&gt;And, you can even run commands based on answers. Example use case would be asking host OS to run setup commands!&lt;/p&gt;

&lt;p&gt;This is a hell lot of power and functionality in just ONE CakeFile! (Just like real cakes 😆)&lt;/p&gt;

&lt;p&gt;Have a look at the &lt;a href="https://docs.cakes.run/5-example/" rel="noopener noreferrer"&gt;Basic example cake&lt;/a&gt; and you can also try out the &lt;a href="https://cakes.run/cake/python" rel="noopener noreferrer"&gt;Python cake&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Sold yet? Install cakecutter.
&lt;/h3&gt;

&lt;p&gt;Head over to &lt;a href="https://docs.cakes.run/1-install/" rel="noopener noreferrer"&gt;https://docs.cakes.run/1-install/&lt;/a&gt;, or use with NPX:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;npx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cc&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  These are not even the biggest updates.
&lt;/h2&gt;

&lt;p&gt;Like &lt;code&gt;create-react-app&lt;/code&gt; , most people don’t like to make cakes. They like to eat them. We knew this, and a way to share cakes had to be made.&lt;/p&gt;

&lt;p&gt;So, we created a &lt;code&gt;publish&lt;/code&gt; command, so you can publish &lt;em&gt;your&lt;/em&gt; cakes for others to use!&lt;/p&gt;

&lt;p&gt;Try out this command to instantly generate a very simple python project template. Now you don’t need to create cakes!&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cc cut python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Also, we created the website &lt;a href="https://cakes.run" rel="noopener noreferrer"&gt;Cakes.run&lt;/a&gt; where you can find the documentation, installation guidelines, and also browse the cakes created by others. &lt;/p&gt;

&lt;p&gt;To learn more about how to create cakes, &lt;a href="https://docs.cakes.run" rel="noopener noreferrer"&gt;Read the docs&lt;/a&gt;, and go through the &lt;a href="https://github.com/cake-cutter/examples" rel="noopener noreferrer"&gt;examples repository&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Your support is appreciated. Here’s how you can help
&lt;/h2&gt;

&lt;p&gt;The entire stack - from the API, website, CLI, Docs -  Everything is open source. You can find them on the &lt;a href="https://github.com/cake-cutter" rel="noopener noreferrer"&gt;Cake-cutter github organisation.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star all repositories to spread the word. Especially this one, the main CLI 👇🏻&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/cake-cutter" rel="noopener noreferrer"&gt;
        cake-cutter
      &lt;/a&gt; / &lt;a href="https://github.com/cake-cutter/cakecutter" rel="noopener noreferrer"&gt;
        cakecutter
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Open source, cross-platform developer tool that helps you quick-start your project. Creates files, runs commands, templating based on question. Also works as a setup tool
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://avatars.githubusercontent.com/u/107420213?s=400&amp;amp;u=c8e217d0cba20a98db72ed5a68e0c342c24474fc&amp;amp;v=4"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F107420213%3Fs%3D400%26u%3Dc8e217d0cba20a98db72ed5a68e0c342c24474fc%26v%3D4" width="300"&gt;&lt;/a&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Cakecutter&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/6cd0120cc4c5ac11d28b2c60f76033b52db98dac641de3b2644bb054b449d60c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667"&gt;&lt;img alt="License: MIT" src="https://camo.githubusercontent.com/6cd0120cc4c5ac11d28b2c60f76033b52db98dac641de3b2644bb054b449d60c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Create projects from pre-built cakes (templates) in seconds!&lt;br&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;&lt;a href="https://github.com/cake-cutter/cakecuttercode_of_conduct.md" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/71217453f48cd1f12ba5a720412bb92743010653a5cc69654e627fd99e2e9104/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d322e312d3462616161612e737667" alt="Contributor Covenant"&gt;&lt;/a&gt;
&lt;a href="https://docs.cakes.run" rel="nofollow noopener noreferrer"&gt;Read the full Documentation&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;👀 What is Cakecutter?&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Sometimes, the most difficult thing is to just get started with a project. Cakecutter is a tool that helps you to cut the cake and start your amazing project instantly.&lt;/p&gt;
&lt;p&gt;What Cakecutter does:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Users can &lt;a href="http://docs.cakes.run/en/installation/" rel="nofollow noopener noreferrer"&gt;publish&lt;/a&gt;, &lt;a href="http://docs.cakes.run/en/creating-cakes/" rel="nofollow noopener noreferrer"&gt;create&lt;/a&gt; or &lt;a href="http://docs.cakes.run/en/using-cakes/" rel="nofollow noopener noreferrer"&gt;use a cake&lt;/a&gt; from &lt;a href="https://cakes.run" rel="nofollow noopener noreferrer"&gt;Cakes.run&lt;/a&gt;. Cakes are basically TOML files which contain all the information needed to create a project.&lt;/li&gt;
&lt;li&gt;According to the information in the &lt;code&gt;Cakefile&lt;/code&gt;, Cakecutter will create all the files and (you can also fill them with content) in the correct location.&lt;/li&gt;
&lt;li&gt;Setup commands (installing dependencies, etc.) can be defined in the &lt;code&gt;Cakefile&lt;/code&gt;. These commands are run after the files are generated.&lt;/li&gt;
&lt;li&gt;Cakecutter can ask questions to the user and take input. The input can then be used as variables for the project template. &lt;a href="http://docs.cakes.run/en/advanced-usage/" rel="nofollow noopener noreferrer"&gt;Read the docs here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/cake-cutter/cakecutter" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Follow Yash, the major contributor of this project, on DEV community and Github - &lt;a href="https://github.com/kekda-py" rel="noopener noreferrer"&gt;https://github.com/kekda-py&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Follow me, Dhravya Shah on Github - &lt;a href="https://github.com/dhravya" rel="noopener noreferrer"&gt;https://github.com/dhravya&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>showdev</category>
      <category>go</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I (organically) grew a Twitter bot account from 0 to 750 followers in 20 days.</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Fri, 20 May 2022 10:34:24 +0000</pubDate>
      <link>https://dev.to/dhravya/how-i-organically-grew-a-twitter-bot-account-from-0-to-750-followers-in-20-days-5d1e</link>
      <guid>https://dev.to/dhravya/how-i-organically-grew-a-twitter-bot-account-from-0-to-750-followers-in-20-days-5d1e</guid>
      <description>&lt;p&gt;On 28th April, I published this blog, challenging myself to grow a twitter bot account to 1000 followers in 100 days. Well, I HUGELY underestimated the possibilities. I managed to get to 750 followers in just 21 days!&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/dhravya" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---cvRKZzR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--CxbMIf10--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/752901/31c74da2-8ec6-47e9-b90c-f422a71a102b.png" alt="dhravya"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/dhravya/can-a-twitter-bot-get-1000-followers-in-100-days-a-challenge-to-myself-and-this-community-358n" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Can a twitter bot get 1,000 followers in 100 days? A challenge to myself and this community&lt;/h2&gt;
      &lt;h3&gt;Dhravya ・ Apr 28 ・ 1 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#discuss&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#watercooler&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://twitter.com/poet_this"&gt;Beautify This!&lt;/a&gt; is a simple twitter bot that takes beautiful screenshots of tweets. To use it, all I had to do is mention &lt;code&gt;@poet_this screenshot&lt;/code&gt; under any tweet and it will reply.&lt;/p&gt;

&lt;p&gt;Earlier, the bot was powered by &lt;a href="https://poet.so"&gt;https://poet.so&lt;/a&gt;. And it was a selenium script that was really, really inefficient and super costly to host. So, I created my own custom image generator to do the same.&lt;/p&gt;

&lt;p&gt;Since I did it using Python Image Library, it was quite challenging and I had to come up with interesting algorithms to, for example, vertically extend the tweet template based on the number of lines of the tweet itself. Now, I had reasonable hosting costs and a good enough script to be made into a twitter bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  But why?
&lt;/h2&gt;

&lt;p&gt;I've been growing my own twitter account since almost a year now (created it 3 years ago). In all these 3 years, I got 150 amazing followers, friends and stories to tell.&lt;br&gt;
But well, you know, that's kinda a small number, isn't it? It is extremely difficult to grow a twitter account ... or is it? I thought.&lt;/p&gt;

&lt;p&gt;I don't know. I just wanted a challenge where I manage to do something I &lt;em&gt;thought&lt;/em&gt; was impossible.&lt;/p&gt;

&lt;p&gt;Jumping in, I had no idea how to do this. I mean, I knew that more the people use it, the more publicity it will get. But how to spread the word? &lt;/p&gt;

&lt;p&gt;This was also the time when I was super, super burnt out. I didn't have any motivation to code and I really had nothing to do (I don't watch movies, TV shows, I don't go out with friends). &lt;/p&gt;
&lt;h2&gt;
  
  
  How?
&lt;/h2&gt;

&lt;p&gt;Here's a timeline of how it went:&lt;br&gt;
Day 1 to 5 : 30 followers. It was just me using the bot everywhere on twitter. People noticed, people followed. But I was behind my goal. &lt;/p&gt;

&lt;p&gt;The growth started to drastically slow down, I almost gave up.&lt;/p&gt;

&lt;p&gt;But on day 5, I used the bot on an Elon Musk's Tweet. Luckily, it was literally 10 seconds after he posted the tweet (i genuinely wanted a screenshot to share to friends lol)&lt;br&gt;
And HOLY SHIT! 5 followers, 10 followers, by the end of the day, I already had 70 followers! I had a trick now. Just turn on the notifications for Elon musk and (lmao) use the bot like anyone else would. This was amazing to spread visibility.&lt;/p&gt;

&lt;p&gt;The bot got many, many loyal users now. Users who would use the  bot on every one of their posts. by the 10th day, I already had about 150 followers. &lt;/p&gt;

&lt;p&gt;I was now confident that I can probably hit the mark in 30 days. So I changed the about me of the bot to 30 (growth started slowing down again and I though 50 is a more realistic number) at this point. &lt;/p&gt;

&lt;p&gt;by the 15th day, I had about 300 followers. Now, I don't know what the hell happened, maybe someone else used the bot on a very popular tweet, but people started supporting the challenge a LOT. I got emails, DMs, and what not - soon enough, I woke up to 400 followers (on about the 17th day). Since then, every single day, the bot has been getting (almost) 100 followers. &lt;/p&gt;

&lt;p&gt;Today is the 21th day. It just hit 750 followers, and almost gonna hit 800! Help me get to 1000 followers in ... 30 DAYS!&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://twitter.com/poet_this" rel="noopener noreferrer"&gt;
      twitter.com
    &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;p&gt;I also faced a ton of challenges. Like, the high usage meant that hosting costs also went up. Since the bot is image generation, a lot of image generation, I have to shut it down for some time to save costs. Whenever I'm on the laptop watching videos or relaxing, I turned on the notifications for twitter and listened to pings. And then used the IMGEN script on my own computer and manually sent the result image. Yeah...&lt;/p&gt;

&lt;p&gt;Whenever someone used the bot in a wrong way, I manually send them messages on the correct usage, or sometimes just sent the screenshot manually. &lt;/p&gt;

&lt;p&gt;Twitter flagged and muted many of the bot tweets, even though it's a "good" bot and has the automated tag. But it's understandable.&lt;/p&gt;

&lt;h2&gt;
  
  
  How you can help.
&lt;/h2&gt;

&lt;p&gt;First of all, give a follow! &lt;a href="https://twitter.com/poet_this"&gt;https://twitter.com/poet_this&lt;/a&gt;. this will help it reach 1000 followers in less than 30 days.&lt;/p&gt;

&lt;p&gt;You can also &lt;em&gt;financially&lt;/em&gt; support me, so I don't have to ask my parents to pay for the hosting &lt;a href="https://ko-fi.com/dhravya"&gt;https://ko-fi.com/dhravya&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, the bot is open source (The API, however, isn't open source yet. Still working on the API where the actual image generation happens and it has a lot of bugs)&lt;/p&gt;

&lt;p&gt;Leave a ⭐ &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Dhravya"&gt;
        Dhravya
      &lt;/a&gt; / &lt;a href="https://github.com/Dhravya/beautify-this-bot"&gt;
        beautify-this-bot
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A twitter bot that simply replies with a beautiful screenshot of the tweet, powered by beautify.dhravya.dev
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
&lt;h1&gt;
Poet this!&lt;/h1&gt;
&lt;br&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/5fab2edf3816ef9fb3ebcaf6e613fa7b40ff7652ec69e5f6e7f695aa24bf5ce6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667"&gt;&lt;img alt="License: MIT" src="https://camo.githubusercontent.com/5fab2edf3816ef9fb3ebcaf6e613fa7b40ff7652ec69e5f6e7f695aa24bf5ce6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Replies with a beautiful screenshot of the tweet, powered by beautify.dhravya.dev
&lt;br&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/88a24cec279c3c8fc8e86f5ab0feb7c7d3c000e732a50a2f2c14840ab2ada736/68747470733a2f2f696d616765732d6578742d312e646973636f72646170702e6e65742f65787465726e616c2f7761574f4e797a4856574f4c7a75636f635f39756b724b5957414c6f41685a784b676f3568354d584e61452f68747470732f7062732e7477696d672e636f6d2f6d656469612f46524e6731796e566b41414135584c2e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/88a24cec279c3c8fc8e86f5ab0feb7c7d3c000e732a50a2f2c14840ab2ada736/68747470733a2f2f696d616765732d6578742d312e646973636f72646170702e6e65742f65787465726e616c2f7761574f4e797a4856574f4c7a75636f635f39756b724b5957414c6f41685a784b676f3568354d584e61452f68747470732f7062732e7477696d672e636f6d2f6d656469612f46524e6731796e566b41414135584c2e706e67" alt="Poet this bot"&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;h3&gt;
Installation&lt;/h3&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;git clone https://github.com/dhravya/beautify-this-bot.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;cd beautify-this-bot
pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
Usage&lt;/h3&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;python src/main.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
License&lt;/h3&gt;
&lt;p&gt;This project is licensed under the MIT license&lt;/p&gt;
&lt;h3&gt;
Show your support&lt;/h3&gt;
&lt;p&gt;Leave a ⭐ if you like this project&lt;/p&gt;

&lt;p&gt;Readme made with 💖 using &lt;a href="https://github.com/Dhravya/readme-generator"&gt;README Generator by Dhravya Shah&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Dhravya/beautify-this-bot"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>I was tired of making banners for my blogs, so I automated it</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Sun, 15 May 2022 05:19:21 +0000</pubDate>
      <link>https://dev.to/dhravya/i-was-tired-of-making-banners-for-my-blogs-so-i-automated-it-5hnd</link>
      <guid>https://dev.to/dhravya/i-was-tired-of-making-banners-for-my-blogs-so-i-automated-it-5hnd</guid>
      <description>&lt;p&gt;I'm a very lazy person, and always procrastinate on the smallest of things - opening the image editor, and making a good blog banner would always be the "extra" thing I had to do every time I wrote something. So, I made a script that generates them for me in milliseconds!&lt;/p&gt;

&lt;p&gt;As Bill Gates says, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;always choose a lazy person to do a difficult job because he will find an easy way to do it&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The output is fully customizable, as it is 100% generated from code. You can change some values here and there, and boom! Generated. I ran it through all the posts of my &lt;a href="https://blog.dhravya.dev" rel="noopener noreferrer"&gt;blog&lt;/a&gt; and it quickly replaced many of the blog posts for me.&lt;/p&gt;

&lt;p&gt;Check out the code &lt;a href="https://github.com/Dhravya/blog-banner-generator" rel="noopener noreferrer"&gt;Here&lt;/a&gt; (And ⭐ the post if you liked it!)&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Dhravya" rel="noopener noreferrer"&gt;
        Dhravya
      &lt;/a&gt; / &lt;a href="https://github.com/Dhravya/blog-banner-generator" rel="noopener noreferrer"&gt;
        blog-banner-generator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Customisable, fast, easy to use blog banner generator
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Blog banner generator&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;I was tired of making banners for my blog posts, so I created a script that does it for me.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Dhravya/blog-banner-generator.github/assets/example.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Fblog-banner-generator.github%2Fassets%2Fexample.png" alt="Example"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/Dhravya/blog-banner-generator.git
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; blog-banner-generator
pip install -r requirements.txt&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Config&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;The default config works well, but if you want your banner to be a different colour, or change the positioning of elements, feel free to edit the &lt;a href="https://github.com/Dhravya/blog-banner-generatorsrc/config.py" rel="noopener noreferrer"&gt;config file&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here are the config options (note that this may break the script, because I haven't tested it out much)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;BG_COLOR&lt;/code&gt; : &lt;code&gt;rgb(r, g, b)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ART_POSITION&lt;/code&gt; : &lt;code&gt;Coordinates(x, y, size=(430, 430))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;TITLE_POSITION&lt;/code&gt; : &lt;code&gt;Coordinates(x, y)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;IMG_POSITION&lt;/code&gt; : &lt;code&gt;Coordinates(x, y)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;FOOTER_POSITION&lt;/code&gt; : &lt;code&gt;Coordinates(x, y)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;FOOTER&lt;/code&gt; : &lt;code&gt;"&amp;lt;your small footer&amp;gt;"&lt;/code&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Running the script&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;You can run the script by using the &lt;code&gt;generate()&lt;/code&gt; method of the &lt;code&gt;ImageFactory&lt;/code&gt; class&lt;/p&gt;
&lt;div class="highlight highlight-source-python notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;if&lt;/span&gt; &lt;span class="pl-s1"&gt;__name__&lt;/span&gt; &lt;span class="pl-c1"&gt;==&lt;/span&gt; &lt;span class="pl-s"&gt;"__main__"&lt;/span&gt;:
    &lt;span class="pl-s1"&gt;generator&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-v"&gt;ImageFactory&lt;/span&gt;()
    &lt;span class="pl-s1"&gt;generator&lt;/span&gt;.&lt;span class="pl-en"&gt;generate&lt;/span&gt;(
        ... &lt;span class="pl-c"&gt;# Options here&lt;/span&gt;
    )&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Generate options:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;title&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Dhravya/blog-banner-generator" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>python</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Introducing Audium - A "Micro-Podcast" social web app</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Wed, 11 May 2022 15:02:30 +0000</pubDate>
      <link>https://dev.to/dhravya/introducing-audium-a-micro-podcast-social-web-app-18a9</link>
      <guid>https://dev.to/dhravya/introducing-audium-a-micro-podcast-social-web-app-18a9</guid>
      <description>&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Faudium-app%2Fblob%2F8f413d5fe579f35260a162c66c3c8ba6fcb73b6a%2Fassets%2Flogo.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Faudium-app%2Fblob%2F8f413d5fe579f35260a162c66c3c8ba6fcb73b6a%2Fassets%2Flogo.png%3Fraw%3Dtrue" alt="Audium Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  auDium
&lt;/h2&gt;

&lt;p&gt;A simple, barebones "Micro-Podcast" web app&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This was made as a submission for the &lt;a href="https://dev.to/devteam/announcing-the-appwrite-hackathon-on-dev-1oc0"&gt;Appwrite x Dev&lt;/a&gt; Hackathon&lt;/p&gt;
&lt;/blockquote&gt;






&lt;h2&gt;
  
  
  👀 Inspiration
&lt;/h2&gt;

&lt;p&gt;Short content is blowing up nowadays, with the rise of social media that provide short-form content and popular websites making a shift from long to short, it's time to make short podcasts.&lt;/p&gt;

&lt;p&gt;This was inspired by Twitter - which is considered a "micro-blogging" platform. It's a simple way to share your thoughts, ideas, and stories.&lt;/p&gt;

&lt;p&gt;auDium is a simple web app that does exactly that, but with audio. It's like spotify + twitter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category: Web2 Wizards
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Dhravya" rel="noopener noreferrer"&gt;
        Dhravya
      &lt;/a&gt; / &lt;a href="https://github.com/Dhravya/audium-app" rel="noopener noreferrer"&gt;
        audium-app
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple, barebones "Micro-Podcast" social web app
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Dhravya/audium-appasset/../assets/banner.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Faudium-appasset%2F..%2Fassets%2Fbanner.png" alt="Banner"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Dhravya/audium-app./assets/logo.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Faudium-app.%2Fassets%2Flogo.png" alt="Audium Logo" height="130" width="130"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;auDium&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;A simple, barebones "Micro-Podcast" web app&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This was made as a submission for the &lt;a href="https://dev.to/devteam/announcing-the-appwrite-hackathon-on-dev-1oc0" rel="nofollow"&gt;Appwrite x Dev&lt;/a&gt; Hackathon&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;👀 Inspiration&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Short content is blowing up nowadays, with the rise of social media that provide short-form content and popular websites making a shift from long to short, it's time to make short podcasts.&lt;/p&gt;
&lt;p&gt;This was inspired by Twitter - which is considered a "micro-blogging" platform. It's a simple way to share your thoughts, ideas, and stories.&lt;/p&gt;
&lt;p&gt;auDium is a simple web app that does exactly that, but with audio. It's like spotify + twitter.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;📱 Screenshots&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/3fc9ba7f63e062a674d8c5d78b35dc995abe6e8da1d1002b0943f741f392ff42/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f6c33316f326964726630612e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/3fc9ba7f63e062a674d8c5d78b35dc995abe6e8da1d1002b0943f741f392ff42/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f6c33316f326964726630612e706e67" alt="Main page" height="200"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/d018bfcce660aed8badbdead5a909b92640ac99c3f2d811dab8f4595a4fa065f/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f314d38342e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/d018bfcce660aed8badbdead5a909b92640ac99c3f2d811dab8f4595a4fa065f/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f314d38342e706e67" alt="Main page" height="200"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/1544e31b1f149851f78bbbe7ecc699d813f2503d6702d081d31fd1b081f80ddd/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f314e38352e706e67"&gt;&lt;img src="https://camo.githubusercontent.com/1544e31b1f149851f78bbbe7ecc699d813f2503d6702d081d31fd1b081f80ddd/68747470733a2f2f75732d656173742d312e74697874652e6e65742f75706c6f6164732f696d672e646872617679612e6465762f314e38352e706e67" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;⚙️ Built with&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Dhravya/audium-appassets/tech.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FDhravya%2Faudium-appassets%2Ftech.png" alt="Built with"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🔘 Where Appwrite helps:&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Database : All the posts are stored in an appwrite database instance. Appwrite makes databases very easy with it's &lt;a href="https://github.com/appwrite/sdk-for-python" rel="noopener noreferrer"&gt;python SDK&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Storage : All the audio files are stored in the appwrite storage instance.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Authentication, however, is provided by &lt;a href="https://auth0.com" rel="nofollow noopener noreferrer"&gt;Auth0&lt;/a&gt;, which provides really powerful and easy…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Dhravya/audium-app" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;For the purpose of this hackathon, the app is very barebones. It's not meant to be used as a full-fledged social media yet, but I'll be constantly working on new features and improvements.&lt;/p&gt;

&lt;p&gt;So, for now, you can consider it as a proof of concept that works&lt;/p&gt;

&lt;p&gt;Also, the app is not hosted because I don't have the funds to host Appwrite on my own, and this projects needs quite a bit of storage too, which I don't have. So, for now, you can only use it in the development environment, on your local machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  📱 Screenshots
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fus-east-1.tixte.net%2Fuploads%2Fimg.dhravya.dev%2Fl31o2idrf0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fus-east-1.tixte.net%2Fuploads%2Fimg.dhravya.dev%2Fl31o2idrf0a.png" alt="Main page"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fus-east-1.tixte.net%2Fuploads%2Fimg.dhravya.dev%2F1M84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fus-east-1.tixte.net%2Fuploads%2Fimg.dhravya.dev%2F1M84.png" alt="Main page"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>appwritehack</category>
    </item>
    <item>
      <title>Create the fastest search for your website in minutes, without any dependencies ⚡🔎</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Tue, 10 May 2022 06:03:10 +0000</pubDate>
      <link>https://dev.to/dhravya/create-the-fastest-search-for-your-website-in-minutes-without-any-dependencies-56me</link>
      <guid>https://dev.to/dhravya/create-the-fastest-search-for-your-website-in-minutes-without-any-dependencies-56me</guid>
      <description>&lt;p&gt;The project I'm working on is written in Gatsby JS, but the solution itself is vanilla react and will work everywhere. &lt;/p&gt;

&lt;p&gt; Jump to main content&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The project I'm working on is written in Gatsby JS, but the solution itself is vanilla react and will work everywhere.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Today, I spent most of my time updating &lt;a href="https://blog.dhravya.dev"&gt;my blog&lt;/a&gt;, and thought to add more features like &lt;em&gt;search&lt;/em&gt;, &lt;em&gt;tags&lt;/em&gt;, MDX support, and a few design changes, including the sidebar.&lt;/p&gt;

&lt;p&gt;I was deciding how I would implement the search function, because the only time I have done it, was using a&lt;br&gt;
Self hosted version of &lt;a href="https://typesense.org/docs/guide/install-typesense.html"&gt;Typesense&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But well, that was costly to host server-side, especially for&lt;br&gt;
something as simple as a blog. and their hosted solutions aren't that great price-wise either.&lt;/p&gt;

&lt;p&gt;So one thing was sure, there is no need to use any API for this. After a quick google search, I came across this documentation on Gatsby's website which is about &lt;a href="https://www.gatsbyjs.com/docs/how-to/adding-common-features/adding-search/"&gt;adding search to Gatsby&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From that guide, under the &lt;code&gt;Client Side&lt;/code&gt; section, here's what they recommend:&lt;/p&gt;

&lt;p&gt;It is possible to do all the work in your Gatsby site without needing a third-party solution. This involves writing a bit of code, but using less services. With large amounts of content to index, it can also increase the bundle size significantly.&lt;/p&gt;

&lt;p&gt;One way of doing this is to use the js-search library:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.gatsbyjs.com/docs/adding-search-with-js-search"&gt;Adding Search with JS Search&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two Gatsby plugins that support this as well:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gatsby-plugin-elasticlunr-search&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gatsby-plugin-local-search&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now these search methods index everything which means higher bundle size. And they are also a hassle to set up.&lt;/p&gt;
&lt;h2&gt;
  
  
  The solution I went with &lt;a id="solution"&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Now for my use case, it was probably a good idea to just make something simple by myself, and I can build on it as I keep updating this blog.&lt;/p&gt;

&lt;p&gt;The idea is really simple, I just need to make a search box, and on every keystroke, loop through the contents and filter them like that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BlogIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// These posts can be anything,&lt;/span&gt;
  &lt;span class="c1"&gt;// I've just used the posts from a gatsby query&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allMdx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// We need to filter the posts by the search query.&lt;/span&gt;
  &lt;span class="c1"&gt;// by default, we have all posts&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;filteredPosts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setFilteredPosts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// This will be the search query&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Our search bar */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;
        &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Search"&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
      &lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Simply mapping through everything and rendering blogs */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;filteredPosts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BlogPost&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, whenever something is typed in the box, the &lt;code&gt;search&lt;/code&gt; state will be updated. Now, let's write a &lt;code&gt;useEffect&lt;/code&gt; hook to update the &lt;code&gt;filteredPosts&lt;/code&gt; state whenever the &lt;code&gt;search&lt;/code&gt; state changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BlogIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allMdx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;filteredPosts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setFilteredPosts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;//highlight-start&lt;/span&gt;
  &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// post filtering here&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// only update the filteredPosts state when the search state changes or the posts state changes&lt;/span&gt;
  &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="c1"&gt;///highlight-end&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="c1"&gt;// rest of the code&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now let's write some very simple code to filter the posts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;...&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;filteredPosts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//highlight-start&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
        &lt;span class="c1"&gt;//highlight-end&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;setFilteredPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filteredPosts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since my blog has tags and stuff like that, I added functionality to search and filter by tags, too&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! But wait, there's more. This works, but you can't really &lt;em&gt;share&lt;/em&gt; a search query to someone else, I can share google links - &lt;a href="https://google.com/search?q=github"&gt;google.com/search?q=github&lt;/a&gt;&lt;br&gt;
I think that's kinda important, like, for times when I have to share &lt;a href="https://dev.to/?q=#rust"&gt;all my Rust blogs&lt;/a&gt;, it's just easier and convenient.&lt;/p&gt;

&lt;p&gt;so well, let's update the URL to include the search query, in real time! I hadn't ever done this before, so it was great learning it. I got the inspiration from the &lt;a href="https://ifttt.com"&gt;IFTTT search engine&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I found out about the &lt;code&gt;window.history.pushState()&lt;/code&gt; method, which basically allows you to push a new URL without adding it to the browser history, or reloading the page. Read the documentation for the same over here - &lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API"&gt;History API | MDN&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;//highlight-start&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pushState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pushState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`/?q=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="c1"&gt;//highlight-end&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;filteredPosts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;setFilteredPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filteredPosts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now, we also need to parse the &lt;em&gt;original&lt;/em&gt; request, using the &lt;code&gt;window location&lt;/code&gt; object, and make it default for the &lt;code&gt;useState&lt;/code&gt; hook we made for &lt;code&gt;search&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;                      &lt;span class="c1"&gt;// 👇🏻 converts the URL from HTML encoded to a string (%20 to space)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;decodeURI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="c1"&gt;// Use window location&lt;/span&gt;
                      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;               &lt;span class="c1"&gt;// Split the URL into an array&lt;/span&gt;
                      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;                    &lt;span class="c1"&gt;// Get the last element only&lt;/span&gt;
                      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;               &lt;span class="c1"&gt;// at this point, it's q=search, so we only need the "Search" parth&lt;/span&gt;
                      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;                 

                                        &lt;span class="c1"&gt;// 👇🏻 We're using the initialState to set the search query.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Now, only the blogs that match the query will be displayed on first load &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  That's it!
&lt;/h2&gt;

&lt;p&gt;The full implementation can be found in the &lt;a href="https://github.com/Dhravya/blog/blob/f2a9bfa35600bd182b8f51ba2e347d8bedd938c3/src/pages/index.jsx"&gt;source code of this blog on Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://dev.to/?q=search"&gt;try out the search yourself&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/dhravyashah"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zq-TiWxI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/twitter/follow/dhravyashah%3Flogo%3Dtwitter%26style%3Dfor-the-badge" alt="Dhravya Shah" width="247" height="28"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to visit the repository for this blog here &lt;br&gt;
&lt;a href="https://github.com/dhravya/blog"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ORcN6seQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github-readme-stats.vercel.app/api/pin/%3Fusername%3Ddhravya%26repo%3Dblog" alt="Dhravya Shah's blog" width="400" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>This website doesn't have an API, so I made my own, with extra features.</title>
      <dc:creator>Dhravya</dc:creator>
      <pubDate>Fri, 06 May 2022 13:14:54 +0000</pubDate>
      <link>https://dev.to/dhravya/this-website-doesnt-have-an-api-so-i-made-my-own-with-extra-features-3fd6</link>
      <guid>https://dev.to/dhravya/this-website-doesnt-have-an-api-so-i-made-my-own-with-extra-features-3fd6</guid>
      <description>&lt;p&gt;The &lt;a href="https://dev.to/dhravya/i-made-a-twitter-bot-to-take-beautiful-screenshots-of-a-tweet-3kk5"&gt;poet_this twitter bot&lt;/a&gt; I made, used to use selenium to extract tweets from &lt;a href="https://poet.so" rel="noopener noreferrer"&gt;https://poet.so&lt;/a&gt; (literally going to the website, pasting link, taking a screenshot 💀)&lt;/p&gt;

&lt;p&gt;This had several, several issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very costly to host&lt;/li&gt;
&lt;li&gt;Inefficient by design&lt;/li&gt;
&lt;li&gt;Slow&lt;/li&gt;
&lt;li&gt;Highly prone to errors and crashes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It was time to change this. &lt;/p&gt;

&lt;p&gt;So I went ahead and created :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a python script that uses the Python Image Library to generate the image. This was quite challenging, because I had to (very painfully) plot stuff pixel-by-pixel, and also had to ensure that the tweet fits in the box (for which, I made my own trick where I vertically expanded the image, I'll write a bigger blog explaining the code)&lt;/li&gt;
&lt;li&gt;An API that anyone and everyone can use&lt;/li&gt;
&lt;li&gt;A frontend for the API&lt;/li&gt;
&lt;li&gt;An overall framework, that works for twitter stuff for now, but I'll also be able to implement the same for reddit posts (and comments), etc. you get the point&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It was a lot of hassle to make things like mentions, hashtags, and link appear in blue color, media support, and the replies, but I did it!&lt;/p&gt;

&lt;p&gt;You can visit the website here - &lt;a href="https://beautify.dhravya.dev" rel="noopener noreferrer"&gt;https://beautify.dhravya.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To use it instantly on any tweet, mention &lt;a href="https://twitter.com/poet_this" rel="noopener noreferrer"&gt;@poet_this&lt;/a&gt;&lt;br&gt;
So yeah, it's time to change the name from poet_this to beautify_this lol&lt;/p&gt;

&lt;p&gt;"But isn't this the same as poet.so?" &lt;br&gt;
Well, it is for the most part, but I've also added (a very few, but important) extra features like replies showing up with a preview of the original tweet, with the website doesn't have.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz522w4pajdep9d9bt2q0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz522w4pajdep9d9bt2q0.png" alt="Replies show up like this."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also think that my updated design is better&lt;/p&gt;

&lt;p&gt;also, THANK YOU SO MUCH for showing so much love on the &lt;a href="https://dev.to/dhravya/i-made-a-twitter-bot-to-take-beautiful-screenshots-of-a-tweet-3kk5"&gt;last post&lt;/a&gt;. Because of your support, I got a 50$ forem shop voucher. Even though I'll be unable to afford the shipping costs, it means a lot to me to just receive the voucher.&lt;/p&gt;

</description>
      <category>python</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
