<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>T4P4N</title>
 <link href="https://t4p4n.github.io/atom.xml" rel="self"/>
 <link href="https://t4p4n.github.io/"/>
 <updated>2026-02-14T00:40:30+05:30</updated>
 <id>https://t4p4n.github.io</id>
 <author>
   <name>Tapan Kashyap</name>
   <email>tapank415@gmail.com</email>
 </author>

 
 <entry>
   <title>AI generates suboptimal code, most of the time!</title>
   <link href="https://t4p4n.github.io/2026/02/14/ai-generates-suboptimal-code"/>
   <updated>2026-02-14T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2026/02/14/AI-generates-suboptimal-code</id>
   <content type="html">&lt;p&gt;Recently I got a ticket assigned to me, a fairly detailed one actually.
So it goes like this, we have a file named hsn_gst_master_list.json&lt;/p&gt;

&lt;p&gt;It contains data like this:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hsn_code&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;6101&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Articles of apparel and clothing accessories, knitted or crocheted&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;chapter_number&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;61&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;chapter_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Articles of apparel and clothing accessories, knitted or crocheted&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;HSN&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;has_value_based_rates&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tax_slabs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;rate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;effective_date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2017-07-01&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;min_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;max_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;raw_description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;MEN&apos;S OR BOYS OVERCOATS, CARCOATS, CAPES, CLOAKS, ANORAKS (INCLUDING SKIJACKETS), WIND-CHEATERS, WINDJACKETS AND SIMILAR ARTICLES, KNITTED OR CROCHETED, OTHER THAN THOSE OF HEADING 6103(sale value not exceeding Rs 1000 per piece)&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;rate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;12.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;effective_date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2017-07-01&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;min_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;max_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;raw_description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;MEN&apos;S OR BOYS OVERCOATS, CARCOATS, CAPES, CLOAKS, ANORAKS (INCLUDING SKIJACKETS), WIND-CHEATERS, WINDJACKETS AND SIMILAR ARTICLES, KNITTED OR CROCHETED, OTHER THAN THOSE OF HEADING 6103(sale value exceeding Rs 1000 per piece)&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;rate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;18.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;effective_date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2025-09-22&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;min_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;max_value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;raw_description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;MEN&apos;S OR BOYS OVERCOATS, CARCOATS, CAPES, CLOAKS, ANORAKS (INCLUDING SKIJACKETS), WIND-CHEATERS, WINDJACKETS AND SIMILAR ARTICLES, KNITTED OR CROCHETED, OTHER THAN THOSE OF HEADING 6103(sale value exceeding Rs 2500 per piece)&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;default_rate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It is like 441k lines. Currently we are importing the file, parsing the entire file, then running a filter on it to query whatever the user searches.
In the ticket it was mentioned that I need to create a table in the db, seed this data to the table &amp;amp; add indexes if required, and make sure the endpoint returns performant results.&lt;/p&gt;

&lt;p&gt;Now the data was not normalized, it contained some repeated data like description was there in the parent object as well as inside the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tax_slabs&lt;/code&gt; array.
And there was a boolean (has_value_based_rates) on the parent object, which mentions if there are slabs. If it’s true then the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tax_slabs&lt;/code&gt; will have more than one entry plus there will be min, max values and the GST rate.&lt;/p&gt;

&lt;p&gt;While prompting I referenced the relevant files, added one sample entry from the json file, and pasted the ticket contents.&lt;/p&gt;

&lt;p&gt;It wrote a script for seeding the db and a prisma schema. And asked to run prisma migrate, I did it without giving much attention, thinking let it cook for some time.
Upon checking the schema, it was using CUID for Primary Key in the table, created columns for all fields, added an index on the hsnCode field, even though it was already marked as a unique field, and a unique constraint cannot work without being indexed.&lt;/p&gt;

&lt;p&gt;After seeing this, I still let it go, then I ran the migrate cmd, ran the seed script, inspected the table by checking all the columns, and doing some sorting stuff to figure out what can be removed and what can be improved.&lt;/p&gt;

&lt;p&gt;After I prompted again to first make the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tax_slabs&lt;/code&gt; json column null, cause only 52 rows had data, it did that. However, it made it null as in putting “null” in the json column and not null as in Postgres NULL. This is pretty deceptive actually but it caught my eye somehow.&lt;/p&gt;

&lt;p&gt;After this I prompted again to change from CUID to integer based IDs which are more performant as well as good fit the use case here perfectly. Even though integer based IDs are guessable, but since this data is already public, nothing sensitive in there, so integer based IDs are naturally a perfect fit for this use case.&lt;/p&gt;

&lt;p&gt;And prompted again to remove the redundant description from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tax_slabs&lt;/code&gt; object, (i know its not that redudant actually, only 52 rows, but still i removed it though XD.).&lt;/p&gt;

&lt;p&gt;After this point the table started looking good to me. Then I prompted again to replace the json file import with a db call in endpoint for querying the hsn master table via prisma.&lt;/p&gt;

&lt;p&gt;Now it’s done and working just fine. I still think things can be improved here like putting tax slabs in another table and referencing that in the hsn master table. But I think that’s optimization for another day. Postgres is already good enough to handle this small amount of data. At this point I think the time &amp;amp; effort to optimise further won’t give much of a meaningful performance improvement.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>2025 Year in review</title>
   <link href="https://t4p4n.github.io/2025/12/28/2025-year-in-review"/>
   <updated>2025-12-28T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2025/12/28/2025-year-in-review</id>
   <content type="html">&lt;p&gt;Starting with work, as usual, Mostly remained same, in-fact it became a bit easy thanks to claude, But but, You need to test things out manually which is a bit time consuming, also if the code written have like small very minor bugs (runtime bugs to be specific), which are very hard to spot &amp;amp; catch, you have test the feature multiple times with different inputs to figure out the bugs.&lt;/p&gt;

&lt;p&gt;One annoying thing for me is reading the AI generated code, it’s good most of the times, but it makes mistakes that no human coder ever would. Like putting functions in the useState, using useCallback on every function inside the component, i won’t blame AI for this, it’s just react have this weird coding patterns. As backend code it writes a hell lot of utility functions, unnecessary abstractions, and sometimes even breaks the usual JS conventions.&lt;/p&gt;

&lt;p&gt;Daily routine remained same as last year, till the month of may,&lt;/p&gt;

&lt;p&gt;In may, i moved out a different place, previously i was staying in one 1RK apartment with one of my office colleague.&lt;/p&gt;

&lt;p&gt;But Now i’m staying in a 3BHK, since i moved here, i made new friends, not just new but also hindi speaking ones, we are 4 guys here who are here everyday n night, And one guy comes only once in a week.&lt;/p&gt;

&lt;p&gt;Also the rent is a bit lower than my previous stay.&lt;/p&gt;

&lt;p&gt;And i also started cooking lunch as well, previously i used to cook breakfast &amp;amp; dinner only.&lt;/p&gt;

&lt;p&gt;As for financial stuff, i got an increment this year, in the month of may, i guess, financially speaking i’m good for now, Also i started investing in stocks,&lt;/p&gt;

&lt;p&gt;currently having with an unrealised loss :(, I brought the house stocks, aka BSE, NSDL &amp;amp; CDSL etc. And the reason is that my entry was at the wrong time, all these stocks were at their all time high, when i brought these stocks. Anyhow hopefully it will get recovered in the upcoming years. Also In the last two months, I did some IPOs as well, there i made good profits. :)&lt;/p&gt;

&lt;p&gt;Some random stuff which i did this year:&lt;/p&gt;

&lt;p&gt;In jan, i went to Mamalakandam, with &lt;a href=&quot;https://shaheem.me/&quot;&gt;shaheem&lt;/a&gt; on the bike, it was a great experience, because there not many people were there, we explored the area, clicked few photos, and came back the same day. Relatively short trip, But i like short trips more than long trips which extends more than 2-3 days day. :)&lt;/p&gt;

&lt;p&gt;Booked tickets &amp;amp; went to attend a standup comedy show of &lt;a href=&quot;https://www.youtube.com/@aupmanyu&quot;&gt;Abhishek Upmanyu&lt;/a&gt; Initially i was thinking that i won’t be able to laugh that much as an introvert, but as soon as show started, i couldn’t able to control my laughter, because the jokes &amp;amp; punches were hilarious.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/4258329e-3965-48b8-89f4-384dfb648ed2?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Abshishek upmanyu on stage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/bf2ab72d-3bc6-4064-8fa0-a69606a0253b?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Me wearing the show&apos;s entry band&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;In the mid of July, i went to &lt;a href=&quot;https://www.keralatourism.org/destination/kadambrayar-boating-eocvillage/595/&quot;&gt;kadambrayar bridge&lt;/a&gt; along with my flatmates in the morning, very short trip, we reached there, and had some tea, clicked photos &amp;amp; had breakfast from outside, &amp;amp; came back to our flat, Also this short trip was sponsored by Me :)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/a83de590-baa1-4c86-a8b9-9cd05981aa3b?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;kadambrayar river&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/86b5e32e-e580-4c32-a050-0d35782cfd8d?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;kadambrayar bridge&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;In the end of July, i went to kadamakudy, it was office trip,&lt;/p&gt;

&lt;p&gt;did kayaking for an hour, and it started raining in between, and i got fully wet, luckily my phone survived, after that we headed to &lt;a href=&quot;https://en.wikipedia.org/wiki/Alappuzha&quot;&gt;alappuzha&lt;/a&gt;, Onboarded on a house boat, had some drinks, had lunch, times flies, i really enjoyed the view from the house boat. After that we headed to &lt;a href=&quot;https://www.keralatourism.org/kerala-article/2022/marai-beach-alappuzha/1204&quot;&gt;marari beach&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We sat on beach, stared at the incoming waves, enjoyed a lot!&lt;/p&gt;

&lt;p&gt;After that we headed back to kochi.
&lt;img src=&quot;https://files.horizon.pics/2a1ddaa1-7a1c-4d5d-aeac-5ec93214fa52?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Kadamakuddy&quot; /&gt;
&lt;img src=&quot;https://files.horizon.pics/5e1b5bab-e439-4d2e-9542-a3be32081863?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Kayaking&quot; /&gt;
&lt;img src=&quot;https://files.horizon.pics/bbe4f38d-187d-4dac-a0ca-c4538b15b09b?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Alapuzzha back waters&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/7ac98235-afa2-4a20-b23a-d5601bb2b157?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;marari beach&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;In the mid of august, i went to &lt;a href=&quot;https://en.wikipedia.org/wiki/Vattavada&quot;&gt;vattavada village&lt;/a&gt; with flatmates and few other guys.&lt;/p&gt;

&lt;p&gt;It was two day trip, and we were 7 people, distance: 270KMs one way, the main goal for the trip is to see the mountains &amp;amp; also to try out magic mushrooms, It was once in lifetime experience.&lt;/p&gt;

&lt;p&gt;So We left our flat at 3am on 15th august, reached that place at 9am,&lt;/p&gt;

&lt;p&gt;took 2 breaks in between, had some tea &amp;amp; snacks, it was all rainy &amp;amp; cold, with some patchy sunshine in between.&lt;/p&gt;

&lt;p&gt;Everything went great &amp;amp; we stayed there for one day &amp;amp; came back next day.&lt;br /&gt;
&lt;img src=&quot;https://files.horizon.pics/b554528e-1b57-4670-a941-79b348753f30?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=&quot; alt=&quot;Munnar&quot; /&gt;
&lt;img src=&quot;https://files.horizon.pics/e5d75840-4149-40e5-91e7-9e5f5bbfdeca?a=1669&amp;amp;region=&amp;amp;mime1=image&amp;amp;mime2=jpeg&quot; alt=&quot;Kundala dam&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/2f521641-798c-4965-bd4d-cd5f1290cefd?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=&quot; alt=&quot;Vattavada&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/e642751b-b8ae-4c96-8f0e-d0353224b1ec?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;On 28 September 2025, i went to subash bose park with &lt;a href=&quot;https://b3nsh4.com/&quot;&gt;ben&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I brought some dryfruits for the home, talked a lot about various things in life.&lt;/p&gt;

&lt;p&gt;We sat down in the park, talked about tech, linux &amp;amp; life so far, did some deep thinking, thought about my life so far, and clicked some photos, and came back to flat.
&lt;img src=&quot;https://files.horizon.pics/e1ef4630-c4b1-46a3-a26e-affb5ba534d8?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Subash bose park night&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/838d7565-7380-426d-97b6-3864d0abef6b?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Subhash bose park evening&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/c37faffe-b8cb-4740-9551-22749c6f7ca0?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Subhash bose park night 2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After this day i had mental breakdown kinda, i can’t share it because of some personal reasons, but it was terrible, i felt like i was used emotionally, And being ignored afterwards, I felt like i lost myself, the things that were once fun for me. those things no longer gave me any kind of joy, i used to do so many things like playing games, cooking &amp;amp; eating food of my choice, listening to music &amp;amp; podcasts etc. But none of these things were giving me any kind joy or satisfaction, i was overthinking, exhausted, anxious and my sleep was messed up entirely. I was in a terrible state of mind, but luckily it only lasted 2 weeks or something. So moving forward&lt;/p&gt;

&lt;p&gt;On 11th Oct, took a flight to delhi, Spent some time with family, celebrated dewali &amp;amp; visited my sisters. Met two of my close school friends, but enjoyed a lot.
My inner peace returned, i started enjoying things slowly. And i cameback to kochi on 16th Nov. Things were normal from now on, I was back with a mature emotional mind. Until after sometime i started doing the same overthinking, but this time it was not that bad i would say. Anyhow, moving on
&lt;img src=&quot;https://files.horizon.pics/b76eabac-e505-4cf2-985a-b7c86193c3b2?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;9pm at our village&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/45857d5a-38de-4cbe-9ffa-126fe27089cf?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;GT road near ganaur, haryana&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;On 22 December, We went to &lt;a href=&quot;https://www.keralatourism.org/destination/kuzhupilly-beach-vypin-island/544/&quot;&gt;kuzhupilly&lt;/a&gt; with our office team, i went to the beach, brought ticket for floating bridge, visited that, after that i sat down on the beach, There was a school kid, who was standing near me. I started talking to him, and we talked about cricket, studies, language etc.&lt;/p&gt;

&lt;p&gt;After that i left the beach &amp;amp; walked back to my place, Clicked a few photos along the way. Attended the christmas party, had a few drinks for energy, danced for a few seconds (cause yk i’m an introvert), went to the pool, tried swimming but failed, had a lot of fun in the pool, after that i took a shower, had dinner, slept, woke up next day, packed my bags, &amp;amp; came back to flat.
&lt;img src=&quot;https://files.horizon.pics/a8d79da4-4094-45e2-b6ae-01b13b0ebd15?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;Kuzhupilly beach&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/8dc979f0-584f-4de5-a0a0-48e7c067ad5c?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;our stay, kings holiday&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://files.horizon.pics/f7e9392c-8059-4271-aaed-85b296aa3ac8?a=1669&amp;amp;mime1=image&amp;amp;mime2=jpeg&amp;amp;region=eu-central&quot; alt=&quot;View from our stay&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And i think that’s was it, mostly, I’ve written about major events happened in my life this year. Whether good or bad, idk how things will be in the future.
Looking forward to next year, Hopes are high! :)&lt;/p&gt;

&lt;p&gt;Thanks for reading till the end &amp;amp;&lt;/p&gt;

&lt;p&gt;Wishing you a Happy new year!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Debugging high memory usage</title>
   <link href="https://t4p4n.github.io/2025/10/19/debugging-high-memory-usage"/>
   <updated>2025-10-19T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2025/10/19/debugging-high-memory-usage</id>
   <content type="html">&lt;h2 id=&quot;step-1-identify-where-its-happening&quot;&gt;Step 1: Identify Where It’s Happening&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;The first step is to figure out where the memory issue is occurring.&lt;/li&gt;
  &lt;li&gt;It could be due to anything, e.g. an internal library, queues, or your own code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s what I did:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Add logs everywhere to track the flow of function calls.&lt;/li&gt;
  &lt;li&gt;Perform some potentially heavy actions (e.g., processing large amounts of data). In my case, it was report generation.&lt;/li&gt;
  &lt;li&gt;If you still haven’t found the action causing the memory leak, look elsewhere:
    &lt;ul&gt;
      &lt;li&gt;Check production logs and metrics.&lt;/li&gt;
      &lt;li&gt;Observe the timeline for when memory usage spikes.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Repeat this process until you’ve pin pointed the action that causes the memory leak or server crash. Then move to Step 2.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-2-track-function-calls-and-memory-usage&quot;&gt;Step 2: Track Function Calls and Memory Usage&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Once you’ve found the problematic action, trace the function calls involved.&lt;/li&gt;
  &lt;li&gt;Add more logging and monitor memory usage closely.
    &lt;ul&gt;
      &lt;li&gt;You can log memory stats to a file along with timestamps.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Document the steps needed to reproduce the issue consistently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-3-inspect-further&quot;&gt;Step 3: Inspect further&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Check if you’re adding too many items to arrays. If so, consider using batching or chunking to avoid (OOM) errors.&lt;/li&gt;
  &lt;li&gt;Inspect any streams or buffers in use.&lt;/li&gt;
  &lt;li&gt;Review filesystem related operations (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.read&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fs.write&lt;/code&gt;) to ensure they’re being used correctly.&lt;/li&gt;
  &lt;li&gt;Take note of idle memory usage (when OOM is &lt;em&gt;not&lt;/em&gt; happening) for comparison.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-4-optimize-the-root-cause&quot;&gt;Step 4: Optimize the Root Cause&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;At this point, you’ve narrowed the issue down to a specific function or section of code. Now it’s time to optimize it.&lt;/li&gt;
  &lt;li&gt;Optimization is usually subjective and comes with trade offs.
    &lt;ul&gt;
      &lt;li&gt;Discuss with your team to find a good balance between memory usage and performance.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my case, the culprit was &lt;strong&gt;SheetJS&lt;/strong&gt;, which caused memory leaks when reading a huge file. I replaced it with &lt;strong&gt;ExcelJS&lt;/strong&gt; using streaming writes. I also implemented an &lt;strong&gt;async generator function&lt;/strong&gt; to further reduce memory usage while reading a large the JSONL file, which i use to generate the report.&lt;/p&gt;

&lt;p&gt;Most of your time will likely be spent on debugging. Once the issue is found and reliably reproducible, resolving it becomes much easier.&lt;/p&gt;

&lt;p&gt;That’s it for this one!&lt;/p&gt;

&lt;p&gt;Thanks for reading, and happy debugging! 😊&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Is AI going to take over junior software dev jobs?</title>
   <link href="https://t4p4n.github.io/2025/04/12/is-ai-going-to-take-over-junior-software-dev-jobs"/>
   <updated>2025-04-12T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2025/04/12/Is-AI-going-to-take-over-junior-software-dev-jobs</id>
   <content type="html">&lt;p&gt;Imagine you’re a junior dev in a company. Let’s assume you’re currently doing minor tasks like changing button colors, converting Figma designs to HTML/JSX, CRUD APIs and stuff like that simple and “easy” work once you know the basics of React, HTML, CSS &amp;amp; a bit of backend knowledge related to MVC &amp;amp; DBs.&lt;/p&gt;

&lt;p&gt;Here’s a question: can AI do this? Yes, of course. But that’s not the point. Junior devs aren’t hired because the task is impossible to do with AI. They’re hired for a very simple reason and that is called &lt;strong&gt;time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Team A can build a big project with or without the junior dev, but with a junior dev on the team, they can build it a bit faster as they can simply parallelize the work accordingly.&lt;/p&gt;

&lt;p&gt;Although the dev will follow whatever instructions are given and some back-and-forth communication will be required, the process is still more efficient.&lt;/p&gt;

&lt;p&gt;Giving the same task to AI might seem faster, but it requires prompting, proofreading the code, running it, and verifying the output.&lt;/p&gt;

&lt;p&gt;This consumes a significant amount of a senior developer’s time—which shouldn’t be wasted on mundane tasks. Sure, senior devs assist juniors, but replacing a junior dev would mean not utilizing a senior dev’s time optimally.&lt;/p&gt;

&lt;p&gt;Here’s a small analogy to illustrate my point:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;It takes 2 people with 2 shovels 1 hour to dig a 3-foot hole.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Now comes a crane, which can do the same in 5 minutes—but it also requires a crane operator, a specialist.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The crane saves time, but can be expensive depending on where you live. More importantly, it might not be feasible to use a crane for small holes.&lt;/p&gt;

&lt;p&gt;This is similar to the junior-senior dev relationship. A junior dev handles small tasks to learn and understand the system, while a senior dev builds and maintains &amp;amp; refines the system to ensure smooth operations of the system.&lt;/p&gt;

&lt;p&gt;At the end of the day, AI is just a tool that requires specialists to use it optimally. Otherwise, it can lead to disastrous bugs and poor user experiences.&lt;/p&gt;

&lt;p&gt;There’s a saying in hindi:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Bandar ke haath mein bandook dena”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Which translates to giving a gun to a monkey. Monkeys can surely shoot, but it’ll be inaccurate and possibly harmful to themselves and those nearby.&lt;/p&gt;

&lt;p&gt;By monkeys, I mean non technical folks who try to do technical stuff with AI&lt;/p&gt;

&lt;p&gt;By people I mean the users using on the software built by these monkeys&lt;/p&gt;

&lt;p&gt;AI is a perfect companion for everyone, and all the productivity claims are valid &lt;strong&gt;but only for simple tasks&lt;/strong&gt; that don’t require deep knowledge or expertise.&lt;/p&gt;

&lt;p&gt;When it comes to anything that requires deep knowledge and problem-solving, AI fails horribly. Deep thinking is still something only humans are capable of. As of now atleast in April 2025&lt;/p&gt;

&lt;p&gt;Most of the time, we don’t even know what we want, so explaining it clearly is hard itself, Let alone crafting a good prompt and expecting AI to generate something useful without clear input is not yet possible.&lt;/p&gt;

&lt;p&gt;That’s it for today. I’m writing this after reading Shopify’s leaked internal email stating that teams need to justify why something can’t be done with AI before hiring a new employee.&lt;/p&gt;

&lt;p&gt;Ref:
&lt;a href=&quot;https://www.wsj.com/tech/ai/shopify-says-no-new-hires-unless-ai-cant-do-the-job-81c34f1e&quot;&gt;https://www.wsj.com/tech/ai/shopify-says-no-new-hires-unless-ai-cant-do-the-job-81c34f1e&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>mDNS (multicast DNS)</title>
   <link href="https://t4p4n.github.io/2025/03/12/mdns"/>
   <updated>2025-03-12T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2025/03/12/mDNS</id>
   <content type="html">&lt;p&gt;Some backstory,
Back in 2017-18 I used to watch bunch of videos on raspberry Pi running like retro games, hacking, electronics stuff, it was awesome to see just how a tiny computer can do these sort tasks.
It was dream for me buy a raspberry Pi but didn’t have budget.&lt;/p&gt;

&lt;p&gt;Fast forward to today, I have money to buy a raspberry Pi easily but now I don’t want because i already own a linux machine, And the enthusiasm is longer there as it was few years ago.&lt;/p&gt;

&lt;p&gt;Anyhow On the day of Onam 15th of September, 2024 I visited Geon’s Place to attend the onam feast, and it was really good especially the palada payasam, after eating whole bunch of rice and drinking 1.5 cups of payasam.&lt;/p&gt;

&lt;p&gt;Me and along with &lt;a href=&quot;https://shaheem.me&quot;&gt;shaheem&lt;/a&gt; went to &lt;a href=&quot;https://geongeorge.com&quot;&gt;Geon’s&lt;/a&gt; room
There i saw a raspberry Pi, For the first time, and i remember it was connected to the router using a ethernet cable and we were SSHing into raspberry pi using cmd:
ssh raspberrypi.local&lt;/p&gt;

&lt;p&gt;And it caught my attention, though i didn’t have much idea at that time on how it was working, i thought maybe it is router assigning .local to devices connected via ethernet. But turns out it was mDNS.&lt;/p&gt;

&lt;p&gt;Meet mDNS,
Which stands for multicast DNS(Domain Name Server), and it requires zero configuration uses UDP multicast*.&lt;/p&gt;

&lt;p&gt;It’s already implemented in the operating systems like mac and linux and also in windows 10 and onwards&lt;/p&gt;

&lt;p&gt;On mac you can just goto settings &amp;gt; sharing
And you will find your hostname.&lt;/p&gt;

&lt;p&gt;Copy that hostname and Run a http server on your mac and bind it 0.0.0.0 so that anyone can access that your server in your local network.&lt;/p&gt;

&lt;p&gt;Now goto your other computer and goto browser and type: hostname.local:port
My case it was rolex.local:3000 and now you can access your web server which specifying the ip address your device. And it will work regardless your currently assigned IP as long as you’re on the same network.&lt;/p&gt;

&lt;p&gt;Refs:&lt;br /&gt;
&lt;a href=&quot;https://en.wikipedia.org/wiki/Multicast_DNS&quot;&gt;https://en.wikipedia.org/wiki/Multicast_DNS&lt;/a&gt;
&lt;a href=&quot;https://www.raspberrypi.com/documentation/computers/remote-access.html&quot;&gt;https://www.raspberrypi.com/documentation/computers/remote-access.html&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Switch git user like a ninja</title>
   <link href="https://t4p4n.github.io/2025/01/28/switch-git-users-like-ninja"/>
   <updated>2025-01-28T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2025/01/28/switch-git-users-like-ninja</id>
   <content type="html">&lt;ul&gt;
  &lt;li&gt;Sometimes it feels weird when you accidentally committed from work user to a personal repo.
But no more now you can use this quick snippet to switch users with ease.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git-user-switch&lt;span class=&quot;o&quot;&gt;(){&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;user1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;T4P4N&quot;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;email1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tapank415@gmail.com&quot;&lt;/span&gt;

	&lt;span class=&quot;nv&quot;&gt;user2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tapan-storetools&quot;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;email2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tapan@storetools.io&quot;&lt;/span&gt;


	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Select a Git user:&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;1. &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;2. &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot; &quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;choice

	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$choice&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-eq&lt;/span&gt; 1 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
	    &lt;/span&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--replace-all&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	    git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--replace-all&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$email1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Git user set to &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$choice&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-eq&lt;/span&gt; 2 &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
	    &lt;/span&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--replace-all&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	    git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--replace-all&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$email2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Git user set to &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$user2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;else
	    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Invalid choice. Please choose 1 or 2.&quot;&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

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

&lt;p&gt;Still what about existing commits?
No worries use this git cmd to own your commit:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git commit --amend --reset-author --no-edit&lt;/code&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>2024 Year in review</title>
   <link href="https://t4p4n.github.io/2024/12/11/2024-year-in-review"/>
   <updated>2024-12-11T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2024/12/11/2024-year in review</id>
   <content type="html">&lt;p&gt;Starting with work as usual, this year was quite more hectic when compared to last. The main reason for that is not actually work - it’s the other things that I need to take care of now, e.g., cooking breakfast and dinner, cleaning the room and utensils, and washing clothes. These chores take time, especially if you haven’t done any of these before.&lt;/p&gt;

&lt;p&gt;As for actual work, it was quite good actually. I found out that many people need help just like you; nobody knows everything, hence some things are blurry and there are trade-offs each time you make a decision. I remember a concept called the Production Possibility Curve which is taught in economics class. Now that I’ve experienced that in real life, I can fairly say that nothing’s perfect - there’s always room for improvement.&lt;/p&gt;

&lt;p&gt;This year my daily routine went like this:
8:30 AM - Wake up
Shower
Cook breakfast
Eat breakfast
10:10 AM - Leave for work
Work till 2:00 PM
Go out for lunch with office buddies
(Mostly CUSAT restaurant nowadays, but previously:
Aaryas, Aamaram, Ella, Just Tiffins)
Work till 7:00 PM
Come back to apartment
Change clothes
Cook dinner
Talk to mom
Browse social media
Sleep at 12:00 AM&lt;/p&gt;

&lt;p&gt;And that’s it for work days.
For Sundays: except for work, I need to do laundry and room cleaning, and cook lunch as well.&lt;/p&gt;

&lt;p&gt;Once in two months or so, I visit my friend Ben. We usually discuss Linux, life, and a whole bunch of nerdy things.&lt;/p&gt;

&lt;p&gt;In July, we went to Munnar, which was my first office trip and it went really well, especially the Kokumalai Peak. The only issue was I didn’t know how to enjoy a trip, but now I know. It was a 3-day trip, and even though it is closer to Kochi, the environment changes drastically - coastal to mountain peaks and rain forests. I really liked the weather, clouds, and sky; it was overall an awesome experience. But as we reached our last day of the trip, we were all exhausted. If I remember correctly, I spent one hour in the shower after reaching back to the apartment, and I guess I slept for more than 10 hours.&lt;/p&gt;

&lt;p&gt;Fast forward to November:
We had another office trip, and this time it was Kashmir.&lt;/p&gt;

&lt;p&gt;Day One: Starting from srinagar airport, We visited Nishat Garden, Shalimar Garden, Dal Lake.&lt;/p&gt;

&lt;p&gt;Day Two: We went to Sonamarg, and it wasn’t really a good experience because I don’t like horses. It was a horse ride for about 8 kms, and I stopped midway and started walking instead. Anyhow, it wasn’t that good of an experience - horse droppings everywhere and it was hella dusty there.&lt;/p&gt;

&lt;p&gt;Day Three: We went to Pahalgam. Again, horse ride, but this time it was okayish. I didn’t like it (the horse ride), but the place was good. Clicked a few photos, ate some Maggi, and walked around.&lt;/p&gt;

&lt;p&gt;Day Four: Gulmarg. This time it was a cable car ride, which I liked, but there was quite a rush there and we had to wait for 1.5 hours in queue just to come back down. There were horses again, but my friend and I skipped and chose to walk instead, and it was really fun.&lt;/p&gt;

&lt;p&gt;Day Five: Doodpathri. Horses again, but all of us skipped this time. We chose to walk instead, and it was again an awesome but exhausting experience. Clicked a few photos, observed the landscape - good experience and not much crowded either.&lt;/p&gt;

&lt;p&gt;Overall I liked Munnar over Kashmir because Kashmir felt somewhat familiar and similar to my hometown, which is North Delhi. Typical “grass is greener on the other side” situation, and the other side for me is Munnar and Kochi itself.&lt;/p&gt;

&lt;p&gt;Back to personal growth and achievements:
I started going out to meetups, mainly Kochi FOSS.
It is a wonderful experience talking to like-minded people.&lt;/p&gt;

&lt;p&gt;I started talking to people on the bus and at the bus stand. Even though I don’t understand much Malayalam, I can understand the context and answer other people’s general queries like bus timings, bus stop names etc.&lt;/p&gt;

&lt;p&gt;I’ve made a few new friends, mainly two people whom I talk with when we meet:&lt;/p&gt;

&lt;p&gt;Ambraj, Software Tester: little older than me but a experienced dude with a chill attitude. We explored Fort Kochi together. Recently had a few drinks with him. He’s my neighbor as well.&lt;/p&gt;

&lt;p&gt;The whole team at perfviz.com and ofcourse our astral boys of helloastral.com !&lt;/p&gt;

&lt;p&gt;And a few more folks whom I can’t remember now, but I talk to them whenever we catch up.&lt;/p&gt;

&lt;p&gt;Skills I learned this year:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Cooking&lt;/li&gt;
  &lt;li&gt;RemixJS&lt;/li&gt;
  &lt;li&gt;PostgreSQL DB internals&lt;/li&gt;
  &lt;li&gt;Debugging memory leaks&lt;/li&gt;
  &lt;li&gt;Golang basics&lt;/li&gt;
  &lt;li&gt;Communication improved significantly thanks to work from office&lt;/li&gt;
  &lt;li&gt;Socializing with people (even with not-so-like-minded folks who are not in from your domain)&lt;/li&gt;
  &lt;li&gt;Handling work-life balance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Financially, it’s not that good because now I have bills to pay, i.e., rent for the apartment and buying groceries to cook and eat food. And since I have only received a very minor raise at the beginning of this year, I guess this year paid off majorly in terms of experience only.&lt;/p&gt;

&lt;p&gt;Work from home is still far cheaper than work from office for both the company and individual working in the company. Then again, I was living in my parents home from past 23 years so i guess it was very wise decision to move out explore the world outside.&lt;/p&gt;

&lt;p&gt;Anyhow, here are some fun facts for this year:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I flew 7 times this year.&lt;/li&gt;
  &lt;li&gt;I watched two movies in the theatre. (I don’t watch that much movies in theatre, so two is a big number for me lols)&lt;/li&gt;
  &lt;li&gt;I walked 16,000 steps in a day once (while in Kashmir)&lt;/li&gt;
  &lt;li&gt;I played games on My “Linux” laptop (Doom 3 and Insurgency 2014)&lt;/li&gt;
  &lt;li&gt;My average screen time went down significantly this year due to real-life interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And’s that’s almost it for this year.
Thank you for reading &amp;amp; Happy new year!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>2000kms away from home</title>
   <link href="https://t4p4n.github.io/2024/04/07/2000kms-away-from-home"/>
   <updated>2024-04-07T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2024/04/07/2000kms-away-from-home</id>
   <content type="html">&lt;h1 id=&quot;life&quot;&gt;Life&lt;/h1&gt;

&lt;p&gt;It’s been 3 months since i moved to kochi, kerela and i’m not missing much here, thanks to the &lt;del&gt;awesome&lt;/del&gt; super hot weather &amp;amp; suburban vibes of kakkanad district, I live very close to the infopark.&lt;/p&gt;

&lt;p&gt;If you like tech &amp;amp; like minded people then this is place, Here almost everybody is working in IT domain.
I share same building with 4 other tenants and All of them are developers, except one guy who once was a developer too but now into management (of developers ofc.)&lt;/p&gt;

&lt;p&gt;There are just so many developers &amp;amp; so many people to learn from. During my first few days here, i met so many new devs (in person) which i don’t think i could ever imagine back when i was working remotely, So many great people living &amp;amp; working here.&lt;/p&gt;

&lt;p&gt;Also people are very grounded &amp;amp; humble as compared to delhi (Generally speaking although it depends from person to person, but overall i think this is comparatively better than delhi). So far never faced any issues while talking to people and asking for help.&lt;/p&gt;

&lt;p&gt;Almost everyone here understands english &amp;amp; can talk to you in english, if you get lost anywhere just ask any young person near you and they’ll guide you to your destination. P.S: Bro code works here as well.&lt;/p&gt;

&lt;p&gt;And people even understand hindi and can speak broken hindi, this surprised me because i as a north indian can’t understood a single word of malayalam because the reason is that i was totally unaware of culture of this place and as it’s way too far from delhi (more than 2000 kms).&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h1 id=&quot;food&quot;&gt;Food&lt;/h1&gt;

&lt;p&gt;I really like the food here, its the perfect match for me when it comes to spices &amp;amp; cooking, They just cook till the perfection point, nothing more &amp;amp; nothing less, just perfect.&lt;/p&gt;

&lt;p&gt;They just use the right amount of spices &amp;amp; oils. It’s never too spicy like we have in delhi, So it’s great for stomach, And so far never felt acidic or indigestion after eating from outside so far.&lt;/p&gt;

&lt;p&gt;My current favourite is dosa, masala dosa to be specific. There are many varieties of dosa here like plain dosa, podi dosa, ghee roast dosa, cheese masala dosa. And all of them are served with 3 types of coconut chutneys (orange - spicy &amp;amp; tangy, white - coconutty if that’s word, green - mint &amp;amp; coconut) &amp;amp; sambar curry.&lt;/p&gt;

&lt;p&gt;And my second favourite idly which i’ve only tried two times, because it is mostly available for breakfast and i have a old habit of eating breakfast so mostly its gone by time the i reach restaurant.&lt;/p&gt;

&lt;p&gt;And my third favourite is rice meals, which consists of boiled rice, 3-4 types of side curries, 1 main curry (usually sambar or rasam), a papadam, some curd, and some optional pickles and payasam which is dessert pudding and to be eaten after finishing the meal.&lt;/p&gt;

&lt;p&gt;Also these only few of the dishes which i mentioned for vegetarians, if you’re a non-vegetarian then you have a endless variety of seafood &amp;amp; meats they have everything here plus tons of restaurants serving arabian food.&lt;/p&gt;

&lt;p&gt;Though if you’re from north like me then you’ll probably miss authentic north indian food. They do serve good north indian food and its tasty as well but you’ll miss the punch of extra spiciness which is present in common north indian dishes like chole &amp;amp; rajma.&lt;/p&gt;

&lt;p&gt;My current goto restaurant is “Just Tiffins” which is located near kakkanad junction, For north indian cuisines i think they are best for pure veg north indian food.&lt;/p&gt;

&lt;p&gt;Lastly you gotta eat with your one hand which is norm here actually.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h1 id=&quot;cinema&quot;&gt;Cinema&lt;/h1&gt;

&lt;p&gt;Its small (when compared to bollywood) and filled talented actors &amp;amp; directors &amp;amp; script writers, So far i’ve watched only one full length movie in theatre which is Bramayugam.&lt;/p&gt;

&lt;p&gt;And it was a good experience because it was black &amp;amp; white, had very less dialogs which is good cause there were no subtitles. But i like indie stuff a bit more so i was looking for “malayalam short films with english subtitles”.&lt;/p&gt;

&lt;p&gt;Heres few which i’ve watched &amp;amp; liked:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rEnZ1kBWoIk&amp;amp;t=22s&quot;&gt;Cheryl&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=eMM4r6Hle7g&quot;&gt;Life on the rocks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=7_VGS7lGF64&quot;&gt;New normal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To be honest i want this post to be little bit more longer but this post was in draft since few weeks. So i’m just putting this out here before it gets too old.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>My 2023 wrap up</title>
   <link href="https://t4p4n.github.io/2023/12/31/my-2023-wrap-up"/>
   <updated>2023-12-31T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2023/12/31/my-2023-wrap-up</id>
   <content type="html">&lt;p&gt;This one is on my year 2023 review and how things went this year in my work &amp;amp; personal life.&lt;/p&gt;

&lt;h3 id=&quot;work-life&quot;&gt;Work life&lt;/h3&gt;

&lt;p&gt;Starting from work life, i think i was fairly consistent this year when it comes to code contributions. This year i was able to master nestjs &amp;amp; prisma &amp;amp; react &amp;amp; went dive enough that i can figure out things on my own if enough time is given to me.&lt;/p&gt;

&lt;p&gt;And now i also occaisonally go in source code of the libs to figure out how things are working behind fancy methods that a lib provides. Like last month i went a bit deep in shopify api js lib to figure out a server crash which was happening when using shopify api js lib for sessions turns out it was a lack of try catch block in our middleware.&lt;/p&gt;

&lt;p&gt;And speaking of communication skills, i think i improved a lot. Now i can handle a meeting as a host for 4 teammates (including me), And previously i used to get frozen few times &amp;amp; mind goes blank when explaining a idea or a problem in front of my teammates. But now i also use a hack, which is to take notes before (if your the host) and after any meeting. And also i can help my teammates in debugging &amp;amp; brainstorming ideas and problems when needed by pairing via slack huddle or gmeet.&lt;/p&gt;

&lt;p&gt;And one skill which i learned from handling customer support is to make reasonable yet ambigious promises for feature requests &amp;amp; bugfixes, from a developer prespective we never know how much time somethinig will take, so we ask for atleast 2 days even if the work is about 2 hours cause the code change needs to go through these phases, starting from the code review &amp;gt; manual testing &amp;gt; approval (if everything is ok) &amp;gt; staging (last manual test) finally release if everything is alright &amp;amp; monitoring the server &amp;amp; informing the client. And these things take time as usual so we need take this time into consideration.&lt;/p&gt;

&lt;p&gt;Speaking to clients on call, like 99.9% users are generally very good &amp;amp; polite and dealing with them is easy for me. But Dealing with 0.1% is a bit daunting for me so i let my senior to deal with them.&lt;/p&gt;

&lt;p&gt;All in all this year was turned out to be pretty great for me. We developed &amp;amp; launched around 4 apps which is not many but we explored other horizons too.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://i.imgur.com/qlLIAcm.jpg&quot;&gt;&lt;img src=&quot;https://i.imgur.com/qlLIAcm.jpg&quot; alt=&quot;https://i.imgur.com/qlLIAcm.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h3 id=&quot;personal-life&quot;&gt;Personal Life&lt;/h3&gt;

&lt;p&gt;One goal of mine was to focus on fitness, which i missed it entirely this year.&lt;/p&gt;

&lt;p&gt;And also the diet even though i follow a strict vegetarian diet but i ate quite less this year, compared to last year. The reason for this is possibly due to my habit of sitting too long &amp;amp; not taking enough breaks while working, and this resulted in lack of appetite.&lt;/p&gt;

&lt;p&gt;So for the next year i’ll be focusing on regular excercising &amp;amp; try to put on atleast some amount of muscle.&lt;/p&gt;

&lt;p&gt;And also one thing which i’m doing from past 2 years is to nightwalk and this year I was fairly consistent and walked for 4Kms or 5k steps almost daily. Here are some of pics i clicked this year:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://i.imgur.com/408469s.jpg&quot;&gt;&lt;img src=&quot;https://i.imgur.com/408469s.jpg&quot; alt=&quot;https://i.imgur.com/408469s.jpg&quot; /&gt;&lt;/a&gt;
(01/07/2023, 09:29 pm) A chill night in smoking hot weather of delhi with AQI less than 100 &amp;amp; cold breeze flowing through paddy fields, one of the best day of year 2023&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://i.imgur.com/wCHb6Jr.jpg&quot;&gt;&lt;img src=&quot;https://i.imgur.com/wCHb6Jr.jpg&quot; alt=&quot;https://i.imgur.com/wCHb6Jr.jpg&quot; /&gt;&lt;/a&gt;
(18/12/2023, 08:40pm) A cold night &amp;amp; a empty road with good AQI, few dogs walking with us after dinner.&lt;/p&gt;

&lt;h4 id=&quot;learnings-this-year-personal&quot;&gt;Learnings this year (personal)&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;Understanding power dynamics in family relations &amp;amp; making sure that no one will take any advantage of me.&lt;/li&gt;
  &lt;li&gt;Keeping distance from toxic people and not letting interfere with my life decisions.&lt;/li&gt;
  &lt;li&gt;Not chasing desires &amp;amp; people, desires come &amp;amp; go and same with people, and i don’t try to chase them, and i try to go with the flow.&lt;/li&gt;
  &lt;li&gt;Understanding my responsiblities &amp;amp; trying to reduce them gradually.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These were the few of major points which i learned this year,
And there are few things which i’ve done first time in my life:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Travelling to bikaner (450kms) via train&lt;/li&gt;
  &lt;li&gt;Walking 20k steps in one day, (was attending &amp;amp; assisting in a wedding ceremony)&lt;/li&gt;
  &lt;li&gt;Buying shoes for myself (lols i don’t like wearing shoes but i brought &amp;amp; wore them because of wedding ceremony)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you very much for reading till the end. And Have a nice day.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Migrating from prisma to kysely (nestjs)</title>
   <link href="https://t4p4n.github.io/2023/08/14/prisma-to-kysely"/>
   <updated>2023-08-14T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2023/08/14/prisma-to-kysely</id>
   <content type="html">&lt;h2 id=&quot;backstory&quot;&gt;Backstory&lt;/h2&gt;

&lt;p&gt;I recently got assigned a ticket to implement kysely sql query builder in a production app, as prisma was hitting our Pg instance way too much than it should, which is why our Pg instance is using more than 15GB ram.&lt;/p&gt;

&lt;p&gt;Though, our usecase is very read &amp;amp; write heavy,
so that’s why we’re switching to kysely that too partially, cause a full shift to kysely will take about a month or more than that.&lt;/p&gt;

&lt;p&gt;But never jump on the hype train, always consider your usecase first.&lt;/p&gt;

&lt;h3 id=&quot;important-notes&quot;&gt;Important Notes&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;if this is your first using a sql query builder* then it will be a bit hard to digest at first, for me its been a week since i’m dealing with kysely and sql query builders in general, and please consider my advice as a grain of salt. (* not to confuse with an orm. query builders are like sql written in a functional programming fashion which is also called a builder pattern, or method chaining.)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;You’ll be writing sql in js, and if you’re like me who is well proficient in prisma but a dumbo in raw sql, than trust me its hard man, you’ll be plucking eyelids hairs in no time.
(though i’ll add some handy queries at end of this post)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;chatgpt does not know anything about kysely, but you can ask it for knex query builder &amp;amp; since kysely is loosely inspired from it, you can take the code from there and apply accordingly to the docs of kysely, (which are kind of incomplete tbh).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Be extra careful, if your data is having datetime data like createdAt and updatedAt datetime fields.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Prisma does some black magic fuckery to converts your timestamps to utc, and kysely is barebones so you need to use a lib like dayjs to convert your datetime to utc.&lt;/p&gt;

&lt;h3 id=&quot;tutorial&quot;&gt;Tutorial&lt;/h3&gt;

&lt;p&gt;So, start by installing &lt;a href=&quot;https://kysely.dev/docs/getting-started&quot;&gt;kysely&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://github.com/RobinBlomberg/kysely-codegen&quot;&gt;kysely-codegen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;kysely-codegen will inspect your existing database &amp;amp; generate a file with types based upon table structures in db.&lt;/p&gt;

&lt;p&gt;Now after generating types, create a dir. inside src of server workspace and name whatever you like, i’ll be using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kysely-orm&lt;/code&gt; and create few files &amp;amp; dir:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;migrations
    &lt;ul&gt;
      &lt;li&gt;initial-migration.ts&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;migrator.ts&lt;/li&gt;
  &lt;li&gt;schema.b.ts(copy the generated types from kysely-codegen dir &amp;amp; paste it here.)&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;ul&gt;
  &lt;li&gt;initial-migration.ts&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sql&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;kysely&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;up&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Creatng table Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;schema&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;primaryKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;unique&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderNumber&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;timestamp&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;defaultTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sql&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`now()`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;updatedAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;timestamp&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderJSON&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Creatng table Refund&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;schema&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;primaryKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;refundId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;unique&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;references&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order.id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onDelete&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;cascade&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addColumn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;timestamp&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;down&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;any&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dropTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dropTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;migrator.ts&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Migrator&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;kysely&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;migrateToLatest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;migrator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Migrator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;migrator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;migrateToLatest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;RESULT: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ERROR: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Success&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`migration &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;migrationName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot; was executed successfully`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`failed to execute migration &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;migrationName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;failed to migrate&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;schema.b.ts&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;kysely&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Generated&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;infer&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;S&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infer&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;infer&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;U&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;S&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;I&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;U&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JsonValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;K&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]?:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonPrimitive&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonValue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JsonPrimitive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Timestamp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ColumnType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Order&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;orderNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Timestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;updatedAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Timestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;orderJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Refund&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;refundId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Timestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DB&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;src/modules/shared/kysely.service&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Injectable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OnModuleInit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@nestjs/common&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;migrateToLatest&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;src/kysely-orm/migrator&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Pool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;pg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PostgresDialect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;kysely&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DB&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;src/kysely-orm/schema.b&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConfigService&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;./config.service&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Injectable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;KyselyService&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;implements&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OnModuleInit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;dialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PostgresDialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;readonly&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;configService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConfigService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dbName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kyselyConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dialect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PostgresDialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;pool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Pool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dbName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Kysely&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;dialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dialect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;onModuleInit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;migrateToLatest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3 id=&quot;some-sample-queries-implemented-in-a-order-service&quot;&gt;Some sample queries implemented in a order service&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;src/modules/order/order.service.ts&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Injectable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@nestjs/common&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createId&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@paralleldrive/cuid2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Order&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@shopify/shopify-api/rest/admin/2023-04/order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jsonObjectFrom&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;kysely/helpers/postgres&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;KyselyService&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;src/shared/services/kysely.service&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;Injectable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;OrderService&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;readonly&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;kyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;KyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;upsertOrder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`Upserting record: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;insertInto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;orderNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;updatedAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;updated_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;orderJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onConflict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;oc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;oc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;doUpdateSet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;orderNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;updatedAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;updated_at&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;orderJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;returning&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;executeTakeFirst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error upserting records: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getRefundedOrdersByDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Refund&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;orderBy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;asc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;eb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;jsonObjectFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;eb&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;whereRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Refund.orderId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order.id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error fetching refunded orders: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getOrdersByDate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Date&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selectAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;orderBy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;asc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error fetching orders: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;deleteOrder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kyselyService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;db&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;deleteFrom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Order&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;orderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;shop&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;shopName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error deleting order: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;also note we migrate on module initialization, but i suggest using kysely-migrator-cli if you want more control over migrations.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Feature flags 🏁</title>
   <link href="https://t4p4n.github.io/2023/05/27/feature-flags"/>
   <updated>2023-05-27T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2023/05/27/feature-flags</id>
   <content type="html">&lt;h5 id=&quot;what-is-feature-flag&quot;&gt;What is feature flag?&lt;/h5&gt;

&lt;p&gt;Its like toggle switch in app which enable let developers to turn on/off a particular feature in the whole application. Some common ones are you might have used is maybe &lt;a href=&quot;chrome://flags/&quot;&gt;chrome://flags/&lt;/a&gt; and and maybe also developers settings in android smartphones&lt;/p&gt;

&lt;h5 id=&quot;heres-a-real-world-scenario&quot;&gt;Here’s a real-world scenario:&lt;/h5&gt;

&lt;p&gt;At StoreTools, we recently released a new feature that allows us to restrict the maximum number of orders a user can print based on their subscribed plan. However, after the release, we discovered that many merchants were already exceeding their plan’s order limit. The main issue arose from the fact that we were displaying an error in JSON format, but we weren’t effectively parsing and presenting this error as a user-friendly banner.&lt;/p&gt;

&lt;p&gt;Consequently, several merchants contacted us, reporting the error they were facing. As a quick solution, we had to temporarily comment out the code responsible for enforcing the order limit. This process, including deployment, took us around 30 minutes.&lt;/p&gt;

&lt;p&gt;This situation could have been optimized by utilizing feature flags. By implementing feature flags, we could have easily disabled the specific feature causing the issue. While I have not yet incorporated feature flags into a production environment in a proper manner, I believe that using them could have resolved this problem within a matter of seconds.
s&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Read more about them:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=AJa2B-twtG4&quot;&gt;IBM’s Video on Feature flags&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://launchdarkly.com/pricing/&quot;&gt;Launch Darkly&lt;/a&gt; a Saas providing products implementing feature flags in enterprises application&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Linux games list 2023</title>
   <link href="https://t4p4n.github.io/2023/01/03/linux-games-list-2023"/>
   <updated>2023-01-03T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2023/01/03/linux-games-list-2023</id>
   <content type="html">&lt;h4 id=&quot;backstory&quot;&gt;Backstory&lt;/h4&gt;
&lt;p&gt;I was looking for foss some games for linux, but couldn’t not able find unique ones.
so here’s what i aggregated from different sources:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://cxong.github.io/cdogs-sdl/&quot;&gt;C-dogs or cyberdogs&lt;/a&gt; top-down shooter, rouguelike&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://sourceforge.net/projects/corsixth.mirror/&quot;&gt;CorsixTH&lt;/a&gt; simulation, tycoon, hospital&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://blobbyvolley.de/&quot;&gt;Blobby Volley&lt;/a&gt; volley ball, sports, arcade&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://sourceforge.net/projects/lgames/&quot;&gt;L-games&lt;/a&gt; classics, bundle, puzzle, arcade&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://dhewm3.org/&quot;&gt;dhewm&lt;/a&gt; Doom 3, Classic&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://vdrift.net/&quot;&gt;VDrift&lt;/a&gt; racing, simulation&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.openlierox.net/&quot;&gt;OpenLieroX&lt;/a&gt; artillery, shoot’em up, worms, liero&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://sourceforge.net/projects/urquanmastershd/&quot;&gt;Uruanmastershd&lt;/a&gt; remake, star control 2&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://sourceforge.net/projects/dangerdeep/&quot;&gt;Danger from the deep&lt;/a&gt; submarine, simulation&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://sourceforge.net/projects/scorched3d/&quot;&gt;Scorched 3D&lt;/a&gt; artillery&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://trigger-rally.sourceforge.io/&quot;&gt;Trigger Rally&lt;/a&gt; racing, simulation, 3d, rally&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/miki151/keeperrl&quot;&gt;KeeperRL&lt;/a&gt; rouguelike, dungeon&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://pokerth.net/&quot;&gt;PokerTH&lt;/a&gt; poker, card&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://megamek.org/&quot;&gt;Megamek&lt;/a&gt; artillery, strategy, turn-based, battletech, fighting&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://chromium-bsu.sourceforge.io/&quot;&gt;Chromium BSU&lt;/a&gt; top-scrolling shooter, shoot’em up, space&lt;/li&gt;
  &lt;li&gt;Not written in electron or js btw, so dont judge by name :)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;recommendedi-like-to-play&quot;&gt;Recommended/I like to play&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://dopewars.sourceforge.io/&quot;&gt;Dope Wars&lt;/a&gt; trading, drugs, simulation, tycoon, classic&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.artsoft.org/&quot;&gt;Rocks n Diamonds&lt;/a&gt; boulder dash, puzzle, classic&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/suomipelit/ultimatetapankaikki&quot;&gt;Ultimate tapan kaikki&lt;/a&gt; top-down shooter, fight, classic dos, my name in it ;) .&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://tuxfootball.sourceforge.net/&quot;&gt;Tux-Football&lt;/a&gt; soccer, sports, football&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://shatteredpixel.com/&quot;&gt;Shattered Pixel Dungeon&lt;/a&gt; rouguelike, dungeon, pixel, 2d&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;terminal&quot;&gt;Terminal&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.seehuhn.de/pages/moon-buggy&quot;&gt;moon-buggy&lt;/a&gt; jumping, running, space&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Thynix/Cavez-of-Phear&quot;&gt;cavez of phear&lt;/a&gt; boulder dash, clone&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;references&quot;&gt;References:&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://sourceforge.net/directory/games-entertainment/linux&quot;&gt;https://sourceforge.net/directory/games-entertainment/linux&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Linux_gaming&quot;&gt;https://en.wikipedia.org/wiki/Linux_gaming&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_open-source_video_games&quot;&gt;https://en.wikipedia.org/wiki/List_of_open-source_video_games&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blends.debian.org/games/tasks/&quot;&gt;https://blends.debian.org/games/tasks/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://wiki.debian.org/Game&quot;&gt;https://wiki.debian.org/Game&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>XFCE tiling window manager</title>
   <link href="https://t4p4n.github.io/2023/01/02/xfce-tiling"/>
   <updated>2023-01-02T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2023/01/02/xfce-tiling</id>
   <content type="html">&lt;h4 id=&quot;backstory&quot;&gt;Backstory&lt;/h4&gt;
&lt;p&gt;its been like a week since i installed linux mint cinnamon (now xfce)
i was looking on the internet to enable xfce’s inbuilt tiling feature from like past three days,
all i found was mostly to just remap keys with like super + up, down, left, right etc.
i’ve tried it maybe four times if i recall corrrectly. Somehow i stumbled upon this video today
https://www.youtube.com/watch?v=TUHIbkwoyU8&lt;/p&gt;

&lt;p&gt;i recommend to watch this video! if you have time!!!&lt;/p&gt;

&lt;p&gt;Here’s the tldr;/text version of it.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Don&apos;t use map super key for anything, if it is already mapped to whisker menu&lt;/li&gt;
  &lt;li&gt;Remap the keys from window manager -&amp;gt; keyboard with anything you like except super though&lt;/li&gt;
  &lt;li&gt;QuickTip use alt key as most of us are used to use alt + tab to change window focus.&lt;/li&gt;
  &lt;li&gt;QuickTip2 dont need install xcape for this (no need to add extra dependencies for simple stuff)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;heres-mine-keymapping-for-tiling&quot;&gt;Here’s mine keymapping for tiling.&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;Super + numpad/keypad up, down, left, right for widow tiling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://imgur.com/ai59JpD.png&quot;&gt;&lt;img src=&quot;https://imgur.com/ai59JpD.png&quot; alt=&quot;https://imgur.com/ai59JpD.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Switched to linux</title>
   <link href="https://t4p4n.github.io/2022/12/30/switched-to-linux"/>
   <updated>2022-12-30T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/12/30/switched-to-linux</id>
   <content type="html">&lt;h3 id=&quot;linux-mint-to-be-specific&quot;&gt;Linux Mint to be specific&lt;/h3&gt;
&lt;p&gt;i was waiting for this to happen. I’ve made plans for it way back in August i believe,
i never liked windows, but had to use it because it wasn’t my own laptop, I brought
this new mid range machine that is acer aspire 7
i5 12th gen(1240p) 12 cores, 16 threads, 4.4ghz max turbo (Well enough for most use cases)
8GB Ram (enough for linux, very low for windows 11 especially if you work with VMs/WSL)
512GB (pcie gen 4 nvme SSD, good for me, cause i only hoard m4a &amp;amp; mp3s music files.)
NVIDIA GTX1650 (good entry level gpu, but i dont do gaming lols)&lt;/p&gt;

&lt;h5 id=&quot;so-how-was-the-experience&quot;&gt;So how was the experience?&lt;/h5&gt;

&lt;p&gt;it wasn’t great at first, cause i initially 
broke my first linux mint installation because of nvidia drivers :(
now, i’m running without nvidia drivers, and its working pretty fine thanks to xfce.&lt;/p&gt;

&lt;h5 id=&quot;why-linux-mint&quot;&gt;Why linux mint?&lt;/h5&gt;

&lt;p&gt;I dont really like distro hopping, i needed something stable, cause i use this laptop as my personal laptop.
After a bit of research i found linux mint to beginner friendly as well as easy to install &amp;amp; configure.&lt;/p&gt;

&lt;p&gt;Fast forward -»&amp;gt;
Linux mint cinnamon was laggy atleast for me, i dont know why.
even youtube playback for 720p video dropped frames a lot.
Did some googling can’t find anything useful, so i decided to switch to xfce DE
configured xfce-panel, whisker menu, installed &amp;amp; configured xfce goodies etc.
This took me while like 4-5 hours&lt;/p&gt;

&lt;p&gt;i mainly had experience with linux commandline, thanks to termux &amp;amp; arch arm
before this i’ve only tried like 2 two times, that is once in virtual box &amp;amp; once in native machine
didn’t really liked the experience with VMs which is due to my old low spec laptopm (i have HP notebook from 2016, i3 5th, 4Gb ram, 1TB HDD).&lt;/p&gt;

&lt;p&gt;But when it comes to commandline on windows, i never liked powershell for node or python devlopment cause i really hate their
lack of auto-completion &amp;amp; very long commands to do simple things like opening up a port &amp;amp; bypassing the firewall for incoming connections etc. I always liked linux cli with zsh &amp;amp; tmux, its ultimate combo if you’re a power user/developer.&lt;/p&gt;

&lt;p&gt;some annoying things are linux i found/ not figured out yet!
are as follows:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;weird theming with chrome(probably caused by GTK)&lt;/li&gt;
  &lt;li&gt;inconsistent font size (maybe caused by misconfiguration from my side)&lt;/li&gt;
  &lt;li&gt;scaling (XFCE bug/feature) only 1, or 2 not like 1.25 etc&lt;/li&gt;
  &lt;li&gt;xfce terminal* (took 5 hours to replicate my setup from wsl2 ubuntu &amp;amp; windows terminal)&lt;/li&gt;
  &lt;li&gt;Bluetooth GUI was not showing my dell mouse, but bluectl found it, still connects &amp;amp; disconnects like every 2s.&lt;/li&gt;
  &lt;li&gt;webcam is not working!!!! thanks to acer &amp;amp; no drivers for it in linux&lt;/li&gt;
  &lt;li&gt;mouse wheel scroll is very slow, third party stuff makes it worse (lookin at you imwheel)&lt;/li&gt;
  &lt;li&gt;Way too much time taking to configure all these things.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;i’m a perfectionist (kinda) and i think my machine is now close to perfection (atleast for me)
i can bear the pain for small things to get some freedom from windows 11.
Btw really proud of xfce terminal &amp;amp; i configured it with these features:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;select to copy&lt;/li&gt;
  &lt;li&gt;crtl + v to paste&lt;/li&gt;
  &lt;li&gt;tmux mouse support&lt;/li&gt;
  &lt;li&gt;unicode support&lt;/li&gt;
  &lt;li&gt;cmus&lt;/li&gt;
  &lt;li&gt;cava&lt;/li&gt;
  &lt;li&gt;lsd, bat, git-delta&lt;/li&gt;
  &lt;li&gt;oh my zsh (can’t live without this one!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;btw replicating the same setup on macOS is way easier then linux. Because community &amp;amp; consistency of macOS
things are stable &amp;amp; preconfigured in macOS, mostly its just download application &amp;amp; run it (in a nutshell it works. But man copy pasting &amp;amp; selecting text is real pain in macOS thanks weird command key obbession).&lt;/p&gt;

&lt;h6 id=&quot;screenshots&quot;&gt;Screenshots&lt;/h6&gt;
&lt;p&gt;&lt;a href=&quot;https://imgur.com/rKcezq1.png&quot;&gt;&lt;img src=&quot;https://imgur.com/rKcezq1.png&quot; alt=&quot;https://imgur.com/rKcezq1.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://imgur.com/Cfh2pSl.png&quot;&gt;&lt;img src=&quot;https://imgur.com/Cfh2pSl.png&quot; alt=&quot;https://imgur.com/Cfh2pSl.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://imgur.com/xEeCl22.png&quot;&gt;&lt;img src=&quot;https://imgur.com/xEeCl22.png&quot; alt=&quot;https://imgur.com/xEeCl22.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Connecting the dots (Partially)</title>
   <link href="https://t4p4n.github.io/2022/12/17/connecting-the-dots-partially"/>
   <updated>2022-12-17T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/12/17/connecting-the-dots-partially</id>
   <content type="html">&lt;p&gt;I’m very happy to see how small things are coming together to help me in my day to day work life as a junior developer. My web dev journey as started in late 2020 which you read more about it &lt;a href=&quot;https://t4p4n.github.io/about/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before joining &lt;a href=&quot;https://storetools.io/&quot;&gt;storetools&lt;/a&gt;, i had some little experience as i completed my first book &lt;a href=&quot;https://www.packtpub.com/product/django-4-by-example-fourth-edition/9781801813051&quot;&gt;django 3 by example&lt;/a&gt;, it taught me &lt;a href=&quot;https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller&quot;&gt;MVC&lt;/a&gt; architecture , &lt;a href=&quot;https://en.wikipedia.org/wiki/Database&quot;&gt;Databases&lt;/a&gt;, Basic &lt;a href=&quot;https://en.wikipedia.org/wiki/Request%E2%80%93response&quot;&gt;request response&lt;/a&gt; cycle etc.  As well as django specific things like &lt;a href=&quot;https://docs.djangoproject.com/en/4.1/ref/templates/language/&quot;&gt;Django template language&lt;/a&gt;, &lt;a href=&quot;https://docs.djangoproject.com/en/4.1/topics/db/queries/&quot;&gt;Django ORM&lt;/a&gt;, Django admin panel, APIs with &lt;a href=&quot;https://www.django-rest-framework.org/&quot;&gt;Django Rest Framework&lt;/a&gt;. And also i got some more experience as I did few freelance projects with &lt;a href=&quot;https://b3nsh4.com&quot;&gt;Ben&lt;/a&gt;. We got to learn many things such as working on a legacy code of Django 2 version, Extending with out own ideas such as implementing online payments into a old Hostel management system. Working on chat application that we made in &lt;a href=&quot;https://flask.palletsprojects.com/en/2.2.x/&quot;&gt;flask&lt;/a&gt; &lt;a href=&quot;https://socket.io/&quot;&gt;socketio&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/WebSocket&quot;&gt;websockets&lt;/a&gt;, that was my first intro to &lt;a href=&quot;https://en.wikipedia.org/wiki/Event-driven_architecture&quot;&gt;event driven&lt;/a&gt; programming.&lt;/p&gt;

&lt;p&gt;Also i used to learn &lt;a href=&quot;https://owasp.org/&quot;&gt;web security&lt;/a&gt; in 2019, which taught me how to use browser dev tools, And also learned frontend from &lt;a href=&quot;https://www.kevinpowell.co/&quot;&gt;kevin powell&lt;/a&gt; &amp;amp;  &lt;a href=&quot;https://www.traversymedia.com/&quot;&gt;Traversy Media&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nowadays i work mostly with &lt;a href=&quot;https://nestjs.com/&quot;&gt;nestjs&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://reactjs.org/&quot;&gt;react&lt;/a&gt; &amp;amp; as well as some &lt;a href=&quot;https://shopify.github.io/liquid/&quot;&gt;liquid template&lt;/a&gt;, 
which are kind of same tech but just with &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript&quot;&gt;javascript&lt;/a&gt; flavour this time instead of &lt;a href=&quot;https://www.python.org/&quot;&gt;Python&lt;/a&gt;, I can speed things up for me like 2x because of past experiences with Programming. TLDR; Learning never goes to waste… unless ofcourse its &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;ruby&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://rubyonrails.org/&quot;&gt;rails&lt;/a&gt; *&lt;/p&gt;

&lt;p&gt;Btw its just the starting, That is why i named this post as Connecting the dots (partially), i have plenty of things to learn &amp;amp; utilize in future. So let’s see how this goes.&lt;/p&gt;

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

&lt;p&gt;* (just kidding i still have plenty of space in my heart for  &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;ruby&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://rubyonrails.org/&quot;&gt;rails&lt;/a&gt;)&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Trainspotting Review</title>
   <link href="https://t4p4n.github.io/2022/12/05/trainspotting-review"/>
   <updated>2022-12-05T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/12/05/trainspotting-review</id>
   <content type="html">&lt;p&gt;[10/10] Not gonna lie&lt;/p&gt;

&lt;h4 id=&quot;how-i-found-trainspotting&quot;&gt;How i found Trainspotting!?&lt;/h4&gt;
&lt;p&gt;i usually listen to doomer music which is basically classical rock genre mixed with sad vibes. Specifically I was watching this video:
&lt;a href=&quot;https://m.youtube.com/watch?v=9XViPhRnOiQ&quot;&gt;Crystal Castles - Vanished &lt;/a&gt; (This track is also amazing!!!)&lt;/p&gt;

&lt;p&gt;In the description of this i found out the movie name&lt;/p&gt;

&lt;h4 id=&quot;what-i-did-after-finding-the-movie-name&quot;&gt;What i did after finding the movie name?&lt;/h4&gt;
&lt;p&gt;i went straight to yts torrents, got .torr* file;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aria2c filename.torrent&lt;/code&gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; wait for 20 mins
And there you have it 1080p copy of Trainspotting&lt;/p&gt;

&lt;p&gt;I try to avoid reading anything about a movie before watching it. I think its defeats the purpose of watching a movie, its removes the surprise from movie.&lt;/p&gt;

&lt;p&gt;if there are scenes of a movie appear in doomer music video then its probably Good or A masterpiece.&lt;/p&gt;

&lt;h4 id=&quot;started-watching-it&quot;&gt;Started watching it:&lt;/h4&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; 11:30pm - 1:00am&lt;br /&gt;
At first i thought its yet another “hollywood movie” after watching the movie i googled about it, Turned out It was a British masterpiece made in 1996. Also Its in the British top 100 movies of all time, at tenth spot tho.&lt;/p&gt;

&lt;h4 id=&quot;plot&quot;&gt;Plot&lt;/h4&gt;
&lt;p&gt;i dont wanna spoil it !!! if you’re into drugs &amp;amp; crime genre &amp;amp; “you’re quiet &amp;amp; sensitive type and your inner you is witty, adventurous, passionate, loving, loyal &amp;amp; a little bit crazy &amp;amp; a little bit bad”&lt;/p&gt;

&lt;p&gt;You’ll gonna love it that’s my promise&lt;/p&gt;

&lt;p&gt;Also worth mentioning is the soundtracks
i personally really liked Atomic by sleeper &amp;amp; Temptation by new order.
Now its time for me to get a final hit (just kidding)&lt;/p&gt;

&lt;p&gt;Bye Bye&lt;br /&gt;
Thanks for reading&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Setup postgresql for web development</title>
   <link href="https://t4p4n.github.io/2022/10/27/postgresql-web-development-setup"/>
   <updated>2022-10-27T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/10/27/postgresql-web-development-setup</id>
   <content type="html">&lt;h3 id=&quot;login-into-postgresql-server-using-adminroot-privileges&quot;&gt;Login into postgresql server using admin/root privileges&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; postgres psql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;inside-postgresql-root-shell&quot;&gt;Inside postgresql root shell&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Create a database
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;create database database_name&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;_&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Create a new user
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;create user username_here with encrypted password &lt;span class=&quot;s1&quot;&gt;&apos;password_here&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;_&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Grant all privileges to user on the database
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;grant all privileges on database database_name to username_here&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;p&gt;_&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So far this is enough for most cases like working with Ruby on Rails(Active record), Django(Django ORM), Flask(SQLAlchemy), Laravel(Eloquent), And Spring(Hibernate) etc.&lt;/p&gt;

&lt;p&gt;But things are a bit different in when it comes to prisma (ORM mostly popular in js ecosystem)
it requires us to make a new shadow database before every migrations.&lt;/p&gt;

&lt;p&gt;You can read more about it &lt;a href=&quot;https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically we need our database user to have permission to create new database in postgresql server. To do this run:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ALTER ROLE username_here CREATEDB&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To check if user has permission to create new databases run this:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;se&quot;&gt;\d&lt;/span&gt;u
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;it should output a table something similar to this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; Role name         |                         Attributes                         | Member of
-------------------+------------------------------------------------------------+-----------
 postgres          | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 username_here     | Create DB                                                  | {}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here are some common postgresql commands:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\q&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crtl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d&lt;/code&gt; quits the postgresql shell&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\l&lt;/code&gt; lists all available databases&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crtl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;l&lt;/code&gt; clears the console&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crtl&lt;/code&gt; + &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c&lt;/code&gt; quits currently typed command in the postgresql shell&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\?&lt;/code&gt; for help&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;thanks-for-reading--keep-coding&quot;&gt;Thanks for reading &amp;amp; Keep coding!!!&lt;/h4&gt;

</content>
 </entry>
 
 <entry>
   <title>Rails active resource link helper</title>
   <link href="https://t4p4n.github.io/2022/09/15/rails-active-link-helper"/>
   <updated>2022-09-15T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/09/15/rails-active-link-helper</id>
   <content type="html">&lt;p&gt;There are many snippets on stack overflow around this topic but&lt;br /&gt;
those are mostly dealing with a specific link to a page or a resource e.g. about page or blogs page
if you haven’t tried those snippets, you can try this one out:&lt;/p&gt;

&lt;h6 id=&quot;apphelpersapplication_helperrb&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app/helpers/application_helper.rb&lt;/code&gt;&lt;/h6&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ApplicationHelper&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;current?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_page?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;_&lt;/p&gt;

&lt;h6 id=&quot;viewslayoutapplicationhtmlerb&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;views/layout/application.html.erb&lt;/code&gt;&lt;/h6&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;%= url_for(admin_posts_path) %&amp;gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;%= &quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sample_active_link_class&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;admin_posts_path&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt; normal_class&quot;
    &amp;gt; Posts &lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This works using the current_page function provided by rails action view url helper.
Read more about it &lt;a href=&quot;https://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically this current functions takes two arguments which are&lt;br /&gt;
key in our case the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sample_active_link_class&lt;/code&gt; And path&lt;br /&gt;
which we have here as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin_posts_path&lt;/code&gt; , and returns the key (classname)&lt;/p&gt;

&lt;p&gt;if the current_page is matches the given path/url (i.e. admin_posts_path). 
Else it returns nothing and we fall back to normal_class_name&lt;/p&gt;

&lt;p&gt;The above code is sufficient if we’re working with a simple navbar which have doesn’t need &lt;br /&gt;
“dynamicness” if lets say we have a navbar &amp;amp; content page like this&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;T4P4N  | [ ...search ]         |
_______________________________|
Posts* | Hello world           |
       | [first_post, new_tag] |
_______| by t4p4n              |
Tags   | edit | delete         |
       |                       |
_______|_______________________|
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;* represents active state^
if we click on edit this *
will disappear as we’re no longer on the index page
but we’re still working with a post resource so it needs
to be in active state.&lt;/p&gt;
&lt;h5 id=&quot;this-is-when-we-need-the-snippet-below&quot;&gt;This is when we need the snippet below:&lt;/h5&gt;

&lt;p&gt;_&lt;/p&gt;

&lt;h6 id=&quot;apphelpersactive_resource_helperrb&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app/helpers/active_resource_helper.rb&lt;/code&gt;&lt;/h6&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ActiveResourceHelper&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;on_posts_index_show_edit?&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;in_posts?&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;action_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;index&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;action_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;show&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;action_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;edit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
    


    &lt;span class=&quot;kp&quot;&gt;private&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;in_posts?&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;controller_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;posts&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;    
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;_&lt;/p&gt;

&lt;h6 id=&quot;viewslayoutapplicationhtmlerb-1&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;views/layout/application.html.erb&lt;/code&gt;&lt;/h6&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;%= url_for(admin_posts_path) %&amp;gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;%= &quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;{&quot;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;sample_active_link_class&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;on_posts_index_show_edit&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;?}&quot;&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt; normal_link_class &quot;
    &amp;gt; Posts &lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;how-does-this-work&quot;&gt;How does this^ work?&lt;/h3&gt;
&lt;p&gt;here we’re working with just two variables provided by rails to help us in
these kind of scenarios, first one is : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;action_name&lt;/code&gt;
which as the name suggests, have the value of current action &lt;br /&gt;
on the specific page that we’re rendering.&lt;/p&gt;

&lt;p&gt;And second one is 
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;controller_path&lt;/code&gt; which simply returns anything after the base url
that is in our case &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;admin/posts&lt;/code&gt;, which then split by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt; and&lt;br /&gt;
we get the second item from array returned by split function, and check if its&lt;br /&gt;
the same as we want to be.&lt;/p&gt;

&lt;p&gt;This is useful when we are creating a navbar for a admin panel &lt;br /&gt;
where we need to list all available resources of our application 
&amp;amp; have actions associated with them like index, create, edit,
 show, delete etc.&lt;/p&gt;

&lt;h4 id=&quot;thanks-for-reading&quot;&gt;Thanks for reading!&lt;/h4&gt;
</content>
 </entry>
 
 <entry>
   <title>Ruby on rails active storage custom key or path</title>
   <link href="https://t4p4n.github.io/2022/09/13/rails-active-storage-custom-key-or-path-s3"/>
   <updated>2022-09-13T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/09/13/rails-active-storage-custom-key-or-path-s3</id>
   <content type="html">&lt;ul&gt;
  &lt;li&gt;Chances are if you came to this post, you’re probably looking for this snippet:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;profile_pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;attach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;io:  &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;filename:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_filename&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;key:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;images/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_filename&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Okay so what it does actually, 
first we get the uploaded file from params 
and then we attach the image with model_object.attach method
You can read more about it  &lt;a href=&quot;https://github.com/rails/rails/commit/4dba136c83cc808282625c0d5b195ce5e0bbaa68&quot;&gt;here&lt;/a&gt;
and then just call the save method.&lt;/p&gt;

&lt;p&gt;Basic idea is we have to treat images or files separately 
if we want to use custom key, Otherwise it will generate keys like this:  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pv8xs3kdz4aohenj9znjgrhpgty8&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zem3wx1hmiyh9q4ahyuav1ooj4j9&lt;/code&gt;
which is definitely worse than these : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/420/my_pic.jpg&lt;/code&gt; , &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;images/420/oYUcPwegJppnAK4UJmv52e3xpNXf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the long run when we want to migrate/remove our data, we can do 
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rm -rf images/&lt;/code&gt; on the other hand if we use auto generated keys we need to figure out which one are images 
or videos or documents etc.&lt;/p&gt;

&lt;p&gt;Since auto generated keys doesn’t have extensions. 
We can’t really check them without opening the files, 
and not to mention that we also don’t have directories 
(which is essentially just keys separated by backslashes).&lt;/p&gt;

&lt;p&gt;But there’s one issue this approach  if we use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;original_filename&lt;/code&gt; in the key like this:&lt;/p&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;profile_pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;attach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;io:  &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;filename:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_filename&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;ss&quot;&gt;key:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;images/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_filename&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;########################## Here^&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;the-issue-we-need-to-face-is-duplicate-key-error-which-will-be-caused-if-user-tries-to-upload-a-image-with-same-name-so-lets-look-what-is-it--how-to-deal-with-it&quot;&gt;The issue we need to face is Duplicate Key Error which will be caused if user tries to upload a image with same name. so let’s look what is it &amp;amp; how to deal with it?&lt;/h5&gt;
&lt;h4 id=&quot;error&quot;&gt;Error&lt;/h4&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;RecordNotUnique&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;PG&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;UniqueViolation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;duplicate&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;violates&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unique&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;constraint&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;index_active_storage_blobs_on_key&quot;&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;DETAIL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;no&quot;&gt;Key&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;420&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;profile_pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;jpg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;already&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exists&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;the-deal&quot;&gt;The deal&lt;/h5&gt;
&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt;  &lt;span class=&quot;s1&quot;&gt;&apos;securerandom&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# important^&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UsersController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ApplicationController&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;create&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;profile_pic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;attach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
		&lt;span class=&quot;ss&quot;&gt;io:  &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
		&lt;span class=&quot;ss&quot;&gt;filename:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;original_filename&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;ss&quot;&gt;key:  &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;images/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SecureRandom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;base58&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;c1&quot;&gt;########################## Use This^&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;save&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Explanation: we import the the secure random module with  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require  &apos;securerandom&apos;&lt;/code&gt; you can read more about it &lt;a href=&quot;https://ruby-doc.org/stdlib-1.9.2/libdoc/securerandom/rdoc/SecureRandom.html&quot;&gt;here&lt;/a&gt;
PS: it generates secure and also random strings/numbers/hex/bytes etc.
 this module is also used by rails active storage evidence &lt;a href=&quot;https://api.rubyonrails.org/classes/ActiveRecord/SecureToken/ClassMethods.html#method-i-generate_unique_secure_token&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://apidock.com/rails/ActiveStorage/Blob/key&quot;&gt;here&lt;/a&gt;
 also i checked both keys one(auto-gen by rails) by one(our patch above)
 both have same length (28 chars)&lt;/p&gt;

&lt;p&gt;just so that we don’t have to worry about potential security issues introduced by our own patches.&lt;/p&gt;

&lt;p&gt;Anyways that’s it for this one!
 if you want  to support me! just me hit up!  via &lt;a href=&quot;https://t4p4n.github.io/contact/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>Data migration from old to new laptop</title>
   <link href="https://t4p4n.github.io/2022/09/12/file-transfer-between-laptops"/>
   <updated>2022-09-12T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/09/12/file-transfer-between-laptops</id>
   <content type="html">&lt;p&gt;This sunday, i tried to transfer files from my old hp notebook(i3 5th gen, 4GB, 1TB HDD) 
to my acer aspire 7 laptop(i5 12th gen, 8GB 512 GB pcie gen4 ssd)&lt;/p&gt;

&lt;p&gt;After doing all the typical morning routine stuff,
i’m ready to rock, not really cause frustration ahead :(&lt;/p&gt;

&lt;p&gt;First thing i did was setting up openssh on windows 10 (native i,e not wsl) and it was painful tbh, took me 1.5 hrs
I already wsl2 ubuntu setup on my old laptop 
it could have great since i consider myself already good with linux.&lt;/p&gt;

&lt;p&gt;But some issues with WSL2 Ubuntu
its with IP assigned to WSL2 (btw wsl2 is a vm) each time network switches, The IP of wsl2  machine changes to some random IP, 
which then needs to be forwarded via port proxy (powershell cmd) so that it exposed To LAN.&lt;/p&gt;

&lt;p&gt;This is why i choose windows 10 native openssh server although it wasn’t a good experience due to lack of documentation from Microsoft side.&lt;/p&gt;

&lt;p&gt;This was the network diagram after setting up openssh server:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Old laptop &amp;lt;---&amp;gt; My Phone &amp;lt;---&amp;gt; New Laptop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;i used my phone as wifi hotspot to connect both devices &amp;amp; Winscp(scp client) on new laptop.&lt;/p&gt;

&lt;p&gt;if you’re wondering why i used my phone?
it’s because our router is a bit far away from my room, not mention that it may slow down others internet(LAN) too, 
since its a cheap router like 10 bucks or 800rs. And also probably would have caused speed issues due to lack of network coverage in my roon.&lt;/p&gt;

&lt;p&gt;But even with my phone sitting in between two laptops (and i mean technically &amp;amp; literally both here) and 
bummer i got like 3-4 MB data transfer speed :( and not only that ii was fluctuating cause of number of files i was transferring about 10GB
and an average about 3 MB per file&lt;/p&gt;

&lt;p&gt;So i left it on for a while &amp;amp; slept for like 1 hr
and i woke at 2:30pm i guess &amp;amp; it was still in progress &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-_-&lt;/code&gt; anyhow i let it run, there’s also another issue with wireless transfer, 
when i turned on Bluetooth to connect my wireless earphones to my phone, And then speed suddenly went down to like 949 kbps &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-_-&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This was happening due to air traffic between 2.4 ghz wifi &amp;amp; 2.4ghz Bluetooth using same frequency band.&lt;/p&gt;

&lt;p&gt;that was my situation i can’t even use my phone for anything &amp;amp; laptops are already busy transferring data, 
If you remember i was using my phone as wifi hotspot, and both laptops were connected to it. 
There’s also one problem with it was my phone didn’t had any internet pack available, 
so i was completely offline for like 3 hrs straight &amp;amp; without any entertainment lols&lt;/p&gt;

&lt;p&gt;That was probably why i fell asleep XD&lt;/p&gt;

&lt;p&gt;Fast forward to 3:30pm after transfer was complete i messaged my friend ben, 
and i informed him about the situation i was struggling with and asked for alternatives.&lt;/p&gt;

&lt;p&gt;He sent a photo of LAN Cable, and said it will useful in these scenarios &amp;amp; 
i asked few question about if we could connect two laptops directly without any switch or router, and he said yes, after a while 
I remembered my brother had one LAN cable, which came in the tenda router box. I went to upstairs for tea break, and got the cable.&lt;/p&gt;

&lt;p&gt;Connected the cable from old laptop to new laptop, And this was my first experience with a LAN Cable, 
I started searching the internet for sharing files with a lan cable, found some articles
did the typical network &amp;amp; file sharing setup in windows 10 &amp;amp; did test transfer of like 10GB
of my music collection, about roughly 2100+ audio files
and it just took less than 15mins.&lt;/p&gt;

&lt;p&gt;I got like 10MBps or 100mbps and this time it was almost consistent 10MBps, And also i was to able to use my Bluetooth earphones &amp;amp; internet(wifi) freely.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Persistent Checkbox Rails</title>
   <link href="https://t4p4n.github.io/2022/08/20/rails-persistent-checkbox"/>
   <updated>2022-08-20T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/08/20/rails-persistent-checkbox</id>
   <content type="html">&lt;h3 id=&quot;whats-the-problem&quot;&gt;Whats the problem&lt;/h3&gt;
&lt;p&gt;The default form helper for checkbox gives us weird mess of options to work with  &lt;br /&gt;
And i found them very very annoying to a beginner like me, the issue  &lt;br /&gt;
is when you submit a form with your checked checkboxes, they goto server as&lt;br /&gt;
usual params (with “0” and “1”, definetly not good for html we gonna need render next page)&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;s2&quot;&gt;&quot;is_mad&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s2&quot;&gt;&quot;q&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rails is fcked up&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;s2&quot;&gt;&quot;commit&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Search&quot;&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but when you render the you try with input checkbox&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:is_mad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and you get 1&lt;br /&gt;
which doesnt represents the checked state of checkbox so here’s the solution&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;%= form.check_box :is_mad, checked: true ? params[:is_mad].to_i =&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:&quot;bs-sucks&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;And this works as expected you get desired state of checkbox, entered by user.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Dunno why this isn’t posted anywhere on the internet all i see broken checkboxs&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Examples:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://betterprogramming.pub/build-a-smart-filter-for-your-rails-5-application-using-simple-form-and-acts-as-tattable-afac128e4159&quot;&gt;Bad Programming Hub&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.reddit.com/r/rails/comments/c201oc/issue_with_using_checkboxes_and_retaining_checked/&quot;&gt;Reddit post&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>A Good Day</title>
   <link href="https://t4p4n.github.io/2022/08/17/a-random-day"/>
   <updated>2022-08-17T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/08/17/a-random-day</id>
   <content type="html">&lt;p&gt;wakeup at 7:15 am  &lt;br /&gt;
went out to plot at 8:10am&lt;br /&gt;
shower &amp;amp; breakfast till 10am&lt;br /&gt;
work till 6:15 pm&lt;br /&gt;
in between had a chat with relative brother of mine&lt;br /&gt;
ate sandwich in lunch, In the Evening&lt;br /&gt;
after work, i went to terrace to enjoy the beautiful sunset&lt;br /&gt;
with partially cottony clouds, and cold breeze running through the trees all around&lt;br /&gt;
i messaged my brother for weather saying come up here fast.&lt;br /&gt;
we had small chats about various stuff exams politics independence day kites etc.&lt;br /&gt;
, looked at clouds sun sky, kites, all in all enjoyed every moment of sunset.&lt;br /&gt;
In the night after eating my dinner we went for night walk as usual&lt;br /&gt;
at nearby park (bankner sports complex), which is a community maintained &lt;br /&gt;
(not very well) park, we walked 4 rounds of 400 metres each with same awesome weather, &lt;br /&gt;
came back &amp;amp; washed my feets as always&lt;br /&gt;
since its very micro sandy there, the track that we walk is made of all raw sand &amp;amp; soil&lt;br /&gt;
compressed with a stone roller to avoid weed &amp;amp; shurbs growth on track,&lt;br /&gt;
after washing my feet i went to terrace to enjoy the breeze and also took my&lt;br /&gt;
bluetooth neckband earphones with me to have music.&lt;br /&gt;
Started listening to &lt;a href=&quot;https://www.youtube.com/watch?v=JRLFr6THaTI&quot;&gt;Low Hum Comatose&lt;/a&gt;. &lt;br /&gt;
While walking slowly and looking up at stars, &lt;br /&gt;
just within few seconds while walking i saw one of most rarest experience i ever had,&lt;br /&gt;
that seeing is a falling star in real life, it was astonishing, i was stunned for few seconds, &lt;br /&gt;
then smiled started walking again &amp;amp; just after that, power outage of whole village, And i’m like yes!  &lt;br /&gt;
when the power goes down, it feels way too good! zero to no noise pollution what so ever.
All dark &amp;amp; stars shining through the white cottony clouds,  &lt;br /&gt;
Cold breeze flowing with very good aqi about 70 less. &lt;br /&gt;
High visibility of both landscapes &amp;amp; sky.  &lt;br /&gt;
Yesterday was one of most awesome day for me in 2022.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Short term goals are important (rails)</title>
   <link href="https://t4p4n.github.io/2022/08/13/short-term-goals"/>
   <updated>2022-08-13T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/08/13/short-term-goals</id>
   <content type="html">&lt;p&gt;Let’s start by defining what short term goal is:
Its a achievable in short duration i.e within days or months for example learning ruby on rails&lt;/p&gt;

&lt;h3 id=&quot;create&quot;&gt;Create&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;like something a todo/blog app just to get a hint of how things work in rails&lt;/li&gt;
  &lt;li&gt;but only do this you haven’t work with MVC architecture before.&lt;/li&gt;
  &lt;li&gt;Otherwise build something that uses some more framework specific features like rails helpers &amp;amp; concerns or other features specific to your project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;modify&quot;&gt;Modify&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Read Code &amp;amp; Do incremental changes&lt;/li&gt;
  &lt;li&gt;Take notes with pen &amp;amp; paper, also try drawing relationship b/w two or models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;observe&quot;&gt;Observe&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Inspect generated migrations &amp;amp; schema&lt;/li&gt;
  &lt;li&gt;Inspect db after migrations &amp;amp; also after seeding&lt;/li&gt;
  &lt;li&gt;Read server logs &amp;amp; add print/puts statements in controllers it will give you a more clear idea about things are working internally.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;watch--read&quot;&gt;Watch &amp;amp; Read&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Watch videos about rails on YT checklout deanin , super rails, jesus castello railscasts etc.&lt;/li&gt;
  &lt;li&gt;Read blogs, checkout saeloun, big binary, Ruby Guides, also checkout learn rails 6 by adam notodikromo if you’re into books(like me)&lt;/li&gt;
  &lt;li&gt;Read rails guide.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;write--debug&quot;&gt;Write &amp;amp; Debug&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;don’t be afraid to mess things up&lt;/li&gt;
  &lt;li&gt;but if you did made a mess &amp;amp; it works&lt;/li&gt;
  &lt;li&gt;then its responsiblity to clean it up&lt;/li&gt;
  &lt;li&gt;PS: you can write spaghetti code but also refactor it as much as possible.&lt;/li&gt;
  &lt;li&gt;Do trial &amp;amp; error very important&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Reverse a Array</title>
   <link href="https://t4p4n.github.io/2022/05/30/reverse-array"/>
   <updated>2022-05-30T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/30/reverse-array</id>
   <content type="html">&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;reverse_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;reverse_arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Code is fairly simple to understand give it a try&lt;/li&gt;
  &lt;li&gt;Else just Google it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>FizzBuzz</title>
   <link href="https://t4p4n.github.io/2022/05/29/fizzbuzz"/>
   <updated>2022-05-29T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/29/fizzbuzz</id>
   <content type="html">&lt;h3 id=&quot;problem-statement&quot;&gt;problem statement:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;print fizz if the number is divisble by 3&lt;/li&gt;
  &lt;li&gt;print buzz if the number is divisble by 5&lt;/li&gt;
  &lt;li&gt;print fizzbuzz if the number is divisble by both 3 &amp;amp; 5&lt;/li&gt;
  &lt;li&gt;else just print the number.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fizzbuzz&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;FizzBuzz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Fizz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Buzz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;fizzbuzz&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Code is fairly simple to understand give it a try&lt;/li&gt;
  &lt;li&gt;Else just Google it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>Caesar Cipher</title>
   <link href="https://t4p4n.github.io/2022/05/28/caesar-cipher"/>
   <updated>2022-05-28T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/28/caesar-cipher</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Siege-alesia-vercingetorix-jules-cesar.jpg&quot; title=&quot;Lionel Royer
, Public domain, via Wikimedia Commons&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Siege-alesia-vercingetorix-jules-cesar.jpg/512px-Siege-alesia-vercingetorix-jules-cesar.jpg&quot; alt=&quot;Siege-alesia-vercingetorix-jules-cesar&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Try to implement caesar cipher using plain python.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;uppercase&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lowercase&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;abcdefghijklmnopqrstuvwxyz&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;&apos;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uppercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uppercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

            &lt;span class=&quot;c1&quot;&gt;# (1)
&lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uppercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt;

			&lt;span class=&quot;c1&quot;&gt;# (2)
&lt;/span&gt;            &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uppercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lowercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lowercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lowercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lowercase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Cipher text: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;encrypt&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;a_string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Enter a name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Enter a key (must be integer) &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cipher&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;how-it-works&quot;&gt;How it works&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;(1) if the letter is uppercase we get index of it and add key to it.&lt;/li&gt;
  &lt;li&gt;(1.1) and then we use modulus operator(which return either 0 or remainder) with 26 as divisor&lt;/li&gt;
  &lt;li&gt;(1.2) we treat new as new index of letter&lt;/li&gt;
  &lt;li&gt;(2) then we append to encrypt variable with the new index of letter.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;cant-understand-what-i-wrote-here&quot;&gt;Can’t understand what i wrote here?&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Go ahead and look it on internet&lt;/li&gt;
  &lt;li&gt;here some links to resources&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Caesar_cipher&quot;&gt;Caesar Cipher&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Modulo_operation&quot;&gt;Modolus Operator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>Last digit !!!??</title>
   <link href="https://t4p4n.github.io/2022/05/27/last-digits"/>
   <updated>2022-05-27T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/27/last-digits</id>
   <content type="html">&lt;h2 id=&quot;get-last-digit-from-a-string&quot;&gt;Get last digit from a string&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Example string: “Get 10% off on minimum cart value of $199”&lt;/li&gt;
  &lt;li&gt;Try to get only the last digit i.e. 9&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Get 10% off on minimum cart value of $199&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;last_digit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;# (1)
&lt;/span&gt;	&lt;span class=&quot;n&quot;&gt;digits&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isdigit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()]&lt;/span&gt;

	&lt;span class=&quot;c1&quot;&gt;# (2)
&lt;/span&gt;	&lt;span class=&quot;n&quot;&gt;ld&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;digits&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

	&lt;span class=&quot;c1&quot;&gt;# (3)
&lt;/span&gt;	&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;last_digit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;how-it-works&quot;&gt;How it works&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;(1) use list comprehension to get all the digits from string&lt;/li&gt;
  &lt;li&gt;(2) get last element from list using string slicing with negative index.&lt;/li&gt;
  &lt;li&gt;(3) finally print the last digit&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h5&gt;
</content>
 </entry>
 
 <entry>
   <title>Anagrams !?</title>
   <link href="https://t4p4n.github.io/2022/05/26/anagram-detection"/>
   <updated>2022-05-26T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/26/anagram-detection</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/3/33/Anagram_Listen_%3D_Silent.gif&quot; alt=&quot;Listen&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-it-&quot;&gt;What is it !?&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Its just a fancy term for saying:&lt;/li&gt;
  &lt;li&gt;letters from strings matches to letters of other string&lt;/li&gt;
  &lt;li&gt;Some examples:&lt;/li&gt;
  &lt;li&gt;seat eats&lt;/li&gt;
  &lt;li&gt;heart earth&lt;/li&gt;
  &lt;li&gt;shit hits&lt;/li&gt;
  &lt;li&gt;skin sink&lt;/li&gt;
  &lt;li&gt;altitude latitude&lt;/li&gt;
  &lt;li&gt;Python code for this type of program&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;is_anagram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lower&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lower&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sorted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sorted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Yes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Nope&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;s1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;s2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;external-links&quot;&gt;External Links:&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Ambigram&quot;&gt;Ambigrams&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h3&gt;

</content>
 </entry>
 
 <entry>
   <title>Palindrome !?</title>
   <link href="https://t4p4n.github.io/2022/05/25/palindrome-python"/>
   <updated>2022-05-25T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2022/05/25/palindrome-python</id>
   <content type="html">&lt;h2 id=&quot;rotavator&quot;&gt;Rotavator&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;https://img2.exportersindia.com/product_images/bc-full/dir_10/289726/rotavator-1512462441-3497789.jpeg&quot; alt=&quot;Rotavator&quot; title=&quot;a rotavator&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;palindrome-what-is-it-&quot;&gt;Palindrome? What is it !?&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Its just a fancy term for saying something like this:&lt;/li&gt;
  &lt;li&gt;string/integer matches to their reverse.&lt;/li&gt;
  &lt;li&gt;Example: POP equals to POP(reverse of pop)&lt;/li&gt;
  &lt;li&gt;Another example: madam equals to madam(reverse of madam)&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Yet another example: Rotavator equals to rotvatoR(reverse of rotavator)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;non-examples aka false statements:&lt;/li&gt;
  &lt;li&gt;“Hello world” equals to “dlrow olleH”&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;“definetly not” equals to “ton yltenifed”&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Python code for this type of program&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Enter something: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;is_palindrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;reverse&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Yes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Nope&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;is_palindrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;suggested improvements:&lt;/li&gt;
  &lt;li&gt;we can use manual function for string reversal&lt;/li&gt;
  &lt;li&gt;instead of using python slicling magic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;hope-you-learned-something-today-atleast-i-did-for-sure&quot;&gt;Hope you learned something today atleast i did for sure.&lt;/h3&gt;
&lt;h3 id=&quot;thanks-for-reading-&quot;&gt;Thanks for reading :)&lt;/h3&gt;

</content>
 </entry>
 
 <entry>
   <title>Education Rant</title>
   <link href="https://t4p4n.github.io/2021/12/24/education-rant"/>
   <updated>2021-12-24T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2021/12/24/education-rant</id>
   <content type="html">&lt;h2 id=&quot;problems-or-what--why&quot;&gt;Problems or (What &amp;amp; Why?)??&lt;/h2&gt;
&lt;h3 id=&quot;why-people-are-chasing-success-what-do-they-mean-by-success-is-financial-success-is-everything&quot;&gt;Why people are chasing success? What do they mean by success? is financial success is everything?&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;As of now in 2021&apos;s India Most people think success is getting a govt. job &amp;amp; that&apos;s it!
But I dont think so? is govt job is keep up to everything want in life? No, its just a secure job
while nothing is permanent in this world, they think are settled, but in real life, nobody gets settled
after getting, we gotta repeat same things almost daily, and repetition is equal to boredom.&lt;/li&gt;
  &lt;li&gt;From my perespective i think life is about balacing all aspects of human a beings&apos; life,
I mean keeping everything balanced from work life to social life, childhood to parenthood, physical health to mental health 
everything needs to balanced, While our education system only teachs about how to get a job, not how to live a life.&lt;/li&gt;
  &lt;li&gt;Anyways here are some problems that i faced/found in our current indian education system while i was studying commerce from school &amp;amp;  college.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;irrelevant-subjects&quot;&gt;Irrelevant subjects&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Like Business &amp;amp; Industerial Laws, Hindi Language. This subject must be relevant to Law/Hindi specialization students only.&lt;/li&gt;
  &lt;li&gt;However these subjects can be recommended &amp;amp; but not mandatory to study (Optionally any one can look it up on internet, if they want to).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;out-of-date-syllabuscircicullum&quot;&gt;Out of date syllabus/circicullum&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;In modern day society accounting is mostly done through computers. But they dont teach us about computers&lt;/li&gt;
  &lt;li&gt;They dont teach us about Book Keeping softwares like Busy, Tally etc.&lt;/li&gt;
  &lt;li&gt;&amp;amp; Even Nowadays from manufacturing to selling products or services whether they are tangible or intangible.&lt;/li&gt;
  &lt;li&gt;Are Now being done with the help of computers, E.g. Product design using solidworks, IoT devices to Aid in manufacturing, Online selling through ecommerce platforms like Amazon, Digital Marketing with Google Adsense &amp;amp; FacebookAds.&lt;/li&gt;
  &lt;li&gt;In simple words “Internet &amp;amp; Computers” are missing or I would rahther say ignored by our so called “Indian Education System”.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;grade-system-to-test-student-ablilities-yikes&quot;&gt;Grade system, to test student ablilities (Yikes),&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Cause we never know how much a student knows about something without testing him/her in a real world scenario.&lt;/li&gt;
  &lt;li&gt;Discussions/Debate/Interviews/Internships are good way to test a students&apos; abilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;real-world-financial-education&quot;&gt;Real world financial education&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;They teach us about how to manage company funds, not how to manage our own funds.&lt;/li&gt;
  &lt;li&gt;In simple words: how to maxmimize our income &amp;amp; gains(investing), &amp;amp; not how to minimize your expenses(savings)&lt;/li&gt;
  &lt;li&gt;Every student nowadays own a smartphone worth of atleast 20k &amp;amp; they dont even use to its full potential&lt;/li&gt;
  &lt;li&gt;i.e. we can do content creation, digital marketing, programming, learn trading &amp;amp; many other things all this for free. ,&lt;/li&gt;
  &lt;li&gt;but they do they do instead ? Gaming typically battle royale like PUBG or Free Fire.&lt;/li&gt;
  &lt;li&gt;Or Social Media a new drug in the market, We can see “busy students” outside every education institutes, Scrolling through their facebook, twitter, instagram etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;result&quot;&gt;Result&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Traditional teaching apporoach(Theortical) + Out of date syllabus + Irrelevant subjects = A piece of paper that is of no use &amp;amp; a human with no particular skill in hand.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;solutionshow&quot;&gt;Solutions(How???)&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;More real world subjects like digital marketing.&lt;/li&gt;
  &lt;li&gt;Book keeping using erp softwares like Busy.&lt;/li&gt;
  &lt;li&gt;Enterprise Resource Mangement using Odoo Erp or Dolibarr.&lt;/li&gt;
  &lt;li&gt;Official work using presentations, spreadsheets etc.&lt;/li&gt;
  &lt;li&gt;New Passion related subjects like&lt;/li&gt;
  &lt;li&gt;Music Production using Digital Audio Workstation, Also Writing Lyrics.&lt;/li&gt;
  &lt;li&gt;Video Production using DSLR Cameras &amp;amp; Processing it using Adobe premeier. Also writing screenplay or jokes for standup comedians&lt;/li&gt;
  &lt;li&gt;Renewable energy using solar panels &amp;amp; wind mills etc.&lt;/li&gt;
  &lt;li&gt;Game development using Unity.&lt;/li&gt;
  &lt;li&gt;Android app development using kotlin &amp;amp; android sdk.&lt;/li&gt;
  &lt;li&gt;Architectural planning using AutoCAD &amp;amp; Autodesk Revit.&lt;/li&gt;
  &lt;li&gt;Web security using OWASP study material &amp;amp; Burpsuite.&lt;/li&gt;
  &lt;li&gt;(…Insert any topic with their real world applications)&lt;/li&gt;
  &lt;li&gt;Freedom for students to choose what they want to be in their life, regardless of their gender, grades, or whatever.&lt;/li&gt;
  &lt;li&gt;btw i didnt included any medical &amp;amp; engineering topics as they are already too common in india.&lt;/li&gt;
  &lt;li&gt;Learn by doing is always the best apporoach to learn something!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;conclusionwhen&quot;&gt;Conclusion(When???)&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;I think we should all focus on heading towards the solutions&lt;/li&gt;
  &lt;li&gt;But sadly we’re mostly still stuck in time,&lt;/li&gt;
  &lt;li&gt;All I see is youngsters here in my area are just preparing for laid back 9 to 1 govt jobs (&amp;amp; yes most govt. clerks work from 9am to 1pm, or govt. teachers 8am to 2pm max)&lt;/li&gt;
  &lt;li&gt;This is happening often due to herd mentality (i.e. sheep follow sheep)&lt;/li&gt;
  &lt;li&gt;Anyways My belief is Everything is Learned a Skill.&lt;/li&gt;
  &lt;li&gt;Nobody is born with talent/Skill&lt;/li&gt;
  &lt;li&gt;but exceptions are always there ;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;thank-you-very-much-for-reading-till-the-end-hope-you-have-a-great-day-&quot;&gt;Thank you very much for reading till the end, Hope you have a great day. :)&lt;/h2&gt;

</content>
 </entry>
 
 <entry>
   <title>Hello World</title>
   <link href="https://t4p4n.github.io/2021/12/23/hello-world"/>
   <updated>2021-12-23T00:00:00+05:30</updated>
   <id>https://t4p4n.github.io/2021/12/23/hello-world</id>
   <content type="html">&lt;h1 id=&quot;title&quot;&gt;Title&lt;/h1&gt;

&lt;h2 id=&quot;main-head&quot;&gt;Main Head&lt;/h2&gt;
&lt;p&gt;Hello World this is working i guess!&lt;/p&gt;

&lt;h2 id=&quot;sub-head&quot;&gt;Sub Head&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;List Item
    &lt;ul&gt;
      &lt;li&gt;nested item
        &lt;ul&gt;
          &lt;li&gt;more nests&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Code Snippet&lt;/code&gt;&lt;/p&gt;

</content>
 </entry>
 

</feed>
