<?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: Arnav</title>
    <description>The latest articles on DEV Community by Arnav (@0xarnav).</description>
    <link>https://dev.to/0xarnav</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%2F1412791%2F05afccc5-aa0a-4ce6-b4be-8f44342e65f7.jpg</url>
      <title>DEV Community: Arnav</title>
      <link>https://dev.to/0xarnav</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/0xarnav"/>
    <language>en</language>
    <item>
      <title>Using Discord as an unlimited cloud storage service</title>
      <dc:creator>Arnav</dc:creator>
      <pubDate>Tue, 31 Dec 2024 10:26:51 +0000</pubDate>
      <link>https://dev.to/0xarnav/using-discord-as-an-unlimited-cloud-storage-service-1e7f</link>
      <guid>https://dev.to/0xarnav/using-discord-as-an-unlimited-cloud-storage-service-1e7f</guid>
      <description>&lt;p&gt;Discloud is a locally run Discord bot that turns your personal Discord server into an unlimited cloud storage service. It runs on your PC as a Python script (I've been considering making an .exe file for easier distribution) and uploads all files from your selected folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Requires Python 3.x&lt;/li&gt;
&lt;li&gt;  Clone this repo using &lt;code&gt;git clone https://github.com/4rnv/Discloud.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  Run &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project uses the &lt;a href="https://github.com/Rapptz/discord.py/" rel="noopener noreferrer"&gt;discord.py&lt;/a&gt; package to manage messaging and gateway connections from your local client to the Discord server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;Enable developer mode on your Discord account. On Discord, head into User Settings &amp;gt; Appearance &amp;gt; Advanced and enable Developer Mode.&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%2Fbgao3h4i9qmxzdj33b4z.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%2Fbgao3h4i9qmxzdj33b4z.png" alt="Enable Developer mode" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a basic Discord bot by following the instructions on the Discord Developer Portal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://discord.com/developers/applications" rel="noopener noreferrer"&gt;https://discord.com/developers/applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://discord.com/developers/docs/quick-start/getting-started" rel="noopener noreferrer"&gt;https://discord.com/developers/docs/quick-start/getting-started&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Allow it to upload files and send messages.&lt;/li&gt;
&lt;/ul&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%2Fa4qm44qjtx5phem481o5.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%2Fa4qm44qjtx5phem481o5.png" alt="Enable permissions" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Generate bot token by clicking on reset token in Applications &amp;gt; YOUR_BOT_NAME &amp;gt; Bot. &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%2F99hgq79tvc41hetchqcz.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%2F99hgq79tvc41hetchqcz.png" alt="Generate token" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add that bot to your server (refer to Guild installation in above links).&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%2Fv1f8pj4wtoiapbmordbv.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%2Fv1f8pj4wtoiapbmordbv.png" alt="Installation" width="800" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy your channel ID (right click on channel name) and bot token (from bot page), then add them to the &lt;code&gt;.env&lt;/code&gt; file in the same directory as &lt;code&gt;app.py&lt;/code&gt;. Name them as &lt;strong&gt;CHANNEL_ID&lt;/strong&gt; and &lt;strong&gt;BOT_TOKEN&lt;/strong&gt; respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BOT_TOKEN=x0x0x0x0 # Alphanumeric
CHANNEL_ID=00000000 # This will be an integer

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

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;app.py&lt;/code&gt; file, specify the path to the directory you want to monitor for new files. The default is set to &lt;strong&gt;./upload&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Run the bot using &lt;code&gt;python app.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;p&gt;Discord has a 25MB file limit for non-Nitro users, hence files which are greater than 25MB will be ignored. &lt;/p&gt;

&lt;p&gt;There is some uncertainty regarding the file size limit. In September 2024 Discord had announced they were going to reduce the size limit to 10MB. However during my test run I was able to upload files up to 25MB. &lt;/p&gt;

&lt;p&gt;You can also compress your larger files into a zip file and upload them (zip files are valid up to 100MB).&lt;/p&gt;

&lt;p&gt;Make sure your bot has permissions to upload files to the server. The &lt;code&gt;db.json&lt;/code&gt; file stores info about the files which have already been uploaded.&lt;/p&gt;

&lt;p&gt;It is quite incredible how versatile Discord servers are. If you've been running out of storage space on your computer, you can configure your personal server to function as theoretically unlimited cloud storage.&lt;/p&gt;

&lt;p&gt;GitHub repo: &lt;a href="https://github.com/4rnv/Discloud" rel="noopener noreferrer"&gt;https://github.com/4rnv/Discloud&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discord</category>
      <category>cloudstorage</category>
      <category>python</category>
      <category>cli</category>
    </item>
    <item>
      <title>Simulating the Monty Hall problem using Streamlit</title>
      <dc:creator>Arnav</dc:creator>
      <pubDate>Sun, 20 Oct 2024 18:45:09 +0000</pubDate>
      <link>https://dev.to/0xarnav/simulating-the-monty-hall-problem-using-streamlit-dn6</link>
      <guid>https://dev.to/0xarnav/simulating-the-monty-hall-problem-using-streamlit-dn6</guid>
      <description>&lt;p&gt;The &lt;a href="https://en.wikipedia.org/wiki/Monty_Hall_problem" rel="noopener noreferrer"&gt;Monty Hall problem&lt;/a&gt; is a classic probability puzzle that has intrigued mathematicians and casual thinkers alike. It presents a scenario where a contestant must choose one of three doors, behind one of which is a car 🚗(the prize), while the other two doors hide goats 🐐. After the contestant makes their initial choice, the host, who knows what is behind each door, opens one of the remaining doors to reveal a goat. The contestant is then given the option to either stick with their original choice or switch to the other unopened door🚪.&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%2Fxxmdrr75jqi54qdjqo7b.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%2Fxxmdrr75jqi54qdjqo7b.png" alt="Line Chart visualizing the wins for remain and switch" width="800" height="692"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although intuition would suggest that switching the door would have no effect on the probability of winning a car ( 1/2 probability of success either by switching or retaining), the truth is that switching the door would result in around 2/3 (67%) chance of success, while remaining with the original door would only result in around 1/3 (33%) chances of success.&lt;/p&gt;

&lt;p&gt;The chances of success after switching approach (N-1/N) where N represents the number of doors. For large values of N, the probability of success P(S) by switching is ~1 (near certainty). I came across this problem during a Math fair in my school, and have been fascinated by it ever since. I created this simulator to visualize the problem and prove that switching doors is beneficial.&lt;/p&gt;

&lt;p&gt;Libraries and tools used&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Streamlit for the GUI&lt;/li&gt;
&lt;li&gt;Altair for the interactive line chart&lt;/li&gt;
&lt;li&gt;Pandas for recording the outcome of each iteration&lt;/li&gt;
&lt;li&gt;Huggingface Spaces for hosting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check the demo at: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://huggingface.co/spaces/0xarnav/MontyHall" rel="noopener noreferrer"&gt;https://huggingface.co/spaces/0xarnav/MontyHall&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can change the number of doors and iterations to see how the probabilities change. For example, at 10 doors the probability of success after switching becomes ~90%. This simulation proves the surprising conclusion that switching doors generally leads to a higher chance of winning.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://ucanalytics.com/blogs/bayes-theorem-monty-hall-problem/" rel="noopener noreferrer"&gt;UC Analytics for the cover image&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>streamlit</category>
      <category>statistics</category>
    </item>
    <item>
      <title>[Frontend Challenge] Space Markup 🚀</title>
      <dc:creator>Arnav</dc:creator>
      <pubDate>Fri, 13 Sep 2024 13:36:57 +0000</pubDate>
      <link>https://dev.to/0xarnav/frontend-challenge-space-markup-1le8</link>
      <guid>https://dev.to/0xarnav/frontend-challenge-space-markup-1le8</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4q1dyp4ikdfjxlpymuff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4q1dyp4ikdfjxlpymuff.png" alt="Screenshot of solar markup" width="800" height="397"&gt;&lt;/a&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/frontend-2024-09-04"&gt;Frontend Challenge v24.09.04&lt;/a&gt;, Glam Up My Markup: Space&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://4rnv.github.io/solar-markup/" rel="noopener noreferrer"&gt;https://4rnv.github.io/solar-markup/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About
&lt;/h2&gt;

&lt;p&gt;This demo is made using vanilla HTML, CSS and JS. I believe that the form of a page must follow its function, and the content should be displayed in a concise yet visually appealing manner. With these tenets in mind, I went for a gradient blue background with a grid layout for the planets and moons. &lt;/p&gt;

&lt;p&gt;A canvas element was added with moving particles representing stars. Subtle animations are added for each section, along with appropriate styling. The distinct "leaf" shape for the info cards was achieved simply through asymmetric border radius.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
.planets &amp;gt; *, .moons &amp;gt; *, .solar-system-objects &amp;gt; * {
    padding: 1rem;
    border: 4px dashed rgba(255, 255, 255, 0.5);
    transition: all 0.5s;
    cursor: pointer;
}

.planets&amp;gt;*:hover, .moons&amp;gt;*:hover, .solar-system-objects&amp;gt;*:hover {
    border-radius: 2rem 0;
    transform: scale(1.03);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I had a lot of fun designing this page. When you think about it, space is such a fascinating topic. As a child I had learnt this planetary mnemonic while in school:-&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;My Very Excited Mother Just Served Us Nine Pizzas.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since then, Pluto's planetary status has been deprecated. Now, instead of Nine Pizzas the mother serves Nachos. Oh well.&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;



&lt;p&gt;You can view the source code on Github.&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--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/4rnv" rel="noopener noreferrer"&gt;
        4rnv
      &lt;/a&gt; / &lt;a href="https://github.com/4rnv/solar-markup" rel="noopener noreferrer"&gt;
        solar-markup
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>devchallenge</category>
      <category>frontendchallenge</category>
      <category>css</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
