<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Posts on ankit bahuguna</title>
    <link>https://ankitbahuguna.xyz/posts/</link>
    <description>Recent content in Posts on ankit bahuguna</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 16 Oct 2023 18:48:12 +0530</lastBuildDate>
    <atom:link href="https://ankitbahuguna.xyz/posts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Lazy Evaluation</title>
      <link>https://ankitbahuguna.xyz/posts/lazy-evaluation/</link>
      <pubDate>Mon, 16 Oct 2023 18:48:12 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/lazy-evaluation/</guid>
      <description>Learning OCaml and Lazy Evaluation Lazy evaluation is a cool concept that delays computations until they&amp;rsquo;re actually needed, saving resources and time. OCaml is great for this, but TypeScript and Go can do it too in their own ways.
OCaml Example OCaml uses lazy streams to generate Fibonacci numbers:
type &amp;#39;a stream = Cons of &amp;#39;a * &amp;#39;a stream Lazy.t let rec fibs a b = Cons (a, lazy (fibs b (a + b))) let rec take n (Cons (x, xs)) = if n &amp;lt;= 0 then [] else x :: take (n - 1) (Lazy.</description>
    </item>
    <item>
      <title>Node VM</title>
      <link>https://ankitbahuguna.xyz/posts/trying-out-node-vm-module/</link>
      <pubDate>Mon, 02 Oct 2023 17:56:37 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/trying-out-node-vm-module/</guid>
      <description>I recently used Node&amp;rsquo;s VM module with a CLI tool to allow passing custom JavaScript via command line flags. The tool interacts with a REST API that returns JSON responses.
So for instance, we have a users end point that returns users. It accepts some filters but sometimes you may want to filter or transform the output in some way.
myclitool get users limit 10 [ { name: &amp;#39;jon&amp;#39;, email: &amp;#39;jon@doe.</description>
    </item>
    <item>
      <title>Tail recursion - Part 2</title>
      <link>https://ankitbahuguna.xyz/posts/benchmarking-recursive-and-tail-recursive-functions-in-ocaml/</link>
      <pubDate>Thu, 24 Aug 2023 18:48:12 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/benchmarking-recursive-and-tail-recursive-functions-in-ocaml/</guid>
      <description>This post is a continuation of the my last post . I did some benchmarking for recursive and non-recursive version of sum function.
open Unix (* Tail recursive version *) let min_list_tail lst = let rec min_tail lst acc = match lst with | [] -&amp;gt; acc | h :: t -&amp;gt; min_tail t (if h &amp;lt; acc then h else acc) in match lst with | [] -&amp;gt; failwith &amp;#34;Empty list&amp;#34; | h :: t -&amp;gt; min_tail t h (* Non-tail recursive version *) let rec min_list_non_tail = function | [] -&amp;gt; failwith &amp;#34;Empty list&amp;#34; | [x] -&amp;gt; x | h :: t -&amp;gt; let min_tail = min_list_non_tail t in if h &amp;lt; min_tail then h else min_tail let generate_large_list size = List.</description>
    </item>
    <item>
      <title>Tail recursion</title>
      <link>https://ankitbahuguna.xyz/posts/undertanding-tail-recursion/</link>
      <pubDate>Tue, 15 Aug 2023 01:55:25 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/undertanding-tail-recursion/</guid>
      <description>I&amp;rsquo;ve been playing around with OCaml lately and wanted to understand how tail recursion works. According to Wikipedia:
&amp;ldquo;In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion.&amp;rdquo;
Non-Tail Recursive Sum Function in OCaml Here&amp;rsquo;s a non-tail recursive sum function in OCaml:</description>
    </item>
    <item>
      <title>Async Generators</title>
      <link>https://ankitbahuguna.xyz/posts/using-async-generators-in-node-js/</link>
      <pubDate>Tue, 20 Jul 2021 20:12:06 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/using-async-generators-in-node-js/</guid>
      <description>So I recently put Javascript generator functions to a good use.
I needed to retrieve all the users from Cognito and then filter them out based on the value of a custom attribute. The Cognito only returns a maximum of 60 users in a single call and a PaginationToken if there are more users. The PaginationToken can then be used to retrieve more users.
So this is the solution I came up with.</description>
    </item>
    <item>
      <title>Scraping Leetcode With Puppeteer</title>
      <link>https://ankitbahuguna.xyz/posts/scraping-leetcode/</link>
      <pubDate>Fri, 16 Apr 2021 18:48:12 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/scraping-leetcode/</guid>
      <description>Warning: This code no longer works since there has been a change in Leetcode&amp;rsquo;s website from the time this post was written.
I am, by no means, a Fangsexual and I don&amp;rsquo;t enjoy solving problems on the LeetCode, so I decided to find a way to quickly download the top 15 most voted solutions for any problem.
I&amp;rsquo;ve been playing around with Puppeteer and it seemed like a good idea to use it for something like this.</description>
    </item>
    <item>
      <title>Deploying Hugo With Rsync</title>
      <link>https://ankitbahuguna.xyz/posts/deploy-hugo-with-rsync/</link>
      <pubDate>Wed, 25 Nov 2020 15:15:58 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/deploy-hugo-with-rsync/</guid>
      <description>This is the script I use to deploy my Hugo website to Vultr.
#!/bin/sh USER=username HOST=hostip DIR=nginx-web-root-absolute-path hugo &amp;amp;&amp;amp; rsync -avz --delete public/ ${USER}@${HOST}:${DIR} exit 0 It requires that you have ssh access to the server you are trying to deploy to, and it also requires that the said server has rsync installed as well.
The key command here is rsync -avz source destination .
The -a option is a combination flag.</description>
    </item>
    <item>
      <title>Covid And FOMO</title>
      <link>https://ankitbahuguna.xyz/posts/covid-and-fomo/</link>
      <pubDate>Sat, 16 May 2020 17:08:19 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/covid-and-fomo/</guid>
      <description>I miss the times when opening social media used to reinforce my fear of missing out on fun and interesting life experiences.
However, as the world grapples with the impact of the global pandemic, a profound shift has occurred. People are now essentially confined to their homes, travel plans indefinitely postponed, and social gatherings limited to virtual spaces. It&amp;rsquo;s a situation no one anticipated.
I feel a bit weird about admitting it, but amidst these challenging times, I don&amp;rsquo;t experience that familiar sensation of FOMO anymore.</description>
    </item>
    <item>
      <title>Bye Bye Gatsby!  Hello Hugo!</title>
      <link>https://ankitbahuguna.xyz/posts/bye-bye-hugo/</link>
      <pubDate>Tue, 10 Mar 2020 18:31:30 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/bye-bye-hugo/</guid>
      <description>So, I finally decided that Gatsby wasn&amp;rsquo;t what I needed. It has lengthy build times and offers many features I don&amp;rsquo;t require. There&amp;rsquo;s nothing inherently wrong with it; in fact, it&amp;rsquo;s a great fit for various use cases. However, for someone who just wants a simple static personal blog without the extra flair, Hugo seems to be a superior choice.
Compared to Gatsby, Hugo&amp;rsquo;s build times are impressively fast, and it has a shorter learning curve.</description>
    </item>
    <item>
      <title>git worktrees</title>
      <link>https://ankitbahuguna.xyz/posts/git-worktrees/</link>
      <pubDate>Tue, 20 Nov 2018 01:07:45 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/git-worktrees/</guid>
      <description>Git worktrees are one of the less used git features. I recently started using it and I found it very helpful while doing code reviews or working with multiple branches.
Git worktrees are a feature in Git that allow you to have multiple working directories associated with a single Git repository. Each working directory, known as a &amp;ldquo;worktree,&amp;rdquo; is a separate copy of your project&amp;rsquo;s files where you can make changes independently of the others.</description>
    </item>
    <item>
      <title>How I started using Vim</title>
      <link>https://ankitbahuguna.xyz/posts/how-i-started-using-vim/</link>
      <pubDate>Wed, 10 Jan 2018 01:07:45 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/how-i-started-using-vim/</guid>
      <description>I&amp;rsquo;ve been using Vim as my primary editor for the last two years and it&amp;rsquo;s not because I can&amp;rsquo;t get out of it .
I tried using it several times before, but I couldn&amp;rsquo;t quite get used to it. A lot of it had to do with the fact that Vim is not like any other regular editor, it&amp;rsquo;s a modal editor. Other normal &amp;lsquo;modeless&amp;rsquo; editors have only one mode, where you can start entering or editing text right away.</description>
    </item>
    <item>
      <title>Linux File Permissions</title>
      <link>https://ankitbahuguna.xyz/posts/linux-file-permission/</link>
      <pubDate>Mon, 09 Feb 2015 19:46:07 +0530</pubDate>
      <guid>https://ankitbahuguna.xyz/posts/linux-file-permission/</guid>
      <description>One of the most commonly faced issues while deploying websites with a web server like Nginx or Apache is dealing with permission errors. You deploy your website and suddenly your website starts throwing errors like &amp;ldquo;403 Forbidden&amp;rdquo; or &amp;ldquo;500 Internal Error&amp;rdquo;. Most often than not it has to do with the incorrect file or directory permissions.
The permissions on a file in Linux dictate who can perform what operations on it.</description>
    </item>
  </channel>
</rss>
