{"generator":"Jekyll","link":[{"@attributes":{"href":"https:\/\/rsarky.github.io\/feed.xml","rel":"self","type":"application\/atom+xml"}},{"@attributes":{"href":"https:\/\/rsarky.github.io\/","rel":"alternate","type":"text\/html"}}],"updated":"2021-08-01T18:51:32+00:00","id":"https:\/\/rsarky.github.io\/feed.xml","title":"Sarkar Raj","subtitle":{},"author":{"name":"Rohit Sarkar"},"entry":[{"title":"Bayes in the wild","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/2021\/08\/01\/bayes-in-the-wild.html","rel":"alternate","type":"text\/html","title":"Bayes in the wild"}},"published":"2021-08-01T18:46:00+00:00","updated":"2021-08-01T18:46:00+00:00","id":"https:\/\/rsarky.github.io\/2021\/08\/01\/bayes-in-the-wild","content":"<p>Today one of my friends forwarded me this message on Whatsapp:<\/p>\n\n<blockquote>\n  <p>Israel now provides vaccination status among new coronavirus cases and those\n  who are seriously ill.<\/p>\n\n  <p>New cases (Sat): -<\/p>\n\n  <p>Unvaccinated: 1,006  Partially vaccinated: 39  Fully vaccinated: 1,049<\/p>\n\n  <p>Seriously ill:<\/p>\n\n  <p>Unvaccinated: 71 \n  Partially vaccinated: 7 \n  Fully vaccinated: 133)<\/p>\n<\/blockquote>\n\n<p>Note that I am not sure if the data is reliable here. Let us assume that the\ngiven data is accurate. On first glance this can be interpreted to mean that\nvaccines are inefficient, since the number of vaccinated people among the\nnumber of new cases is more than the number of unvaccinated people. And\nsimilarly for the number of seriously ill cases. This is dangerous since\nvaccine skeptics base their arguments on statistics like these.<\/p>\n\n<p>However, this interpretation is flawed since we disregard one important\nstatistic: the proportion of vaccinated individuals in the population (aka the\n<em>base rate<\/em>). If a large proportion of the population has been vaccinated it\nwould imply that the proportion of vaccinated individuals among new cases will\nalso be large.  Ignoring the actual proportion of vaccinated individuals is a\ntypical example of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Base_rate_fallacy\">base rate\nfallacy<\/a>.  This is actually\njust Bayes theorem in disguise.<\/p>\n\n<p>To drive this point home we can play around with some numbers. Consider for\ninstance that 85% of Israel\u2019s population is vaccinated and vaccines are 70%\neffective. Further the probability of a test being positive given that someone\nis not vaccinated is say 50%. To simplify things we only consider single dose\nvaccinations.\nNow we want to find P(vaccinated | cov+) or the probability that someone is\nvaccinated given that the person has been tested covid positive.\nApplying Bayes theorem this can be reframed as:<\/p>\n\n\\[P(Vaxed|+)=\\frac{P(+|Vaxed)P(Vaxed)}{P(+|Vaxed)P(Vaxed)+P(+|Unvaxed)P(Unvaxed)}\\]\n\n\\[=\\frac{0.3 \\times 0.85}{0.3 \\times 0.85 + 0.5 \\times 0.15}\\]\n\n\\[=0.77\\]\n\n<p>Thus this shows that given these imaginary but plausible numbers one could\nexpect 77% of covid positive people to have been vaccinated.\nAs more and more people are getting vaccinated we can expect an uptick in the\nnumber of vaccinated peoples getting infected, not because vaccines are\ninefficient but just because so many people are getting vaccinated.<\/p>","author":{"name":"Rohit Sarkar"},"summary":"Today one of my friends forwarded me this message on Whatsapp:"},{"title":"Does height play a role in climbing performance?","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/2021\/06\/16\/climbing-analysis.html","rel":"alternate","type":"text\/html","title":"Does height play a role in climbing performance?"}},"published":"2021-06-16T00:00:00+00:00","updated":"2021-06-16T00:00:00+00:00","id":"https:\/\/rsarky.github.io\/2021\/06\/16\/climbing-analysis","content":"<p>In this post we will try to see guage the role played by height and weight play in climber\nperformance. Climber performance, for our purposes, will be represented by the\nmaximum grade that a climber has climbed. The data for this analysis is sourced\nfrom a <a href=\"https:\/\/www.kaggle.com\/dcohen21\/8anu-climbing-logbook\">kaggle repository<\/a> that scraped data from <a href=\"https:\/\/www.8a.nu\/\">8a.nu<\/a>. After some\ndata cleaning we have around 14500 datapoints. We dont consider routes and\nboulders separately here. Let\u2019s look at how features in\nour data are distributed:<\/p>\n\n<h1 id=\"data-distribution\">Data Distribution<\/h1>\n<p><img src=\"\/assets\/img\/feature-dist.png\" alt=\"feature-dist\" \/><\/p>\n\n<p><code class=\"language-plaintext highlighter-rouge\">age_at_start<\/code> describes at what age did the user start climbing. <code class=\"language-plaintext highlighter-rouge\">xp<\/code> defines\nthe age at which he or she achieved the max grade defined in <code class=\"language-plaintext highlighter-rouge\">max_grade<\/code>.<\/p>\n\n<h1 id=\"correlations\">Correlations<\/h1>\n<p><img src=\"\/assets\/img\/climber-correlation.png\" alt=\"correlation\" \/><\/p>\n\n<p>It is interesting to note that while height and maximum grade dont seem to be\ncorrelated there is a statistically significant negative correlation (p \u00ab\u00a00.5) \nbetween bmi and\nperformance of a climber. This makes sense as its not the height alone that has\nan effect on climber performance but a combination of weight and height.\nAs expected, climber experience is positively correlated with the maximum grade achieved.<\/p>\n\n<p>The following visualisation depicts the gradual shift to lower bmis with higher\ngrades<\/p>\n\n<p><img src=\"\/assets\/img\/bmi-grade.png\" alt=\"bmi-grage\" \/><\/p>\n\n<p><br \/>\nThe following graph shows that though the years of experience contribute to a\nhigher maximum grade, the downward trend of bmi with performance persists\nacross all experience ranges.\n<img src=\"\/assets\/img\/grade-bmi-xp.png\" alt=\"grade-bmi\" \/><\/p>\n\n<p><br \/><br \/><br \/>\nIn conclusion we verify from the data that its not just height, but height\nalong with weight (bmi) that plays a role in determining a climber\u2019s performance.<\/p>","author":{"name":"Rohit Sarkar"},"summary":"In this post we will try to see guage the role played by height and weight play in climber performance. Climber performance, for our purposes, will be represented by the maximum grade that a climber has climbed. The data for this analysis is sourced from a kaggle repository that scraped data from 8a.nu. After some data cleaning we have around 14500 datapoints. We dont consider routes and boulders separately here. Let\u2019s look at how features in our data are distributed:"},{"title":"PaStA and Patchwork","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/2020\/08\/10\/pasta-patchwork.html","rel":"alternate","type":"text\/html","title":"PaStA and Patchwork"}},"published":"2020-08-10T14:27:00+00:00","updated":"2020-08-10T14:27:00+00:00","id":"https:\/\/rsarky.github.io\/2020\/08\/10\/pasta-patchwork","content":"<p>The following is a brief report of my project carried out as a part of the\nGoogle Summer of Code programme.<\/p>\n\n<p>The primary goal of the project was to leverage <a href=\"\/2020\/06\/09\/pasta.html\">PaStA\u2019s<\/a> analyses\ncapabilities in <a href=\"https:\/\/github.com\/getpatchwork\/patchwork\">Patchwork<\/a>. Concretely, Patchwork has the ability to relate\npatches to each other. Through this project I use PaStA to form these relations\nin Patchwork.  I have developed the tooling and infrastructure both in PaStA\nand Patchwork necessary for the two applications to interface with each other.<\/p>\n\n<p>The integration between PaStA and Patchwork can broadly be divided into a three\nstep process:<\/p>\n\n<ol>\n  <li>Share Patchwork\u2019s data in the form of patches with PaStA.<\/li>\n  <li>Carry out analyses in PaStA to form relations in a format suitable for\ningestion by Patchwork.<\/li>\n  <li>Ability to import the relations generated by PaStA into Patchwork.<\/li>\n<\/ol>\n\n<p>I will briefly go through each of these steps and their implementation as a\npart of this project. Skip to the section on \u201cEnd to end setup\u201d if you are only\ninterested in how to make it work.<\/p>\n\n<h2 id=\"1-getting-patches-into-pasta\">1. Getting patches into PaStA<\/h2>\n\n<p>For PaStA to carry out analyses on the patches stored in Patchwork we need to\nget the patches into PaStA first. Some approaches to this problem that were\nconsidered are:<\/p>\n\n<ol>\n  <li>Using a <a href=\"https:\/\/public-inbox.org\/README.html\">public inbox<\/a> tracked by both PaStA and Patchwork.<\/li>\n  <li>Dumping patches from Patchwork in the form of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mbox\">raw mboxes<\/a><\/li>\n  <li>Using Patchwork\u2019s API to fetch patches.<\/li>\n<\/ol>\n\n<p>Option 1 although attractive, was not chosen as Patchwork does not have native\nsupport to work with public inboxes. Another important drawback of this option\nis that Patchwork identifies patches through a unique identifier. This unique\nidentifier is associated to a patch once it enters Patchwork. Since we want to\ncommunicate the results of analyses back to Patchwork, it is essential that we\nmaintain these <em>patchwork ids<\/em> in PaStA too. Using the other options enables\nus to do this.<\/p>\n\n<p>Both option 2 and 3 were implemented to tackle different usecases.<\/p>\n\n<h3 id=\"usecase-1-initial-import-of-patches-into-pasta\">Usecase 1: Initial import of patches into PaStA<\/h3>\n<p>When integrating PaStA with an existing mailing list, it would be required to\nget a lot of historical patch data into PaStA. Such an import will not be\nfeasible through Patchwork\u2019s API. Hence we give the capability of an <em>initial\nimport<\/em>. Here the raw mbox of patches from Patchwork is specified to PaStA and\nit imports the patches using the raw mbox.<\/p>\n\n<h3 id=\"usecase-2-differential-imports\">Usecase 2: Differential imports<\/h3>\n<p>Once the initial import has been carried out, new patches arriving in Patchwork\nwill be pulled by PaStA at periodic intervals. Note that we only want to pull\nthe newly arriving patches and not the entire set of patches. Since the number\nof patches arriving every time period (in the order of hours or days) is\nmanageable, we can import these patches through Patchwork\u2019s API. We track the\nset of patches already in PaStA and import all the patches in Patchwork that\nare not in PaStA.<\/p>\n\n<p>The setup between PaStA and Patchwork has been documented\n<a href=\"https:\/\/github.com\/lfd\/PaStA#setting-up-pasta-and-patchwork\">here<\/a><\/p>\n\n<h3 id=\"code-implementing-this-functionality\">Code implementing this functionality<\/h3>\n<ul>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/dcbaabf98569b41e1bd0e5691bfa62affe02580f\">Handle Patchwork archives specially and track patchwork ids in\nindex<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/a48fb617cc3ecfe6d4f3366d70b6130943791f86\">Refactoring<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/696bf84c68b68c35e787b231f88685f512ee8ac8\">Read configuration options for\nPatchwork<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/f12487dd2a04b286ff3b7b9e1e3c5db600ae728c\">Pull patches from patchwork<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/1720294611cbd7039cc205136776ddf70e443be2\">Documentation<\/a><\/li>\n<\/ul>\n\n<h2 id=\"2-analyses-in-pasta-and-forming-relations\">2. Analyses in PaStA and forming relations<\/h2>\n<p>The infrastructure to analyse patches was already in place in PaStA. However\nPaStA generates patches in the from of a patch groups file which contains lines\nof space separated message ids denoting related patches. (It also contains\nreferences to upstream commits which we will ignore for now). In order to push\nthese relations into Patchwork we need to use the <em>patchwork id<\/em> described\nabove that is used by Patchwork to uniquely identify a patch. For this purpose\nthe <code class=\"language-plaintext highlighter-rouge\">form_patchwork_relations<\/code> executable was added. This executable takes as\ninput the patch groups file generated by PaStA and translates the message ids\nwithin it to Patchwork ids.<\/p>\n\n<h3 id=\"code-implementing-this-functionality-1\">Code implementing this functionality<\/h3>\n<ul>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/0b976b4113c1c034edbe9dbec92fea7867518967\">Get patchwork id from message\nid<\/a><\/li>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/0b976b4113c1c034edbe9dbec92fea7867518967\"><code class=\"language-plaintext highlighter-rouge\">form_patchwork_relations<\/code>\nexecutable<\/a><\/li>\n<\/ul>\n\n<h2 id=\"3-getting-patch-relations-into-patchwork\">3. Getting patch relations into Patchwork<\/h2>\n<p>For the final step we need to <em>push<\/em> the results of PaStA\u2019s analyses i.e the\nnewly formed patch relations to Patchwork. This was achieved by introducing a\nnew Django management command: <code class=\"language-plaintext highlighter-rouge\">parserelations<\/code>. This command takes as input\nthe patch groups file (with Patchwork ids) generated in the previous steps and\nreplaces the existing relations in Patchwork (if any) with the ones defined in\nthe patch groups file.<\/p>\n\n<h3 id=\"code-implementing-this-functionality-2\">Code implementing this functionality<\/h3>\n<ul>\n  <li><a href=\"https:\/\/github.com\/getpatchwork\/patchwork\/commit\/fe0c0ca7279e35904c488dea57345e1d4f13f895\">add replacerelations\ncommand<\/a><\/li>\n<\/ul>\n\n<h2 id=\"an-end-to-end-setup\">An end to end setup<\/h2>\n\n<p>With the tooling and infrastructure introduced, it is possible to have an end\nto end setup of PaStA and Patchwork, where PaStA can generate relations for\nPatchwork.<\/p>\n\n<div class=\"center-image\">\n  <p><img src=\"\/assets\/img\/pasta-patchwork-flow.png\" alt=\"flow\" \/><\/p>\n<\/div>\n\n<p>After the initial import of patches from Patchwork to PaStA, the above flow can\nbe run as a script periodically, for instance as a cron job.<\/p>\n\n<p>The commands executed by the script at each stage can be outlined as follows:<\/p>\n<ul>\n  <li>\n    <p>Export patches from Patchwork and import into PaStA:<\/p>\n\n    <p>In Patchwork:<\/p>\n    <div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ .\/manage.py dumparchive &lt;list-id&gt;\n<\/code><\/pre><\/div>    <\/div>\n    <p>In PaStA (after appropriately setting up the configuration files):<\/p>\n    <div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ .\/pasta sync -mbox\n<\/code><\/pre><\/div>    <\/div>\n  <\/li>\n  <li>Analyses in PaStA\n    <div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ .\/pasta analayse rep\n$ .\/pasta rate\n$ .\/pasta form_patchwork_relations\n<\/code><\/pre><\/div>    <\/div>\n  <\/li>\n  <li>Importing relations in Patchwork\n    <div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>$ .\/manage.py replacerelations &lt;path-to-patch-groups-file-from-previous-step&gt;\n<\/code><\/pre><\/div>    <\/div>\n  <\/li>\n<\/ul>\n\n<div class=\"center-image\">\n  <p><img src=\"\/assets\/img\/patchwork.png\" alt=\"pasta-patchwork\" \/><\/p>\n<\/div>\n\n<h3 id=\"code-implementing-this-functionality-3\">Code implementing this functionality<\/h3>\n<ul>\n  <li><a href=\"https:\/\/github.com\/lfd\/PaStA\/commit\/5d0ea62609dcf2a0d89000655ae49ec2a49b330b\">script demonstrating end to end\nflow<\/a><\/li>\n<\/ul>\n\n<h2 id=\"future-work\">Future Work<\/h2>\n<ul>\n  <li>Along with forming relations between patches PaStA can also associate a\nrelation with the upstream commits in the repo for that relation. We can\nleverage these commit references too in Patchwork.<\/li>\n  <li>The <code class=\"language-plaintext highlighter-rouge\">replacerelations<\/code> command <strong>replaces<\/strong> all the existing relations. This\nis not ideal, and it would be nice to somehow reconcile the existing\nrelations in Patchwork with the new relations from PaStA. Further the\nrelations API in Patchwork could be used to add new relations.<\/li>\n  <li>PaStA\u2019s analyses phase can be optimised by doing a differential analyses. A\npatch for this has been introduced for discussion and can be seen\n<a href=\"https:\/\/github.com\/rsarky\/PaStA\/commit\/55da867c90b7edf6e46bf1d1ab6e13721bec8cd7\">here<\/a>.<\/li>\n<\/ul>\n\n<h2 id=\"acknowledgements\">Acknowledgements<\/h2>\n<p>I want to thank all my mentors, especially Lukas, Ralf and Daniel. Lukas and\nRalf for being available inspite of their busy schedules. Their input was\ninvaluable throughout the project. Daniel was very patient while reviewing my\npatches sent to the Patchwork mailing list.<\/p>\n\n<p>Note: Some rough notes about PaStA and Patchwork can also be found in my\n<a href=\"https:\/\/rsarky.github.io\/braindump\/index.html\">braindump<\/a><\/p>","author":{"name":"Rohit Sarkar"},"summary":"The following is a brief report of my project carried out as a part of the Google Summer of Code programme."},{"title":"Email development and PaStA","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/2020\/06\/09\/pasta.html","rel":"alternate","type":"text\/html","title":"Email development and PaStA"}},"published":"2020-06-09T03:27:00+00:00","updated":"2020-06-09T03:27:00+00:00","id":"https:\/\/rsarky.github.io\/2020\/06\/09\/pasta","content":"<p>A significant number of projects continue to use email for development. Email has withstood the test of time in the face of feature rich web based applications like Github. The Linux kernel is amongst one of the most prominent projects that continues to use an email based development workflow. Why do Linux and other projects still swear by email is not the point of this post but here is Greg-Kroah Hartman\u2019s, one of the most prominent kernel developers, <a href=\"https:\/\/lwn.net\/Articles\/702177\/\">view on the issue<\/a>.<\/p>\n\n<p>The typical development flow on a mailing list looks like the following.\nA developer submits a patch to the project\u2019s mailing list. This patch goes through a series of reviews by maintainers as well as peers and the developer submits successive revisions of the patch that addresses the review comments.\nFinally, once the maintainers are happy with the current revision of the patch they apply the patch to the repository.<\/p>\n\n<p>There is no straightforward way to keep track of the entire workflow. In the case of projects like Linux which are used in various safety critical applications it is essential that the development process does not allow for subpar code to get accepted into upstream repositories.<\/p>\n\n<p><a href=\"https:\/\/github.com\/lfd\/PaStA\">PaStA<\/a> which stands for Patch Stack Analyses is a tool that helps in analysing patches. PaStA has 2 major capabilities:<\/p>\n<ul>\n  <li>Given a set of patches, PaStA can form groups (equivalence classes) of similar patches.<\/li>\n  <li>PaStA can map these groups of patches to their corresponding commits in the upstream repository if they exist.\nWhat makes PaStA even more impressive is that it can handle entire mailing lists using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mbox\">mail boxes<\/a> or <a href=\"https:\/\/public-inbox.org\/README.html\">public inboxes<\/a>. It can automatically parse these formats to extract patches and ignore irrelevant emails.\nPaStA has a number of potential applications and some are listed on it\u2019s <a href=\"https:\/\/github.com\/lfd\/PaStA\/issues\">issue tracker<\/a>.<\/li>\n<\/ul>","author":{"name":"Rohit Sarkar"},"summary":"A significant number of projects continue to use email for development. Email has withstood the test of time in the face of feature rich web based applications like Github. The Linux kernel is amongst one of the most prominent projects that continues to use an email based development workflow. Why do Linux and other projects still swear by email is not the point of this post but here is Greg-Kroah Hartman\u2019s, one of the most prominent kernel developers, view on the issue."},{"title":"Ideation","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/misc\/2020\/04\/16\/ideation.html","rel":"alternate","type":"text\/html","title":"Ideation"}},"published":"2020-04-16T05:30:30+00:00","updated":"2020-04-16T05:30:30+00:00","id":"https:\/\/rsarky.github.io\/misc\/2020\/04\/16\/ideation","content":"<p>A number of times I want to build a side project but I find it difficult getting started.      <br \/>\nOr I start hacking on a new idea, lose interest mid way, and the project gets shelved.\nI have tried to build a framework that helps me through the ideation process.\nA core tenet of this framework is thinking of programming like any other creative pursuit.\nThese problems are certainly not unique to developers, they are faced by creators in general. Drawing \nparallels between the issues that a developer might face during the ideation process to how an artist \nmight think about the same issues helps to look at things from a different perspective.\nA well written software project is no different from a fine piece of art.<\/p>\n\n<p>Here is some commonly given advice about looking for side project ideas:<\/p>\n<ul>\n  <li>Build something that you are passionate about\/interested in.<\/li>\n  <li>Build something that scratches your own itch.<\/li>\n<\/ul>\n\n<p>Although there is nothing objectively wrong in these statements it is difficult to actually apply them.\nIt is not easy to judge your passion or interest for something without trying it out. It\u2019s not always the case \nthat you have an <em>itch to scratch<\/em>. If you already have an <em>itch to scratch<\/em> your ideation problem is solved to a certain extent.<\/p>\n\n<p>I have listed down some broad guidelines that might help when thinking about what to make for the next side project:<\/p>\n<ol>\n  <li>Keep a note of any project ideas that occur during day to day life. <a href=\"www.github.com\">Github<\/a>, <a href=\"www.reddit.com\">Reddit<\/a>, <a href=\"news.ycombinator.com\">Hackernews<\/a> etc. can be a good source of inspiration for this. You can either choose a project idea and then choose the appropriate tools; languages, technologies  etc. for solving the problem. It\u2019s also possible to go in the opposite direction. Say that you are really interested in functional programming and want to learn Haskell. You can try to think about projects that Haskell is suited to, a compiler for example.<\/li>\n  <li>Choose an idea from the ones in this list to work on. The choice will depend on various factors like the amount of time you are willing to spend on the side project,\nthe complexity of the idea etc. Spending too much time while finalising a project idea to work on is counter productive. Set a hard time limit on yourself\nof around half an hour to an hour in which you need to choose an idea.\nA problem that I faced during this process was the fact that someone had already built the thing that I was thinking of building. This is where thinking of programming as an art form made me realise that this is completely fine. Art often doesn\u2019t have a unique precedent.\nThere must be tons of <a href=\"https:\/\/www.google.com\/search?q=sketchs+of+deadpool&amp;tbm=isch&amp;ved=2ahUKEwirpemMlezoAhXixHMBHfktA7IQ2-cCegQIABAA&amp;oq=sketchs+of+deadpool&amp;gs_lcp=CgNpbWcQAzoECCMQJzoECAAQQzoCCAA6BQgAEIMBOgYIABAKEBhQ9AtY5YcBYI6KAWgAcAB4AIABmwGIAdoNkgEEMTUuNJgBAKABAaoBC2d3cy13aXotaW1n&amp;sclient=img&amp;ei=i-aXXuuzL-KJz7sP-duMkAs&amp;bih=659&amp;biw=1358\">amazing sketches of deadpool<\/a>, but that doesn\u2019t make any one less brilliant than the other.\nIt\u2019s also important to have in mind the reason that you took up the side project, for instance even if you decide to make another <em>todo<\/em> web app, as long as you are\nlearning from the experience and are motivated by the end result, it\u2019s worth it.<\/li>\n  <li>Once you have finalised on an idea, it\u2019s important to chalk out a high level plan of how you want to tackle the problem instead of jumping right into the code.\nThis will allow you to have a big picture in mind as you work. Having a big picture in mind helps in not getting bogged down by irrelevant details at the start of a project. For instance, when building a <em>todo<\/em> app, spending a couple of hours deciding what color you want your background to be is not productive. This leads to a feeling of lack of progress and you are prone to give up on the project.\nDivide your problem into smaller independent tasks. Completing these small tasks will keep you motivated\nby setting up a positive feedback loop.\n<br \/><br \/><br \/>\n    <h4 id=\"some-resources\">Some resources<\/h4>\n    <ul>\n      <li><a href=\"https:\/\/www.youtube.com\/watch?v=7Hlb8YX2-W8&amp;list=PLzFUMGbVxlQs5s-LNAyKgcq5SL28ZLLKC\">George Hotz\u2019s programming streams<\/a> are a great source of inspiration.<\/li>\n      <li><a href=\"https:\/\/www.reddit.com\/r\/coolgithubprojects\/\">r\/coolgithubprojects<\/a>, <a href=\"https:\/\/www.reddit.com\/r\/dailyprogrammer\/\">r\/dailyprogrammer<\/a>, <a href=\"https:\/\/www.reddit.com\/r\/ProgrammingPrompts\/\">r\/ProgrammingPrompts<\/a><\/li>\n    <\/ul>\n  <\/li>\n<\/ol>","author":{"name":"Rohit Sarkar"},"category":{"@attributes":{"term":"misc"}},"summary":"A number of times I want to build a side project but I find it difficult getting started. Or I start hacking on a new idea, lose interest mid way, and the project gets shelved. I have tried to build a framework that helps me through the ideation process. A core tenet of this framework is thinking of programming like any other creative pursuit. These problems are certainly not unique to developers, they are faced by creators in general. Drawing parallels between the issues that a developer might face during the ideation process to how an artist might think about the same issues helps to look at things from a different perspective. A well written software project is no different from a fine piece of art."},{"title":"Linux kernel modules","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/linux\/eudyptula\/2019\/08\/13\/eudyptula.html","rel":"alternate","type":"text\/html","title":"Linux kernel modules"}},"published":"2019-08-13T12:03:39+00:00","updated":"2019-08-13T12:03:39+00:00","id":"https:\/\/rsarky.github.io\/linux\/eudyptula\/2019\/08\/13\/eudyptula","content":"<p>Linux kernel development has always fascinated me.\nI have been wanting to learn about how things work under the hood for some time now.\nTo this end I took up the <a href=\"http:\/\/eudyptula-challenge.org\">Eudyptula Challenge<\/a>.\nThis is the first among a series of posts to keep track of my progress and log\nthe things I learn along the way<\/p>\n\n<p>Without further ado; Let\u2019s get to the point of this blog. <code class=\"language-plaintext highlighter-rouge\">Kernel Modules<\/code><\/p>\n\n<p>The first challenge involves writing a simple <em>Hello World<\/em> module that will\nprint a string to the message buffer.<\/p>\n\n<h2 id=\"what-are-kernel-modules\">What are Kernel Modules?<\/h2>\n<p>A kernel module is a piece of code that can be loaded or unloaded into the kernel \non demand (at runtime). They extend the functionality of the kernel without the need to reboot\nthe system.<br \/>\nA common type of module is the device driver. A device driver abstracts a piece of hardware and provides\na uniform API for working with the device. The kernel must have a device driver for every peripheral\nattached to the system from a keyboard to the usb stick that you can plug into it.<\/p>\n\n<p>A simple kernel module:<\/p>\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>#include&lt;linux\/module.h&gt;\n#include&lt;linux\/init.h&gt;\nMODULE_LICENSE(\"Dual BSD\/GPL\");\n\nstatic int hello_init(void)\n{\n\tprintk(KERN_ALERT \"Hello World\\n\");\n\treturn 0;\n}\n\nstatic void hello_exit(void)\n{\n\tprintk(KERN_ALERT \"Goodbye World\\n\");\n}\n\nmodule_init(hello_init);\nmodule_exit(hello_exit);\n<\/code><\/pre><\/div><\/div>\n\n<p>Save this in a file called helloworld.c.\n<br \/>\nWe have 2 functions <code class=\"language-plaintext highlighter-rouge\">hello_init<\/code> and <code class=\"language-plaintext highlighter-rouge\">hello_exit<\/code> for the initialisation and\ndeinitialisation of our module respectively.<br \/>\n<code class=\"language-plaintext highlighter-rouge\">module_init<\/code> and <code class=\"language-plaintext highlighter-rouge\">module_exit<\/code> are macros defined in <code class=\"language-plaintext highlighter-rouge\">linux\/init.h<\/code> that add the boilerplate\ncode necessary to call the init\/exit functions when the module is loaded\/unloaded from kernel space.\n<br \/>\nWe need to build this module against the running kernel so that we can load it later.\nFor building we will use <code class=\"language-plaintext highlighter-rouge\">make<\/code>.\nHere\u2019s the Makefile:<\/p>\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>obj-m += helloworld.o\nall:\n\tmake -C \/lib\/modules\/$(shell uname -r)\/build M=$(PWD) modules\n<\/code><\/pre><\/div><\/div>\n<p>Run <code class=\"language-plaintext highlighter-rouge\">make<\/code>.<\/p>\n\n<p>To load the driver into the kernel run:<\/p>\n<blockquote>\n  <p>insmod helloworld.ko<\/p>\n<\/blockquote>\n\n<p>If you view the output of dmesg you will be able to view the string \u201cHello World\u201d\nprinted by your module.\nWe can now remove the module by<\/p>\n<blockquote>\n  <p>rmmod helloworld<\/p>\n<\/blockquote>\n\n<p>You will now be able to see \u201cGoodbye World\u201d on dmesg.<\/p>\n\n<p>There we have it! We built our own kernel module!\nSadly it doesn\u2019t do anything useful now but it\u2019s a start.<\/p>\n\n<p>Here are some resources to read more on kernel modules:<\/p>\n<ul>\n  <li><a href=\"https:\/\/lwn.net\/Kernel\/LDD3\/\">Linux Device Drivers Book<\/a><\/li>\n  <li><a href=\"http:\/\/tldp.org\/LDP\/lkmpg\/2.6\/html\/index.html\">tldp<\/a><\/li>\n<\/ul>","author":{"name":"Rohit Sarkar"},"category":[{"@attributes":{"term":"linux"}},{"@attributes":{"term":"eudyptula"}}],"summary":"Linux kernel development has always fascinated me. I have been wanting to learn about how things work under the hood for some time now. To this end I took up the Eudyptula Challenge. This is the first among a series of posts to keep track of my progress and log the things I learn along the way"},{"title":"Summer of \u201818","link":{"@attributes":{"href":"https:\/\/rsarky.github.io\/summer\/misc\/2018\/05\/10\/summer-18.html","rel":"alternate","type":"text\/html","title":"Summer of \u201818"}},"published":"2018-05-10T06:44:47+00:00","updated":"2018-05-10T06:44:47+00:00","id":"https:\/\/rsarky.github.io\/summer\/misc\/2018\/05\/10\/summer-18","content":"<div class=\"center-image\">\n  <p><img src=\"\/assets\/img\/summer_hero.png\" alt=\"summer\" \/><\/p>\n<\/div>\n<p><br \/>\nI will be using this blog as a medium to document all that I learn this summer. I intend to apply my learnings to practical projects. I plan to write atleast one blog article per week describing my progress but I might write more if I have some good content. I am sure you guys will learn a lot along with me in the days to come.<\/p>\n\n<p>Below is a list of topics that I plan to devote my time to this summer.<\/p>\n\n<h3 id=\"code-related\">Code Related:<\/h3>\n<ul>\n  <li>Data Structures and Algorithms<\/li>\n  <li>Web Development<\/li>\n  <li>Contributing to Open Source<\/li>\n<\/ul>\n\n<h3 id=\"miscellaneous\">Miscellaneous:<\/h3>\n<ul>\n  <li>Cooking.<\/li>\n  <li>Playing the ukulele.<\/li>\n<\/ul>\n\n<p>This list is going to be dynamic and I am going to modify it as the summer progresses.<br \/>\nFurther I am going to take up the <a href=\"http:\/\/www.100daysofcode.com\/\">#100DaysOfCode<\/a> challenge and track my progress on GitHub <a href=\"https:\/\/github.com\/rsarky\/100-days-of-code\">here<\/a><\/p>\n\n<p>Here\u2019s to a summer full of learning.<\/p>","author":{"name":"Rohit Sarkar"},"category":[{"@attributes":{"term":"summer"}},{"@attributes":{"term":"misc"}}],"summary":"I will be using this blog as a medium to document all that I learn this summer. I intend to apply my learnings to practical projects. I plan to write atleast one blog article per week describing my progress but I might write more if I have some good content. I am sure you guys will learn a lot along with me in the days to come."}]}