[{"content":"I recently started running to work and this is a post on my experience and some recommendations which might be useful for others as well.\nMotivation There are a couple of motivating factors why I thought of start running to work.\nGetting a morning run done before work\nIt was becoming increasingly difficult to do a morning run before going to work and lately I have been falling behind on my weekly running goals. Even on days I managed to get a morning run done, my sleep is a little bit compromised by having to get up early and consequently I wouldn\u0026rsquo;t feel all that productive at work.\nBy combining the morning run with commute I could get two things done in\nAvoiding public transport\nA lot of time in traffic can be wasted due to traffic situations with public transport. My commute, for example, can take anywhere from 25 minutes to 40 minutes in the morning. When there\u0026rsquo;s construction work or some protests are going on public transport might not be the most fun way to get work.\nAvoiding crowded buses in these pandemic times is something I\u0026rsquo;d like to do as well.\nRamp up weekly mileage\nWith a busy schedule it is quite difficult to maintain a good weekly mileage and the commute runs can be an easy way to add up miles over the week days.\nGear Good backpack is a must\nI think I have found a good backpack for running with the laptop, but it is too early to write a solid recommendation1.\nIt is important to consider whether you need to carry a laptop in your backpack when run commuting because most of the backpacks geared towards trail running, and there are plenty of great options to chose for trail runs, would not really secure a laptop when you are run commuting in urban roads. I think it is important to try out or do some research before getting a backpack especially if you have to run with a laptop. A backpack which can potentially reduce the bounce of the laptop while you are running is probably best for the laptop as well2.\nThere are other considerations such as how stable the bag is going to be when you are running. Having and unstable backpack which swings from side to side is not something you\u0026rsquo;d be happy to run.\nPackable running jacket\nGiven unpredictable weather it is advisable to pack a lightweight running jacket to protect against wind and rain when weather gets tough.\nChallenges Double runs are hard on legs\nEven within the short time I have tried run, commuting my legs have taken a harder beating than I anticipated. One way commute distance for me is shorter by 2km than my usual morning runs, but the toll on legs have been much harder.\nThis might be due to the adaptation period of running with the backpack and other factors such as me adapting to stop and start way due to crossings, etc. I can especially feel the toll on legs on days when I have to carry the laptop.\nRunning with a backpack requires and adaptation period\nI\u0026rsquo;m someone who likes to run with as much freedom as possible to the point that I do not even like to carry a water even on longer runs! Thus for me, running with a backpack required some adaptation to get used.\nI think it is still important to keep to solid running principles3\nRoad crossings\nGetting used to stop the run when I reach a crossing point is something I\u0026rsquo;m still adapting to. I generally do not like anything which disrupt the rhythm of running, but on a commute runs this is something inevitable. On the other hand, these pauses can provide much needed respite, especially given that running with a backpack is harder than normal runs.\nGeneral advice Try to reduce the weight of the backpack as much as possible\nRunning with a heavy backpack is not fun and probably not good for health as well given you are more likely to get injured. Finding ways to reduce the things you have to carry to work is always advisable.\nIf it is possible try to leave things at work, such as laptop chargers, etc.\nListen to your legs\nSometimes your legs are too tired and in those days it is better to take a rest day than trying to push through because you can risk injuring yourself. This is something I\u0026rsquo;m also trying to find a good balance for myself.\nI might write a follow up post on gear recommendations later on\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nLaptop bounce is not much of a concern with SSD drives these days as compared to magnetic disks\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nHighly recommended video - Principles of Natural Running with Dr. Mark Cucuzzella\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/run-commute/","summary":"I recently started running to work and this is a post on my experience and some recommendations which might be useful for others as well.\nMotivation There are a couple of motivating factors why I thought of start running to work.\nGetting a morning run done before work\nIt was becoming increasingly difficult to do a morning run before going to work and lately I have been falling behind on my weekly running goals.","title":"Run Commuting"},{"content":"Born to Run by Christopher McDougall has been probably the most influential running book I\u0026rsquo;ve read thus far. I was into running recreationally when I first read it a couple of years ago, but the book made me rethink running in many different aspects.\nThe main thesis of the book builds on and popularised the ideas of researchers such as Daniel Lieberman contending that endurance running is one of traits which modern humans (homo sapiens) were optimised from an evolutionary perspective1.\nMcDougall brings forth research showing how running must have been a competitive advantage for early hunter gathers and a hunting technique practised by some African tribes even in the present day.\nThere are a couple of other running topics which I first really got interested after reading the Born to Run book.\nUltra-running Ultra-running is the discipline of running longer than marathon distance and it is fair to say that Born to run is the book which put them into focus. Now there are many other books on ultra-running to chose from.\nIn fact, the book\u0026rsquo;s culmination is about a race in mountainous Mexican terrain with Tarahumara runners and other ultra-running athletes, such as Scott Jurek. This book manages to build the suspense and anticipation for the culmination of the race and readers are eager to discover how \u0026ldquo;modern\u0026rdquo; athletes would fare against tribal runners, for whom running is a lifestyle.\nNatural running technique This book emphasise \u0026ldquo;natural running technique\u0026rdquo; and this got me interested to research more on this topic. Even though there\u0026rsquo;s no hard right or wrong when it comes to running, this book showed me that it is worth learning about proper bio-mechanics of running, especially to reduce the chance of injury.\nThere are many pointers in the book for one to start research in this area. This is an area which still interest me a lot and I might write a dedicated post on that topic later.\nBarefoot running This is the book which started the barefoot craze back then when it was first published. This book challenged the established assumptions about cushioned running shoes and although I do not think barefoot running is a one size fits all solution to all running problems, I became much more informed on this topic mostly due to this book!\nI can highly recommend this book for any running enthusiast to pick up and read. It has some wonderful storytelling that even if you are not into running you might just enjoy it very much!\nEndurance running and the evolution of Homo\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/born-to-run/","summary":"Born to Run by Christopher McDougall has been probably the most influential running book I\u0026rsquo;ve read thus far. I was into running recreationally when I first read it a couple of years ago, but the book made me rethink running in many different aspects.\nThe main thesis of the book builds on and popularised the ideas of researchers such as Daniel Lieberman contending that endurance running is one of traits which modern humans (homo sapiens) were optimised from an evolutionary perspective1.","title":"Born to Run"},{"content":"These are some of the books I\u0026rsquo;ve enjoyed very much on running.\nOnce a Runner The story of Quenton Cassidy This probably has a lot of sentimental value for me. Again to Carthage - Cassidy's story continued - This is a story of a high school runner Running with the Buffaloes One of the best books on collegiate running I\u0026rsquo;ve read. This is based on a true story Born to Run This book left a lasting impact on how I approach running from technique to enjoying running. This book made me question conventional wisdom on running shoes and moulded my preference for no-fuss simpler shoes. Made me think about long term running health by trying to focus on good technique with natural running. Natural running is different for each and every person. I try to incorporate the philosophy of running from this book. Good running technique Motivation for running as a lifelong hobby and not something which one does to tick a box like running a marathon This book prompted me to read more about good running technique What I Talk About When I Talk About Running This is from Haruki Murakami This is a musing on running Why he runs even when he is into advanced age and what running means to him personally ","permalink":"https://dewaka.com/blog/running-books/","summary":"These are some of the books I\u0026rsquo;ve enjoyed very much on running.\nOnce a Runner The story of Quenton Cassidy This probably has a lot of sentimental value for me. Again to Carthage - Cassidy's story continued - This is a story of a high school runner Running with the Buffaloes One of the best books on collegiate running I\u0026rsquo;ve read. This is based on a true story Born to Run This book left a lasting impact on how I approach running from technique to enjoying running.","title":"Running Books"},{"content":"Anki is an indispensable tool for studies which aids memorisation through spaced repetition1. Flashcards are really good for learning new languages and any subjects which requires a lot of memorisation.\nThere are other software both free and proprietory for spaced repetition based learning. With its pretty good mobile application, which is free on the Android platform, Anki has been my go to solution for flashcards. Having the ability to use the flashcards on phone was an important factor in my decision to settle on Anki for this purpose as opposed to other solutions such as org-mode based solutions which briefly I explored initially.\nI found that the cards I make myself are much more useful than the ready made decks I can find from ankiweb2. When you are making the notes yourself chance of recalling the notes later is definitely higher because your mind has to be engaged with the subject matter in the in the card making process itself.\nHowever, one aspect I was not quite happy with Anki is that I found it is a little bit clunky to create flashcards in the bulk with its card builder UI. For example, when you are learning a new language, you might come across a couple of new words you want to capture into your language learning deck. Using plain Anki one has to create cards one by one, which is not super efficient. The built in flashcard editor is perfectly adequate, but it is nowhere as efficient as capturing to an org-mode note with Emacs, for example.\nThus I have been looking for a solution to write flashcards in using my favourite tools such as Emacs or Vim where I can easily edit things far more efficiently compared to somewhat clunky Anki card builder interface.\nMarkdown flashcards After exploring a couple of software packages which support creating markdown based flashcards, mdanki is the solution I found which worked best. I found that the card format required by the package is quite clear. This package handles images quite well.\nFollowing is an example flashcard note demonstrating the basic elements,\n## What is the capital of New Zealand? Wellington ![Wellington pic](images/wellingon.png) [#Cities]() Front matter starts with a level two heading (##) The contents under the heading will be part of contents of the card You can optionally have tags, which are very useful for organising information, as links with the syntax: #[tag_name]()3 Advantages and new possibilities Having flashcards in markdown format addresses a couple of shortcomings I found with my Anki card making workflow.\nMarkdown is simpler to write for even nicely formatted card. Simple formatting for a flashcard can be done quite easily in the markdown syntax. They can be versioned easily. Putting markdown files in a git repository is super convenient than trying to version your binary anki decks! Editing in a note in a real editor is so much more efficient than using the Anki interface. For example, in my case I\u0026rsquo;m far more efficient in editing markdown notes in Emacs than the Anki editor. Even adding something like a table in markdown in super simple compared to what you can do in the Anki interface. Easily backup your notes. Anki has functionality to export your database for backup purposes, but Markdown text format is even more future proof because it\u0026rsquo;s all just text at the end of the day! You can re propose the flashcard notes to other purposes very easily because your notes are just a simple collection of markdown notes organised into headings and paragraphs. In fact, I found that the notes I made are quite good for revising things by themselves. It helps that GitHub has pretty nice rendering for markdown files, for example. https://en.wikipedia.org/wiki/Spaced_repetition\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://ankiweb.net/\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nI found that tags with spaces does not work well\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/flashcards-in-markdown/","summary":"Anki is an indispensable tool for studies which aids memorisation through spaced repetition1. Flashcards are really good for learning new languages and any subjects which requires a lot of memorisation.\nThere are other software both free and proprietory for spaced repetition based learning. With its pretty good mobile application, which is free on the Android platform, Anki has been my go to solution for flashcards. Having the ability to use the flashcards on phone was an important factor in my decision to settle on Anki for this purpose as opposed to other solutions such as org-mode based solutions which briefly I explored initially.","title":"Flashcards in Markdown"},{"content":"I have a Thinkpad T470p laptop with Linux Mint 20.1 (Xfce) installed for personal use and power management is one of the things I dislike in otherwise a pretty good laptop. Compared to my work laptop, a Macbook, the Thinkpad drains battery in sleep mode and I often find the battery completely drained if I happen to not to use the laptop for a couple of days.\nSince Linux Mint does not come with Hibernation option enabled out of the box, following are the steps I did to enable this option.\nSwap partition I found it is easier to have the right size of swap partition at installation time rather than trying hibernation support based on a swap file. Following instructions are based on my setup with a swap partition.\nI created a swap partition of 25G since I have 24G of RAM at install time.\nInstall hibernate utilities Install hibernate utils,\nsudo apt install pm-utils \u0026amp;\u0026amp; sudo pm-hibernate Update grub Find the UUID of the swap partition by grep swap /etc/fstab.\nYou need to update grub boot loader to add option to resume from disk. For that, edit /etc/default/grub and modify the GRUB_CMDLINE_LINUX_DEFAULT as super user1.\nIn my case the the required edit looks as follows.\nGRUB_CMDLINE_LINUX_DEFAULT=\u0026#34;quiet splash resume=UUID=putYourSwapUUIDhere\u0026#34; Then update grub with command sudo update-grub.\nPower menu Now you should be able to hibernate with systemctl hibernate.\nHowever the power menu in Linux Mint doesn\u0026rsquo;t show the Hibernate option.\nFor that I needed to add the following policy2 to /etc/polkit-1/localauthority/90-mandatory.d/enable-hibernate.pkla.\n[Enable hibernate] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions ResultActive=yes After adding the policy Hibernate should show up as a power management option in the Mint menu.\nHibernation has been working quite smoothly thus far in my laptop. I prefer to use this option when I know that I\u0026rsquo;m not likely to pick up the laptop in a while.\nhttps://superuser.com/questions/383140/linux-grub2-how-to-resume-from-hibernation\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://forums.linuxmint.com/viewtopic.php?t=326063.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/linux-mint-hibernate/","summary":"I have a Thinkpad T470p laptop with Linux Mint 20.1 (Xfce) installed for personal use and power management is one of the things I dislike in otherwise a pretty good laptop. Compared to my work laptop, a Macbook, the Thinkpad drains battery in sleep mode and I often find the battery completely drained if I happen to not to use the laptop for a couple of days.\nSince Linux Mint does not come with Hibernation option enabled out of the box, following are the steps I did to enable this option.","title":"Linux Mint Hibernate"},{"content":"In this post I would like to show a Vim1 trick I use often to do some repetitive editing tasks in a programmatic way.\nThis is best explained by discussing an example. Think that you have a long list of values with duplicates and your task is to remove the duplicates and get the set of unique values.\nIn my case, this kind of editing requirement is something which frequently comes up at work with data analysis queries. Often the values might come from a CSV, Excel sheet, or other source.\nUsing POSIX tools If the order of the items do not matter, using sort and uniq tools is the fastest way to get the desired output.\nVisual select the lines you want to remove duplicates from,\ngxazwcayu8BeY ZXDzrsfZtpwXm gxazwcayu8BeY ZXDzrsfZtpwXm VXAtmdTPRUjUp ZXDzrsfZtpwXm gxazwcayu8BeY ZXDzrsfZtpwXm VXAtmdTPRUjUp VXAtmdTPRUjUp VXAtmdTPRUjUp Run the following command on selection in Vim command mode,\n:\u0026#39;\u0026lt;,\u0026#39;\u0026gt;!sort|uniq Selected lines from the first step should be replaced with following output,\nVXAtmdTPRUjUp ZXDzrsfZtpwXm gxazwcayu8BeY Using Python As can be seen from the output of the previous command, the order of the items in the list gets mangled when you use the sort command. This is where some creative use of inline Python2 can be used to fix that.\nHere\u0026rsquo;s an example of a script I\u0026rsquo;d usually write to remove duplicates while preserving order. Since this is just a demonstration of a Vim trick, I\u0026rsquo;m not going to explain too much on the Python code itself, but this inline script has to make sure following things are taken care of,\nCapture the text into a string - s = \u0026quot;\u0026quot;\u0026quot;. Python multi-line strings3 are ideal for this use case. Split the string into lines - s.split() Remove duplicate lines - set(l.rstrip() for l in s.split())4 Print the unique lines to standard out - print('\\n'.join(set(l.rstrip() for l in s.split()))) The important thing to keep in mind that the output from the command is what Vim replaces the text with. Hence why the text transformation script need to print to stdout.\nWith Vim it is pretty easy to undo(u) and experiment to get the transformation you are looking for.\nHere are all the steps,\nWrite an inline script and visual select the whole area,\ns = \u0026#34;\u0026#34;\u0026#34; gxazwcayu8BeY ZXDzrsfZtpwXm gxazwcayu8BeY ZXDzrsfZtpwXm VXAtmdTPRUjUp ZXDzrsfZtpwXm gxazwcayu8BeY ZXDzrsfZtpwXm VXAtmdTPRUjUp VXAtmdTPRUjUp VXAtmdTPRUjUp \u0026#34;\u0026#34;\u0026#34; print(\u0026#39;\\n\u0026#39;.join(set(l.rstrip() for l in s.split()))) Run the following command on selection in Vim command mode,\n:\u0026#39;\u0026lt;,\u0026#39;\u0026gt;!python3 Selected lines from the first step should be replaced with following output,\ngxazwcayu8BeY ZXDzrsfZtpwXm VXAtmdTPRUjUp Video demo Here is a short demo of using the first method to remove duplicates from a long list of items.\nIn summary, I find Vim selection piping to be a powerful technique when the editing is of repetitive nature, but not too regular enough to write a macro. As long as writing a short inline Python script is faster than writing a separate script or a spreadsheet program when data is columnar, I find that Vim selection piping is powerful enough for a lot of tasks.\nEmacs evil-mode also supports this feature!\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nThis is not specific to Python. Any programming language with good string manipulation functions would do equally well here.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nPython set order can be implementation dependent.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/vim-selection-piping/","summary":"In this post I would like to show a Vim1 trick I use often to do some repetitive editing tasks in a programmatic way.\nThis is best explained by discussing an example. Think that you have a long list of values with duplicates and your task is to remove the duplicates and get the set of unique values.\nIn my case, this kind of editing requirement is something which frequently comes up at work with data analysis queries.","title":"Vim selection piping"},{"content":"Following a post on a couple of neat tricks I learned while bulk changing links in org-mode text files.\nI keep scanned hand written notes in PDF format in the main notes directory with org-mode files. Then I link them as appropriate on daily notes I might keep while working on tasks etc. Scanned notes were dumped in a single directory before the start of this year. This was soon getting quite messy as notes got accumulated over the months and with the new year, I wanted a better organisation structure for the notes.\nMoving existing files was quite simple because I only had scanned notes for the last year (2020) and all of them could be moved to the 2020 directory. But the problem was updating existing links to them in existing org-mode notes files.\nI had to change links with diffs such as follows and I wanted to automate the task instead of manually fix them in 50 or so odd files!\n-[[file:~/Dropbox/Documents/Notes/Pages/Scan 15 Dec 2020.pdf][Dec 15, 2020]]. +[[file:~/Dropbox/Documents/Notes/Pages/2020/Scan 15 Dec 2020.pdf][Dec 15, 2020]]. After thinking about this problem a bit I thought of using ripgrep1 and sed for the task.\nComing up with the search and replace command was the easy part, but it wasn\u0026rsquo;t as straightforward to find out how to pipe things together using xargs given that most of the examples and stackoverflow answers assume the use of GNU tools.\nCommand for bulk change Following is the final command I used for the bulk change of links in org-mode text files,\nrg \u0026#39;Notes/Pages/Scan*\u0026#39; -l | xargs -I@ sed -i \u0026#39;\u0026#39; \u0026#39;s,Pages/Scan,Pages/2020/Scan,g\u0026#39; @ It is worth breaking down the command and discuss about parts which were tailored for the job to make it easier to follow.\nripgrep -l (--files-with-matches) option to get a list of files which matches the search expression xargs Use of xargs -I option for substitution - as in the following example a variable can be used for substituting output. The variable can be any symbol. Following example, and its output should make it clear what\u0026rsquo;s going on with the command substitution.\n\u0026gt; echo hello | xargs -I_ echo _ _ hello hello sed Use of custom separator , makes it cleaner when there / in the search and replace expressions as in the original example -i '' this option has to be given on macOS and this was the head scratcher. While GNU sed accepts empty -i argument, it has to be given empty '' on macOS. Ripgrep is an overkill for this particular search where grep would be equally sufficient. But rg is easier to type and that\u0026rsquo;s what I used!\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/bulk-search-and-replace/","summary":"Following a post on a couple of neat tricks I learned while bulk changing links in org-mode text files.\nI keep scanned hand written notes in PDF format in the main notes directory with org-mode files. Then I link them as appropriate on daily notes I might keep while working on tasks etc. Scanned notes were dumped in a single directory before the start of this year. This was soon getting quite messy as notes got accumulated over the months and with the new year, I wanted a better organisation structure for the notes.","title":"Bulk search and replace with ripgrep and sed"},{"content":"Oftentimes you find that there are different SDK requirements for different projects. A classic example would be that your Scala project might be stuck at JDK 8 level1, but Java projects themselves might be using later versions, such as JDK 11.\nIt would be cumbersome to switch between different JDK versions manually, having to make sure to correctly setup JAVA_HOME when you switch between projects. sdkman is there to address this problem and the same class of problems for other types of development setups as well. These include Scala, Groovy, Gradle and a lot more.\nInstallation and setup Follow the instructions to install sdkman.\nThe installation script integrates to bash/zsh automatically. You can alternatively add the following at the end of the ~/.bashrc or ~/.zshrc for bash and zsh respectively.\nexport SDKMAN_DIR=\u0026#34;$HOME/.sdkman\u0026#34; [[ -s \u0026#34;$HOME/.sdkman/bin/sdkman-init.sh\u0026#34; ]] \u0026amp;\u0026amp; source \u0026#34;$HOME/.sdkman/bin/sdkman-init.sh\u0026#34; SDKMAN_DIR is the default location for the install and on a POSIX system it is $HOME/.sdkman.\nDefault location can be customised by exporting $SDKMAN_DIR variable to a custom location, as shown below,\nexport SDKMAN_DIR=\u0026#34;/usr/local/sdkman\u0026#34; \u0026amp;\u0026amp; curl -s \u0026#34;https://get.sdkman.io\u0026#34; | bash` Integration with fish shell Fish shell, which is my current shell, requires a third party plugin, or manual setup. I found that sdkman-for-fish works quite nicely. This plugin adds sdkman binaries to fish path and also adds autocompletion for sdkman commands.\nTo install for fish shell with the popular fisher2 tool run\nfisher add reitzig/sdkman-for-fish Usage Usage is illustrated in following examples in terms of Java SDKs, but adapting the same commands for other SDKs should be quite simple given they follow the same usage patterns.\nTo see a list of all available SDK types,\nsdk list To get a list of available Java sdk versions,\nsdk list java To install a version of Java, after selecting a version using the above command,\nsdk install java 8.0.232.hs-adpt To remove sdk version,\nsdk rm java 8.0.232.hs-adpt uninstall also works in place of rm.\nHow to change the default version globally,\nsdk default java 11.0.5.hs-adpt Using a specific version for a specific shell session without changing the default globally,\nsdk use java 8.0.232.hs-adpt Where to find the installed SDKs? Candidates for a given SDK is found under the candidates directory in $SDKMAN_DIR. For example, in Java SDKs,\nLocation for JDK 11 from OpenJDK,\n$SDKMAN_DIR/candidates/java/11.0.5.hs-adpt`. Specific version locations are useful for setting up project specific JDKs in IDEs.\nCurrent version is a symbolic link to one of the instlaled candidates,\n$SDKMAN_DIR/candidates/java/current It is useful to set the JAVA_HOME environment variable to always point to the current version.\nFor bash/zsh shells,\nexport JAVA_HOME=\u0026#39;$SDKMAN_DIR/candidates/java/current\u0026#39; For fish shell,\nset -g -x JAVA_HOME \u0026#39;$SDKMAN_DIR/candidates/java/current\u0026#39; Footnotes Running vs compiling in Scala JDK compatibility.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nfisher - A package manager for the fish shell.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/sdkman-to-simplify-development/","summary":"Oftentimes you find that there are different SDK requirements for different projects. A classic example would be that your Scala project might be stuck at JDK 8 level1, but Java projects themselves might be using later versions, such as JDK 11.\nIt would be cumbersome to switch between different JDK versions manually, having to make sure to correctly setup JAVA_HOME when you switch between projects. sdkman is there to address this problem and the same class of problems for other types of development setups as well.","title":"Using sdkman to simplify development"},{"content":"This is a short review and discussion on one of the more helpful books I read on the topic of habit formation - Tiny Habits by BJ Fogg.\nBook starts by giving you a framework for understanding behaviour formation with the Fogg behaviour model, as shown below.\nB = M A P M = Motivation A = Ability P = Prompt -------------- B = Behaviour Motivation, ability and prompt are the parameters which you can tweak to form a new behaviour.\nTo give an idea about how this framework is used in the book to explain habit formation, we can consider a hypothetical habit on starting a running habit.\nMotivation In the context of habits, motivation is the drive you have for forming the behavioural change. Most people think this is the most important criteria when it comes to making or breaking habits, but throughout the book, Fogg makes the case that that is not the case.\nIn terms of our concrete example, motivation is how much you\u0026rsquo;d want to get into the running habit. Motivation could be based on extrinsic factors or it could be intrinsic. For example, an extrinsic motivation for running could be to win a price in the upcoming road race, whereas intrinsic motivation could be to enjoy the the freedom of a run in the morning without any competitive aspects.\nMotivation is important to get you started on something you\u0026rsquo;d like to do. No matter how much ability you might have for the task at hand, in this case running you might not get out of the house if you do not have motivation. You could have done track and fields in school and having learnt good running technique, but at this point in your life after a long hiatus from running, it is unlikely that you would stick to a running habit if you do not have the motivation.\nYou could have a pretty good prompt too, but still without some motivation, you are more than likely to give up on the habit even if you manage to give running a shot a few times. Thus, it is important to pick habits you are motivated about and if it is about health and exercising, there are so many habits you can pick up and it doesn\u0026rsquo;t have to feel like an uphill battle.\nAbility Ability is simply the competence we have at the endeavour we are taking on as a new behaviour. In terms of our example, that would be your running ability. Even though we are born to run1, it helps to learn about proper running techniques to keep running in a way to minimise chance of injuries. For example, if you have not run for a while, it might not be the best idea to sign up to run a marathon in a short time. The book goes further in discussing how much natural ability one might have vs how much one might be able to learn from.\nAs with anything in life, once you get started on a habit, you tend to get better at with more experience thus improving our ability. After all the best way to get better at running is not reading a bunch of books on running, but as runners would say, to pound the pavement2.\nPrompt Prompt is the last part of the behavioural change, but quite an important one. This could be a simple trigger which signals you to take action on the task you want to do as a habit. For example, in the morning you can set up a prompt to get ready for running as soon as you finish the morning coffee. Here the the act of finishing the coffee is the prompt for your next behaviours which is getting ready for running.\nFogg emphasise the importance of having consistent prompts for behavioural change.\nI also quite liked the emphasis of starting with tiny habits, which is the book\u0026rsquo;s title after all, and let the habits evolve naturally. Starting small and taking baby steps is a good way to get started on any kind of habit. Forming new behaviour is not easy and there\u0026rsquo;s a lot of inertia which one has to overcome to even get started and if you set too high a bar for the habit to even count toward your goal, there\u0026rsquo;s a pretty high chance that you won\u0026rsquo;t even get started on that.\nIn terms of the running habit we discussed in this post, I think it might be better to start with a program like couch to 5k3 vs training for a marathon4! You can always go tinier - your first goal might be to just run a couple of blocks in your neighbourhood or just even mix it with walking. Making the tiniest of habits, if you are sufficiently motivated is a pretty good way to get started and naturally you\u0026rsquo;d fine yourself expanding on your goals.\nIf this is something you like to read more about, I highly recommend the book.\nBorn to Run: A Hidden Tribe, Superathletes, and the Greatest Race the World Has Never Seen\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nExpression aside, try to find more forgiving paths to run than pavements if you can!\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://www.nhs.uk/live-well/exercise/couch-to-5k-week-by-week/\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nHere it could be a balancing act with motivation as well. For example, you might feel more motivated to achieve something tangible such as getting a Marathon finisher medal than just running a 5k!\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/tiny-habits/","summary":"This is a short review and discussion on one of the more helpful books I read on the topic of habit formation - Tiny Habits by BJ Fogg.\nBook starts by giving you a framework for understanding behaviour formation with the Fogg behaviour model, as shown below.\nB = M A P M = Motivation A = Ability P = Prompt -------------- B = Behaviour Motivation, ability and prompt are the parameters which you can tweak to form a new behaviour.","title":"Book Review  - Tiny Habits"},{"content":"A bit of history Iron gall ink is a purple-black or brown-black ink made from iron salts and tannic acids from vegetable sources1\nAs a fountain pen enthusiast, it was pretty interesting to learn about the history and modern incarnations of this particular type of inks.\nBoth Leonardo\u0026rsquo;s notebooks and Isaac Newton\u0026rsquo;s notebooks seemed to have contain writing primarily with iron gall inks, such as the following image from a Leonardo\u0026rsquo;s notebooks2. It is these \u0026ldquo;vintage\u0026rdquo; colouring which initially got me interesting to try iron gall inks as well.\nIt was also pretty interesting to read3 about a recipe for iron gall inks in Newton\u0026rsquo;s notebooks - Chemistry of Isaac Newton. Then again, it is not all that surprising given that in those days iron gall inks were the common inks people used to write with.\nModern iron gall ink - Rohrer and Klingner Scabiosa Due to their corrosive nature, pure iron gall inks cannot be used with fountain pens4, but there are modern incarnations of these inks which are milder to both fountain pens and paper. Rohrer and Klingner has two iron gall inks their fountain pen ink lines as of this writing - Scabiosa and Salix. Scabiosa is a dark violet colour and Salix is a blue/black colour.\nSince I have plenty of blue and black colours already, I chose Scabiosa to try as the first iron gall type of ink. This is one of the two iron gall inks from the Rohrer and Klingner fountain pen inks range. Since I already have (too) many Blue inks, I thought of trying out the Scabiosa first, which is a dark violet ink.\nThe pen - Twisby Diamond 580 Given that Scabiosa comes with the advisory that the ink shouldn\u0026rsquo;t be left too long in the fountain pen, I decided to try the ink with my most frequently used fountain pen in rotation, TWISBI Diamond 580.\nThere were couple of other reasons I chose this particular pen to partner with Scabiosa.\nTwisby Diamond 580 has user replaceble nibs. Thus if something goes wrong I can replace just the nib, which is considerably less expensive than buying a new pen. In fact, I already have an extra medium nib for this model, which is the origianl nib I got with the pen.\nOther reason is that Twisby pens are very easy to clean and disassemble5, unlike many piston filler fountain pens from other brands, even though you do not have to remove more than the nib unit for a thorough cleaning.\nWriting experience As for the writing experience, it has been great like all other Rohrer and Klingner inks I\u0026rsquo;ve tried thus far. This ink definitely smells and writes differntly though, which shows its iron gall heritage in interesting ways.\nScabiosa is on the drier side when it comes to ink flow, but nothing much to complain about. I didn\u0026rsquo;t experience the feed drying out at all.\nFreshly written notes has a noticible smell from other inks from this brand which I\u0026rsquo;m familiar with. It is not overpowering or offensive though.\nThis is an ink which\u0026rsquo;s colouring is quite hard to show in a picture and I\u0026rsquo;m not even going to attempt it because there are better sources for that, such as,\nPen Addict - Rohrer \u0026amp; Klingner Scabiosa Review Rohrer and Klingner Scabiosa: Ink Review As noted in these reviews, it has also been my experience that the colouring changes with time pretty quickly. Fresh ink has more violet tones in my own writing, then changing to darker brownish colour as the ink gets oxidized. It is fun just to observe the colour change on freshly written notes, esp. on a fine line of ink where you get to see the lighter shades easily. I found that the inks shading is also sensitive to the paper as well.\nAll in all Scabiosa is quite a fun ink to try for me thus far.\nhttps://en.wikipedia.org/wiki/Iron_gall_ink\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nImage from https://irongallink.org/igi_index608d.html\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttp://www.fountainpennetwork.com/forum/topic/225712-a-recipe-to-make-excellent-ink-by-sir-isaac-newton/\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://en.wikipedia.org/wiki/Iron_gall_ink#Fountain_pens\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nDisassembly Line TWSBI Diamond 580\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/iron-gall-inks/","summary":"A bit of history Iron gall ink is a purple-black or brown-black ink made from iron salts and tannic acids from vegetable sources1\nAs a fountain pen enthusiast, it was pretty interesting to learn about the history and modern incarnations of this particular type of inks.\nBoth Leonardo\u0026rsquo;s notebooks and Isaac Newton\u0026rsquo;s notebooks seemed to have contain writing primarily with iron gall inks, such as the following image from a Leonardo\u0026rsquo;s notebooks2.","title":"Trying Iron Gall Inks - Rohrer and Klingner, Scabiosa"},{"content":"Dithering in Chrome after resuming I have had this annoying problem with Chrome on latest Xubuntu LTS1 installation on my Thinkpad T470p laptop where Chrome would get dithering artefacts after resuming from sleep. Installing the latest versions of software didn\u0026rsquo;t really solve the problem.\nFollowing are the system configurations I observed this issue.\nXubuntu 20.04 (Linux 5.40.0-51) NVIDIA driver 450.80.02 Chrome 86.0.4240.75 This problem has been bothering me ever since I started using Ubuntu 20.04 on this particular laptop. After resuming Chrome was unusable till I restarted the browser.\nThe fix After some googling, it seemed that this is a pretty common problem with Chromium based browsers and applications on Linux with latest Nvidia drivers. People have reported that programs which are based on Chromium, such as VSCode also runs into this issue. Firefox does not have this problem.\nFinally, the solution which worked was the 2nd answer from this StackOverflow question - Problems with Chrome browser after suspending the computer on Ubuntu 20.04. So, I\u0026rsquo;m documenting this for myself and for other\u0026rsquo;s who might be facing the same issue. I found that other suggested fixes for this problem didn\u0026rsquo;t really solve the issue, or they came with their own problems, such as slowdowns.\nThe fix is quite simple: use Chrome flag --use-gl=desktop when launching Chrome. You can change the default desktop entry for launching Chrome and add the flag there, but I just decided to have a small script for launching2 Chrome with content as follows.\n#!/usr/bin/env sh google-chrome --use-gl=desktop With this flag provided, I didn\u0026rsquo;t see dithering issues with Chrome after resuming from sleep and neither did I notice any performance issues, thus far.\nUbuntu 20.04 (Focal Fossa)\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nI use excellent rofi launcher as the default application launcher on Ubuntu\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/chrome-nvidia-ubuntu/","summary":"Dithering in Chrome after resuming I have had this annoying problem with Chrome on latest Xubuntu LTS1 installation on my Thinkpad T470p laptop where Chrome would get dithering artefacts after resuming from sleep. Installing the latest versions of software didn\u0026rsquo;t really solve the problem.\nFollowing are the system configurations I observed this issue.\nXubuntu 20.04 (Linux 5.40.0-51) NVIDIA driver 450.80.02 Chrome 86.0.4240.75 This problem has been bothering me ever since I started using Ubuntu 20.","title":"Fix for Chrome dithering issue with Nvidia on Linux"},{"content":"I have always been a fan of fountain pens from my school days and throughout the university years. But recently I haven\u0026rsquo;t been writing all that much and consequently my fountain pen usage went down.\nHowever, discovering some really nice fountain pen inks recently rekindled my interest in fountain pen writing along with taking written notes.\nSince I liked these inks so much and given that I learnt about them only recently, I thought of writing a short blog post on how they look on paper and other fountain pen related things I tend to use or have used in the past.\nPaper Fountain pens demands a certain qualities from paper to have a good writing experience. When it comes to paper, getting high quality gsm paper1 is probably a safe start even if we ignore many other factors which influence the writing quality with fountain pens. Following are some of the popular notebooks among fountain pen users which I have also used in the past,\nLEUCHTTURM1917 Dotted Notebooks - these notebooks are excellent for fountain pen writing as they do not bleed through even when writing with the wettest fountain pens and ink combinations. These notebooks comes with dotted paper as well, which are quite nice for writing with fountain pens since it give more flexiliby to control your letter sizes to fit your fancy and style. Moleskine Classic Ruled Paper Notebook - At least from my experience they were not as good as the Leuchtturm notebooks when it comes to properties such as bleedthrough. Following are my current favourite notebooks for bulk writing,\nOxford My Notes, A5 Notebook - These books I found to be as good as more expensive Leuchtturm1917 even for fountain pen usage. Cambridge Jotter, A5 notebooks - These ones are even cheaper than Oxford ones, but they are a little lighter and wouldn\u0026rsquo;t be of the highest standard when it comes to fountain writing. Latter is even cheaper and great for writing stuff you wouldn\u0026rsquo;t want to keep for long. This is pretty useful for my language practice where I tend to write like a nursery kid for learning new languages.\nPens Although I do not collect fountain pens as a hobby, I have bought more than a few fountain pens over the years. I try not to buy fountain pens which I would think twice to ink up and use on a daily basis. This heuristic has helped me curb my enthusiasm for spending a lots of money on really expensive pens!\nFollowing are some of my favourite fountain pens2 which are almost always inked up, if I happen to be in fountain pen mood,\nTWSBI Diamond 580 - TWISBI makes relatively affordable steel nib fountain pens which are excellent for writing Lami Safari - These pens comes in myriad colours and would be a perfect pen to get as a starter pen. Make sure to get a converter as well since they only come with a Lamy cartridge. Platinum 3776 (Chartres Blue) - This is on the smaller side for my hands, but it is comfortable after posting. This is an excellent writer and I really like the Japanese fine nib for writing given my preference for fine nibs. In fact, Platinum F nib is even finer than the Lamy Safari EF nib! My nib preference is usually on the finer side due to a couple of factors such as my handwriting size and the purpose (which is mostly note taking).\nInks In the past I have been quite conservative in my ink choices, sticking with excellent Waterman fountain pen inks and occasionally Diamine inks. For people getting started with fountain pens, sticking with inks which are known to work with most type of nibs and papers is a good way to go. Most Waterman inks definitely ticks those boxes in my experience as well.\nAfter coming across Rohrer and Klingner Cassia Ink Review, I also got interested to try Rohrer and Klingner inks and following are the ones which I tried recently. All the inks below have really good flow and quick drying properties. As far as I can see, they are pretty easy to clean as well.\nNote that my writing samples are only good as a crude approximation for what the inks look on Oxford notebook paper.\nCassia Cassia is my favourite out of the three Rohrer and Klingner inks I\u0026rsquo;ve gotten thus far. It is a very lively purple with really good ink flow properties. My writing sample, which is from a Lamy Safari with a fine nib on Oxford notebook papper, cannot do justice to how nice this ink looks in person at all. See Goulet pen\u0026rsquo;s for a better review - Goulet pen\u0026rsquo;s Rohrer and Klingner Cassia Review.\nBlau Permanent Blue is a staple colour for me and I have been very happy with Waterman blue inks, of which I have at least two shades. But, I found that I quite like the Blau Permanent ink from Rohrer as well and this sample is from the Platinum 3776 with a fine nib on Oxford notebook paper.\nFor a better a review check this out Goulet pen\u0026rsquo;s Rohrer and Klingner Blau Permanent Review.\nBordeaux This is my first reddish colour fountain pen ink and altough not my favourite to write notes with, it does add a nice variety when I feel like. Rohrer and Klingner Bordeaux is, as the name suggests a very nice Wine coloured ink. This sample is from a Lamy Safari extra fine pen on the same paper as before. See Goulet pen\u0026rsquo;s Rohrer and Klingner Alt-Bordeaux Review.\nI hope to explore more of the Rohrer and Klingner ink range in the future.\nFor a more in depth review of good paper for fountain pen writing, see JetPens - The Best Fountain Pen Paper\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nThese links are Amazon affiliate links.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/fountain-pens/","summary":"I have always been a fan of fountain pens from my school days and throughout the university years. But recently I haven\u0026rsquo;t been writing all that much and consequently my fountain pen usage went down.\nHowever, discovering some really nice fountain pen inks recently rekindled my interest in fountain pen writing along with taking written notes.\nSince I liked these inks so much and given that I learnt about them only recently, I thought of writing a short blog post on how they look on paper and other fountain pen related things I tend to use or have used in the past.","title":"Reflections on Fountain Pens"},{"content":"One of the convenient things I quite like about Sublime Text is the easy to setup build system1. It is pretty easy to add a custom build setup with Sublime Text, to compile a single C++17 source file, for example. Once configured it is very efficient and keyboard friendly to compile and run a C++ program with a single key press, F7 with default key bindings.\nThis blog post is about how to configure Emacs in a similar vein.\nThe use case I had in mind was to configure Emacs to compile and run single file C++ programs without having to write a Makefile. It is pretty easy to invoke shell commands within Emacs, so if you have a build setup with make and the like, it is not difficult to to build and run programs within Emacs. However, what I wanted was to build and run one off C++ source files.\nCompile Command Emacs compile command to the rescue2!\nDefault compile command for C/C++ mode is make -k, which is not what I want in this case. Compile command can be customised on a per-mode basis.\nFollowing is the compile command I configured for compiling one off C++ source files. This command builds and runs C++ source files based on the current buffer name. For our purposes, buffer name is equivalent to the file name of the C++ source file.\n(add-hook \u0026#39;c++-mode-hook (lambda () (set (make-local-variable \u0026#39;compile-command) (format \u0026#34;g++ -std=c++17 -Wall %s -o a.out \u0026amp;\u0026amp; ./a.out\u0026#34; (shell-quote-argument (buffer-name)))))) We are supplying the file name which can be found out from buffer-name elisp function as the input file parameter for g++ compiler. Note that this command will work on macOS as well. We need to quote the file name to be run as a shell command, which is what the shell-quote-argument does. Once setup up, to compile the current source file you are editing can be accomplished by invoking compile command in Emacs (M-x compile).\nSince the compile command is differentiated based on the mode it is bound to, you can have custom compilation commands for different programming languages.\nPer-file (or per-directory) customisation Pretty cool thing about the compile-command is that it can be set and customised on a per-file basis, using Emacs file variables3. These variables are set when visiting a file, or when setting the major of a buffer, and makes them local to the buffer.\nFollowing is an example local variable specification on a C++ file, customising the executable name, C++ version, etc. Make sure to quote compile command as a string. Emacs makes it pretty easy to add them as well - use make-local-variable4 command and Emacs will insert the right type of commented variable declaration automatically!\n// Local Variables: // compile-command: \u0026#34;g++ -std=c++11 -Wall hello-world.cpp -o hello \u0026amp;\u0026amp; ./hello\u0026#34; // End: Similar customisations can be applied on a directory basis with .dir-local.el files5. With directory local variables, you can set the compile command on a project basis, instead of relying on the global configuration as shown with the add-hook method, or having to specify on a per-file basis as shown in the example above.\nAs can be seen from above examples, Emacs offers a couple of ways to customise builds. Emacs\u0026rsquo; malleability reminds me of the following classic xkcd6!\nReferences Sublime Build System\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nEmacs manual - Running compilation under Emacs\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nEmacs manual - Local Variables in Files\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nEmacs manual - Creating and Deleting Buffer-Local Bindings\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nEmacs manual - Per-Directory Local Variables\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nReal Programmers\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/emacs-custom-compilation/","summary":"One of the convenient things I quite like about Sublime Text is the easy to setup build system1. It is pretty easy to add a custom build setup with Sublime Text, to compile a single C++17 source file, for example. Once configured it is very efficient and keyboard friendly to compile and run a C++ program with a single key press, F7 with default key bindings.\nThis blog post is about how to configure Emacs in a similar vein.","title":"Emacs Custom Compilation"},{"content":"I thought about writing a short post on how I tend to capture bookmarks using org-mode1 these days.\nCapture template I have following org-capture template2, defined in my Emacs configuration file based on the Doom config3,\n;; Capture template (\u0026#34;l\u0026#34; \u0026#34;Daily Bookmarks\u0026#34; entry (file+headline (lambda () (personal-note \u0026#39;daily)) \u0026#34;Bookmarks\u0026#34;) \u0026#34;** %(org-cliplink-capture)%?\\n\u0026#34; :unnarrowed t) ;; Utility function (defun personal-note (ntype) (cond ((string= \u0026#39;daily ntype) (concat org-directory (format-time-string \u0026#34;/%Y/%B_%-e.org\u0026#34;))) ((string= \u0026#39;work ntype) (concat org-directory (format-time-string \u0026#34;/work/%Y/note_%m_%d.org\u0026#34;))) (t (error \u0026#34;Invalid personal note type: \u0026#34; ntype)))) Most important time saver in this capture template is the use of org-cliplink-capture functionality which is provided by the org-cliplink4 package.\nI tend to capture bookmarks on daily notes file, as can be seen from the above template. As an example, notes for today will be captured in a dedicated file $ORG_DIR/2020/April_8.org, where $ORG_DIR is the root directory for notes.\nWith this approach, bookmarks will be scattered on multiple note files. Using instead the file+olp+datetree capture method, one can maintain a single note dedicated to bookmarks, say $ORG_DIR/Bookmarks.org.\nI have set F9 as the org-capture shortcut with following key binding,\n(global-set-key [f9] \u0026#39;org-capture) Thus, capturing a bookmark link into the notes buffer is just two key presses: F9 + l.\nFollowing is how a sample bookmarked link looks like in my current setup.\nSince bookmarks captured in this method are simply org-mode text nodes, you can embellish entries in the same way as any other org-mode entry node.\nFollowing are some of the advantages of bookmarking in this manner instead of using an online service, such as pinboard5.\nContextual information Bookmarks with org-mode allow you to add context and accompanying notes to a bookmarking link (as can be seen in above example), which I find very valuable. Sometimes, I find peripheral things I learn from web resources are even more important than the links themselves. Org mode bookmarks, as captured via following template allows me to easily do just that.\nI add a bit of a background on things while I bookmark because it is so easy to do that, with Emacs, being a full fledged text editor. In fact, the capture template as I\u0026rsquo;ve defined above, gets me right into a prompt to add more details after inserting the link to the Emacs buffer.\nLink tags Org-mode supports tags6 and they are quite powerful. It is pretty easy to set tags while capturing a new bookmark via Emacs. Tags can be used to filter bookmarks on based on topics. For example, all bookmarks links with the tag agda can be searched quite easily with org-mode.\nData ownership Notes in org-mode is just plain text. Thus bookmark data is portable across operating systems with almost no risk of getting locked into a proprietary data format.\nFast local search Emacs can filter and find bookamrked links very quickly using tools such as helm7 or ivy8. Also one can classic POSIX tools such as grep and other text processing tools to locate and filter bookmarks.\nGoing a one step further, one can setup indexed local search for org-mode note files for even faster and more precise search experience. I have used recoll9 on Linux for such a setup in the past.\nLimitations of this approach Just as the advantages of this bookmarking approach is parallel to the advantages of using org-mode in general, the disadvantages are pretty much the same as general limitations of org-mode ecosystem.\nLack of good mobile support10 - after not finding a good mobile org-mode solution, what I tend to do is to capture one off links while browsing from phone to a temporary note on Google Keep. Separate synchronisation solution - I use Dropbox to sync notes between computers. With Emacs and org-mode, syncing is something separate you have to think about. Lack of sharabilty - online bookmarking tools often provides a way to share your bookmarks within the service itself, i.e. without the need to export to a different format. But with the method I\u0026rsquo;m describing here, you cannot easily share your bookmarks without exporting only parts of your notes you might want to share. I wanted to write more on making a case for using offline bookmarks, but then I realised that the case for this is same as making a case for why I\u0026rsquo;m using org-mode for note taking - and there are many other posts around the internet making that case. So, in the end I decided to keep the post very short just describing the capture template which I find very useful.\nLinks Org mode\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nCapture templates - Org mode manual\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nMy current Emacs configuration is based on Doom Emacs. However, the capture template is fairly standard and should be portable on recent org-mode setups.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\norg-cliplink. Note that org-cliplink does not come packaged with the default Doom configuration. You will need to add org-cliplink as an additional package.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nPinboard - Social bookmarking for Introverts\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nTags - org-mode manual\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhelm - Emacs incremental completion and selection narrowing framework\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nivy - a generic completion frontend for Emacs\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nRecoll is a desktop full-text search tool\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nIn the past when I looked at using org-mode on the phone, none of the apps I tried could handle the large notes repository I had. Things might have gotten better in the meantime.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/bookmarking-with-org-mode/","summary":"I thought about writing a short post on how I tend to capture bookmarks using org-mode1 these days.\nCapture template I have following org-capture template2, defined in my Emacs configuration file based on the Doom config3,\n;; Capture template (\u0026#34;l\u0026#34; \u0026#34;Daily Bookmarks\u0026#34; entry (file+headline (lambda () (personal-note \u0026#39;daily)) \u0026#34;Bookmarks\u0026#34;) \u0026#34;** %(org-cliplink-capture)%?\\n\u0026#34; :unnarrowed t) ;; Utility function (defun personal-note (ntype) (cond ((string= \u0026#39;daily ntype) (concat org-directory (format-time-string \u0026#34;/%Y/%B_%-e.org\u0026#34;))) ((string= \u0026#39;work ntype) (concat org-directory (format-time-string \u0026#34;/work/%Y/note_%m_%d.","title":"Bookmarking with org-mode"},{"content":"Minimising digital footprint and reducing distractions has been a topic I am interested in for a while now. In that backdrop, I recently came across a book which resonated with me, Digital Minimalism, from Cal Newport.\nWhat is digital minimalism? Cal Newport defines digital minimalism as follows1,\nA philosophy of technology use in which you focus your online time on a small number of carefully selected and optimized activities that strongly support things you value, and then happily miss out on everything else.\nWhy aim for digital minimalism? Maintaining an always on online presence can be huge energy drain, not necessarily physically, but mentally. From personal experience, even passively consuming reddit and Hacker News2 is definitely a big time drain, which I try to be more conscious about these days.\nPersonal strategies Being topical Reddit and hacker news have been few of the main sources for technical news for me. But these days I try to limit the time spent on those web sites by following some of the strategies outlined below.\nBeing topical - limit browsing to a select number of to topics I\u0026rsquo;m interested in at a particular time. These days it is mostly subreddits on Rust, Linux, Haskell and a few other niche topics like Emacs. I actively try to limit to subreddits with high signal-to-noise ratio, which rules out most of the sporting subreddits, some of which I used to follow closely!\nReading books Allocating more of the leisure time to reading books. These days I like to have a couple of books reading at the same time on different topics so that there is more choice to switch within books instead of going back to something like reddit for amusement.\nUnlike with link aggregation services, it is easier to stay focused on a book even on an electronic device like Kindle because you are essentially limited.\nLimiting tools There were many services and tools which I used to use in the past but which I have given up in the name of simplicity. This varied from note taking apps such as Evernote to goal tracking tools such as Trello3 and Beeminder4. All of them are very useful tools, but I have found simpler alternatives which I do not have to stay connected to use as their replacement5.\nProblem with using too many tools is that you spend too much time on housekeeping these tools than actually getting things done! At least this has been my personal experience.\nI\u0026rsquo;m sure with better integration into one\u0026rsquo;s lifestyle habits most of these tools could be a net positive.\nLimiting social media Since I have never been much of a social media user, not regularly using popular social sites has not been a problem for me. Even though I still keep a facebook account, these days it is mostly as the last point of contact than actually to keep up to date with relatives, friends and acquaintances.\nLess distracting phone usage I find phone to be quite distracting as well and thus try to minimise its usage as much as possible as well. For example, at work times I tend to keep the phone in the backpack at most times to not even have it at arms length to check for notifications. This is a conscious choice to have the possibility of even missing a call once in a while!\nAlso using a flip phone cover makes it a bit more difficult to see notifications since I have to open the cover to see the screen.\nDownsides of my choices Not keeping up to date on social networks definitely has downsides. Sometimes I find that I\u0026rsquo;m years behind when it comes to updates from people. All of a sudden you find that one of your best friends (who\u0026rsquo;s in a different country) even has a kid now! This can be a serendipitous discovery. Also when you meet them in person you can be actually interested in them in real life because most of the things are new to you since you last met them.\nI\u0026rsquo;m pretty sure there\u0026rsquo;s a better middle ground than the position I tend to exercise. For example, having a dedicated time period to check those platforms once in a while, would be better than complete cut off in many ways.\nRecommended read As Cal Newport discusses in the book, individual solutions are going to be invariably personal. What works for me is not necessarily going to work for you, and as outlined above, some of my practical strategies might sound silly and draconian to you.\nThe point is that digital tools are just tools - some means to an end. The means of achieving control is not that important as much as the end goal (which could be anything!). Thus, it really does not matter all that much how you use them as long as you manage to find the balance between productivity and value from the tools which works for you. It helps to be flexible, adaptive and also honest when it comes to technology.\nI think, the book, Digital Minimalism, manages to get that idea across pretty well. The book talks about finding a balance without preaching the author\u0026rsquo;s point of view. The solutions offered are not groundbreaking, but at the same time I think it is a worthy topic to explore further; thus a recommended read.\nCal Newport, Digital Minimallism, pp. 35\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nhttps://news.ycombinator.com\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nTrello is a really good project management tool which I can highly recommend.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nBeeminder for quantified self practitioners, Beeminder can be an indispensable tool.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nEmacs org-mode\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/digital-minimalism/","summary":"Minimising digital footprint and reducing distractions has been a topic I am interested in for a while now. In that backdrop, I recently came across a book which resonated with me, Digital Minimalism, from Cal Newport.\nWhat is digital minimalism? Cal Newport defines digital minimalism as follows1,\nA philosophy of technology use in which you focus your online time on a small number of carefully selected and optimized activities that strongly support things you value, and then happily miss out on everything else.","title":"Digital Minimalism"},{"content":"Rust is quite an exciting programming language from two points of views for me. On one hand there\u0026rsquo;s strong influence from functional programming lanugages, such as OCaml, in Rust to feel like an expression oriented language with pattern matching1, algebraic data types2 etc.\nThen there\u0026rsquo;s also the focus on zero cost abstractions3 in Rust which makes it possible to be competitive with C/C++ when it comes to performance4. Even though C++ is no longer a stagnant language, Rust is increasing a very good option already where former is dominating currently, at the very least for greenfield projects.\nThus playing with and learning Rust has been in the back of my mind for quite some time now and I thought of documenting recipes and simple solutions to practical programming problems on the way in the form for a Gitbook, mostly for my own reference.\nI plan to go about the task of writing recipes based two approaches. One is to follow other well received cookbooks, such as Python Cookbook, and think about solving those problems in Rust in an idiomatic way. Then also I would like to focus on aspects of writing high performant and reliable backend services in Rust - the types of which Java or Go is used (at my current full time work, for example).\nWiki book is published at https://rust-book.dewaka.com. All code and source files for the book are open source and PRs are welcome for any inaccuracies or improvements.\nRust Pattern matching\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nRust Enums\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nZero Cost Abstractions\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nRound 18 of TechEmpower Web Framework Benchmarks\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/rust-cookbook/","summary":"Rust is quite an exciting programming language from two points of views for me. On one hand there\u0026rsquo;s strong influence from functional programming lanugages, such as OCaml, in Rust to feel like an expression oriented language with pattern matching1, algebraic data types2 etc.\nThen there\u0026rsquo;s also the focus on zero cost abstractions3 in Rust which makes it possible to be competitive with C/C++ when it comes to performance4. Even though C++ is no longer a stagnant language, Rust is increasing a very good option already where former is dominating currently, at the very least for greenfield projects.","title":"Rust Cookbook"},{"content":"Changing existing code in a software program is one of the most common things software programmers do in their day to day jobs. For a well maintained piece of code such as the Linux kernel the frequency of changes could be quite high, and pervasive changes touching a more than double digit source files are not that rare.\nPatch1 is a set of changes to a program. Patches, as shown in the following example, contains + indicating lines which are to be added and - indicating lines which are to be removed. Patches could be applied not just to source code, but also for data and configuration files as well.\n@@ -247,7 +247,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) block = \u0026amp;wblock-\u0026gt;gblock; handle = wblock-\u0026gt;handle; -\tif (!block-\u0026gt;flags \u0026amp; ACPI_WMI_METHOD) +\tif (!(block-\u0026gt;flags \u0026amp; ACPI_WMI_METHOD)) This patch, which is an actual bug fix in acpi drivers2, is fixing a subtle precendence issue with with the ! operator when uesd with bitwise operators. The intent here is to check if it is not an ACPI_WMI_METHOD, but the original experession (!block-\u0026gt;flags \u0026amp; ACPI_WMI_METHOD) is buggy. A simple fix is to parenthesise the whole expression so that we do negatiion after all bitwise operations, and that\u0026rsquo;s exactly what the above patch does in a speciffic source location as indicated in the preamble, which is the section between @@ symbols, of the patch.\nIn a kernel with millions of lines of code there high chance that bugs of similar nature will be present in more than one file or function. Fixing such bugs manually would be would be quite tedious since it is not even simple to identify all the places where there are similar issues. It is not that simple to write even a grep expression to find all such cases since simple source code search does not take into account C expressions and statements at a semantic level.\nTo generalise this patch to apply to all boolean checks following this pattern of usage we need to capture the semantics of intent of the change. That\u0026rsquo;s where semantic patches comes in.\nSemantic patches Semantic patches are a generalisation on the patches which captures the change at an intent level going beyond the source level.\nLet\u0026rsquo;s quickly examine how to express the semantic intent of the above (raw) patch. To fix this particular class of bugs what we want to do is to recognise source code in matching,\n!Expression \u0026amp; Constant To transform code to following form,\n!(Expression \u0026amp; Constant) Here, expression and constant have precise semantics in the C language3.\nCoccinelle Coccinelle is a program matching and transformation tool which applies semantic patches to C source code. This tool started its life as a patching tool for Linux kernel drivers, but now has been extended and improved to be used in any kind of C program.\nIn Coccinelle a semantic patch is given by the SmPL Patch language. A SmPL patch for the above change can be written as follows2,\n@@ expression E; constant C; @@ - !E \u0026amp; C + !(E \u0026amp; C) At a high level it is easy to see what we are trying to accomplish here. First we are interesting an expression which we capture with variable E and then we are also interested in a constant after the (literal) bitwise \u0026amp; operation which we captuer as C. Then other parts of the SmPL patch is similar to the original source level patch we showed before. In the semantic patch we substiture variables to make the patch generic and location independent. Thus the SmPL patch can be applied to any instance of this bug occurring in various source files.\nA SmPL patch is designed to mimic a raw patch from a syntactic standpoint so that it is easy to see what the patch intends to accomplish.\nSemantic patching pipeline When it comes to C programs Coccinelle transformations are applied as follows.\nProcesses C source code files one at at time ignoring header files. In a source file, Coccinelle then applies the rules on a C function level. Processing of a function is based on control-flow graph. This allows Coccinelle to be precisely detect early returns from a function, for example. Limitations of Coccinelle approach I think what made Coccinelle successful is the focus on what it is not as much as what it is. Concretely, it does not try,\nTo be a static analysis tool - Coccinelle does not do alias analysis or other dataflow analysis. Only best case support for type inference - Coccinelle by default does not process headers and thus does not have complete type information. Lenient and fast parsing There are other optimisations which Coccinelle does to make it a usable and pragmatic tool used by possibly hundreds (or thousands?) of developers. Coccinelle has been quite successful in making an impact on Linux kernel development. Over 6000 commits mention Coccinelle in their commit messages4. This paper, Coccinelle: 10 Years of Automated Evolution in the Linux Kernel to get a perspective on Coccinelle\u0026rsquo;s evolution and impact on Linux kernel development in the last 10 years.\nCoccinelle for Java Coccinelle4J4 is a project on applying the techniques learnt from a decade of research and engineering on transforming C programs, to Java programs. Even though syntactically C and Java belong to the same family, advanced type system and object oriented nature of Java brings its own challenges.\nYou might be wondering aren\u0026rsquo;t IDEs like IntelliJ IDEA5 already pretty good at refactorings? But Coccinelle enables more complex refactorings since you even have support for scripting to make complex decisions whether to apply a patch or not, as in the following example from paper6, which removes spurious semicolons after if header.\n@r@ expression E; statement S; position p1,p2; @@ if@p1 (E); S@p2 @script:python@ p1 \u0026lt;\u0026lt; r.p1; p2 \u0026lt;\u0026lt; r.p2; @@ if (p1[0].col \u0026gt;= p2[0].col): cocci.include_match(False) @@ expression E; statement S; position r.p1; @@ if@p1 (E) - ; S I was quite impressed when I learned about Coccinelle and its impact on the evolution on the Linux kernel and I would like to end the this post with a quote from a Linux kernel developer7,\nCoccinelle is one of those schizophrenic projects situated on the boundary between academic research and practical software development.\nFootnotes GNU diffutils - Comparing and Merging Files\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nExamples are from - Inside the mind of a Coccinelle programmer\u0026#160;\u0026#x21a9;\u0026#xfe0e;\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nC Standard\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nSemantic Patches for Java Program Transformation\u0026#160;\u0026#x21a9;\u0026#xfe0e;\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nIntelliJ IDEA Refactoring\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nCoccinelle: 10 Years of Automated Evolution in the Linux Kernel\u0026#160;\u0026#x21a9;\u0026#xfe0e;\nSemantic patching with Coccinelle\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/blog/semantic-patching/","summary":"Changing existing code in a software program is one of the most common things software programmers do in their day to day jobs. For a well maintained piece of code such as the Linux kernel the frequency of changes could be quite high, and pervasive changes touching a more than double digit source files are not that rare.\nPatch1 is a set of changes to a program. Patches, as shown in the following example, contains + indicating lines which are to be added and - indicating lines which are to be removed.","title":"Semantic Patching with Coccinelle"},{"content":"I thought of putting a bit of pressure on myself by making a list of goals public. Some of the goals, such as the reading target, I\u0026rsquo;ve already managed to reach last year, but some, like writing, I\u0026rsquo;ve found quite difficult to stick with in the past. Those are the kind of goals which I want to do better this year!\nReading Books I\u0026rsquo;m tracking reading progress in Goodreads Reading Challenge. Number of books read is not a good metric if one is interested to improve the quality of reading, but it\u0026rsquo;s an easily trackable one. Papers My goal is to read and take notes of a minimum of 5 papers a month. I will be publishing the rough notes in the wiki on papers. These notes are are expected to be rough around the edges, since they are written to an audience of one, namely, myself. I\u0026rsquo;m interested in using the Feynman technique for learning things this year and wiki notes are a good way to experiment for this end. Writing Blog posts I hope to write about an intersting paper as a blog post based on the wiki notes. Goal is to write at least one blog post per month. Wiki updates I\u0026rsquo;ve found that GitBook1. format is really useful for keeping technical notes in wiki format. I hope to keep this practice mostly as a brain dump for later reference. Coding Given that most of my coding will be in the work enrvironment, it is hard to come up with concrete goals for personal projects which I have a realistic goal of commiting to and sticking with. That said, there are a couple of areas I would like to focus on this year,\nSystems programming Deep dive into JVM performance landscape There a couple of books I would like to go through this year, such as - Java Concurrency in Practice, Effective Java Programming Language Guide2. and Java Performance: The Definitive Guide. Playing with GC algorithms and knobs to get a better understanding of their various tradeoffs Practical JMH benchmarking Native coding with Rust and C++ With C++ the goal is mostly to keep the knowledge up to date With Rust there\u0026rsquo;s so much to explore with many exciting possibilities! Functional programming - I\u0026rsquo;m going to use functional programming in the most broad sense here, Scala - there are many interesting libraries I\u0026rsquo;m looking forward to play with and also to play with. Scala 3 (Dotty) new language features look quite exciting as well. Keeping up with Haskell research papers. Software verification - this is very broad topic which I have a strong interest in. On this front it would be aspirational for me to finish with practical coding Practical TLA+: Planning Driven Development. Other technical/maths books I\u0026rsquo;d like to go through this year, A Programmer\u0026rsquo;s Introduction to Mathematics by Jeremy Kun Elements of Programming by Alexander Stepanov Activities Running Keep up to the same level or do better than last year would be my goal this year for running! Hiking Last year was a very productive and fun hiking year for me. I\u0026rsquo;m running out of intermediate to advanced one day hikes from groups like Outdooraholics which I haven\u0026rsquo;t done before! However, I still hope to do at least 5 one day hikes this year. These goals are by no means exhaustive and I also might update the goals on areas I would like to focus more on as the year progress.\nI hope to update the progress on these goals in wiki logs and new things I learn (and mistakes I make) in til entries.\nFootnotes 1 - GitBook 2 - For the second time ","permalink":"https://dewaka.com/blog/new-year-resolutions-2020/","summary":"I thought of putting a bit of pressure on myself by making a list of goals public. Some of the goals, such as the reading target, I\u0026rsquo;ve already managed to reach last year, but some, like writing, I\u0026rsquo;ve found quite difficult to stick with in the past. Those are the kind of goals which I want to do better this year!\nReading Books I\u0026rsquo;m tracking reading progress in Goodreads Reading Challenge.","title":"New Year Resolutions (2020)"},{"content":"Notable Books I had a pretty productive year when it comes to reading. Following are some of the notable books from the ones I read this year.\nPoetry Mary Oliver\u0026rsquo;s poetry was one of the best discoveries for me this year. I ended up reading about five poetry collections from her and I liked all of them. Among the collections, Felicity, House of Light and Red Bird contaied some of the favourite poems by her. Native Guard - Another stellar poetry collection which left a mark in my mind, especially to learn about a dark period in American history, as in the titular poem of the collection. Delights and Shadows - One of the best books of poetry I\u0026rsquo;ve read this year. Definitely worth reading a couple of times more! The Selected Poems of Donald Hall - Some heartwrenching poems on loss. Poems on nature and the craft of poetry itself are not shabby either. Science and Science fiction Brief Answers to the Big Questions by Stephen Hawking - This is a compilation of essays after his passing. Hawking has a knack for explaining difficult concepts lucidly and this compilation is no exception. Brave New World - A long awaited read for me. Thought provoking book on future and life itself. The Woman in the Dunes - A deceptively simple tale of a man being kept captive is one of the best existential novels I\u0026rsquo;ve read thus far. The Invention of Morel - This short novella provides a lot of food for thought on reality. Novels Snow - A powerful story about love, religion, freedom and poetic expression. Looking forward to read other novels by him! The Virgin Suicides - I have not seen the film, but it has been on my to watch list for a while. So, I was extra keen to read the book first and I hooked to the story pretty quickly. I felt like at times I was one of them wanting to know about the girls in the story, and perhaps rescue them. Ham on Rye - Although I\u0026rsquo;m not the biggest fan of Bukowski\u0026rsquo;s writing style, or for that matter his subject matter, I quite liked Ham on Rye novel. He does have a knack of delivering truths about human nature which shines through at times and nobody can accuse of him not being genuine which is an admirable quality! Laughable Loves - This is the first book I read by Milan Kundera and I enjoyed the short stories very much. Looking forward to read his more celebrated works such as The Unbearable Lightness of Being. Rashōmon and Seventeen Other Stories - I was surprised how short the Rashōmon story was having seen the film a while ago. There are many other equally intersting and throught provoking stories by Akutagawa in this collection. Philosophy The Bhagavad Gita - I really liked the accessible translation by Eknath Easwaran. One does not have to have a background in Hindu philosophy to read and get the most out of this translation, although in my case I was familiar with most of the Hindu concepts due to closely shared background from Buddhism. How to Be Free: An Ancient Guide to the Stoic Life - This is a new translation of Epictetus\u0026rsquo;s handbook on Stoicism. Blog posts The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets - this a post I will keep coming back to. Music Following are some frequent listens this year which broke trends from past years but not necessarily new music for me,\nTom Waits - Another late discovery for me! Kate Bush - I think it is only this year that I\u0026rsquo;ve come to really appreciate her music. Big big fan of Hounds of Love album. Joni Mitchell - Cannot pick a favourite album! Late For The Sky - A timeless album. Gabriel Fauré - Cello Works1 are my favourites thus far. Norman Fucking Rockwell! - Quickly becoming my favourite Lana Del Rey album thus far! Melody Gardot - Another perfect choice if I\u0026rsquo;m in the mood for Jazz! Anoushka Shankar - I discovered her through Norah Jones colloborations. Frank Ocean - Blonde was one of the top listens for me this year. I\u0026rsquo;m 3 years late to the party! Brandi Carlile Videos The Marvelous Mrs. Maisel - It was quite easy to like this series from Amazon for me. The Big Bang Theory - This was a nostalgic rewatch for me, except from 9th season onward. It was nice to see the episodes with Stephen Hawking and the fun side of him. GM Hikaru - I think I spent more time watching Chess videos on Youtube than TV series or films combined! GM Hikaru\u0026rsquo;s streams are quite entertaining as well. And there\u0026rsquo;s always something an amateur player like me can learn from his play as well, although I do not think watching a super-GM play rapid games is the best way to improve at amatuer level. GM Matthew Sadler - Another superb Chess channel in YouTube. I especially enjoyed his expositions on Stockfish vs AlphaZero play. It was amazing to see AlphaZero outwit a finely tuned Chess engine like Stockfish sometimes in a very dominating fashion like a boa constrictor. If Stockfish had feelings, it must have felt like human players playing against itself! Programming Although none of the following languages are new to me, I enjoyed using them in various contexts,\nProlog - Playing with Logic programming after a long time was quite fun. Rust - Rust ticks a couple of boxes for me to keep intersted to explore further in coming year. Safe systems programming where it has a real chance to be an alternative to domains currently dominated by C/C++. Fearless concurrency2. cargo is a breath of fresh air compared to C++ build systems I\u0026rsquo;ve used in the past. I only wish Haskell had such a stellar build tool (although stack is pretty good)! Clojure - Got a chance to play with Clojure Spec3 which is an EDSL to express constraints which are difficult to expressed in types themselves. Links 1: Fauré - Complete Cello Works (Spotify) 2: Rust - Fearless Concurrency 3: Clojure Spec ","permalink":"https://dewaka.com/blog/notable-discoveries-in-2019/","summary":"Notable Books I had a pretty productive year when it comes to reading. Following are some of the notable books from the ones I read this year.\nPoetry Mary Oliver\u0026rsquo;s poetry was one of the best discoveries for me this year. I ended up reading about five poetry collections from her and I liked all of them. Among the collections, Felicity, House of Light and Red Bird contaied some of the favourite poems by her.","title":"Notable discoveries in 2019"},{"content":"For Want of a Nail I thought it would be fun to translate a poem, For Want of a Nail which has an interesting history1 which I came across while reading about The Five Whys2 technique. The version of the poem reproduced in this post is attributed to Welsh poet George Herbert3.\nThis is a poem which illustrates The Five Whys analysis to find the cause-and-effect relationship underlying a problem in an easy to remember form. Since the verses are quite simple, it is the kind of poem one can easily encode in Prolog as logical rules.\nPoem For want of a nail the shoe is lost; For want of a shoe the horse is lost; For want of a horse the rider is lost; For want of a rider the battle is lost; For want of a battle the kingdom is lost; And all for the want of a horseshoe nail. - George Herbert In Prolog To translate the poem for Prolog we can start with the facts in this poem. This story is very simple as it is only talking about a single incident type: loosing something because of something else. We can easily encode this information using a single predicate, itemlost_becauseof, as shown below.\nFacts itemlost_becauseof(shoe, nail). itemlost_becauseof(horse, shoe). itemlost_becauseof(rider, horse). itemlost_becauseof(battle, rider). itemlost_becauseof(kingdom, battle). Predicates write_poem(ItemLost) :- write_poem_aux(ItemLost); write_last_line(ItemLost). write_poem_aux(ItemLost) :- itemlost_becauseof(Impacted, ItemLost), write_line(ItemLost, Impacted), write_poem_aux(Impacted). write_line(Item, Impacted) :- write(\u0026#34;For want of a \u0026#34;), write(Item), write(\u0026#34; a \u0026#34;), write(Impacted), write(\u0026#34; was lost;\u0026#34;), nl. write_last_line(Item) :- write(\u0026#34;And all for the want of a \u0026#34;), write(Item), write(\u0026#34;.\u0026#34;), nl. To get the full poem4, we can ask Prolog - write_poem(nail). Nice thing about encoding the poem in Prolog is that we can get parts of the poem just as easily. For example, to see the impact of a lost horse - write_poem(horse), which will produce the following poem!\n?- write_poem(horse). For want of a horse a rider was lost; For want of a rider a battle was lost; For want of a battle a kingdom was lost; And all for the want of a horse Finding root cause We can use following predicates for root cause analysis from the facts database.\nloss_rootcause(ItemLost, Cause) :- itemlost_becauseof(ItemLost, Z), loss_rootcause(Z, Cause), !. loss_rootcause(ItemLost, Cause) :- itemlost_becauseof(ItemLost, Cause). item_impacted(Cause, ItemLost) :- itemlost_becauseof(ItemLost, Cause). item_impacted(Cause, ItemLost) :- itemlost_becauseof(ItemLost, X), item_impacted(Cause, X). With the loss_rootcause predicate, we can check whether the bard was correct in contending that, ultimately, a lost horse-nail was responsible for the fall of the kingdom, and indeed that is the case, as Prolog confirms for the following query.\n?- loss_rootcause(kingdom, RootCause). RootCause = nail. We are using a Red Cut5 in the definition of loss_rootcause predicate since we want Prolog to stop looking for alternatives if it cannot unify to end up with the root cause for a given failure situation. This cut basically makes Prolog find the first Domino which fell down to cause the cascading failures.\nFor impact analysis, we can also use forall6 predicate from Prolog built-ins, to get a list of all the items impacted by a given item.\n?- findall(X, item_impacted(nail, X), NailImpacted). NailImpacted = [shoe, horse, rider, battle, kingdom]. All code used for this post can be found here - For Want of a Nail.pl.\nFootnote Annotated names, such as the nail =\u0026gt; horse-nail, can be written with the use of another predicate as follows.\nannotated_name(nail, horse-nail). annotated_name(X, X). write_annotated(X) :- annotated_name(X, Annotated), write(Annotated). Then we can modify the write_last_line as follows to get a more faithful reproduction of the poem.\nwrite_last_line(Item) :- write(\u0026#34;And all for the want of a \u0026#34;), write_annotated(Item), write(\u0026#34;.\u0026#34;), nl. Annotations are a set of predicates which matches a given item to a more embellished version. For example, we can add an embelishment for the rider with annotated_name(rider, 'brave rider'). With the updated database, the last line of a poem starting with the rider would be - \u0026ldquo;And all for the want of a brave rider.\u0026rdquo;, and so on.\nReferences 1: For Want of a Nail 2: The Five Whys 3: George Herbert 4: Last line is not a verbatim reproduction since the original poem contains an embelishment which is beyond the scope of this (silly) exercise 5: Logic Programming Red Cut 6: forall - SWI Prolog documentation ","permalink":"https://dewaka.com/blog/a-poem-in-prolog/","summary":"For Want of a Nail I thought it would be fun to translate a poem, For Want of a Nail which has an interesting history1 which I came across while reading about The Five Whys2 technique. The version of the poem reproduced in this post is attributed to Welsh poet George Herbert3.\nThis is a poem which illustrates The Five Whys analysis to find the cause-and-effect relationship underlying a problem in an easy to remember form.","title":"A Poem in Prolog"},{"content":"I have been keeping org-mode1 notes on a daily basis for a couple of years now. I started keeping journal notes with Evernote around 2012, but soon got disillusioned on proprietary formats for keeping notes, especially given that I pretty much hate to use any text interface without good Vi key bindings.\nAfter learning about the power, flexibility and simplicity of org-mode with Emacs, which does have a pretty good Vi mode2, I transitioned to use org-mode for journal notes exclusively.\nEven though these notes are source controlled, they are not in a public repository and I realised that there are probably some notes which might be useful for others as well.\nStarting a public Wiki One of the primary reasons for starting a wiki is the fact that I found most of the blog posts I want to write are better served in a wiki format. Wikis have following advantages compared to often static blog posts,\nEditability and version history - A wiki by its very nature is supposed to be a living document updated with new information when they get outdated. Extensibility - Since the wiki source is public, which is in my case, even others can fork the repository and fix/correct errors in the wiki easily with a git work flow. Better discoverability - Wiki is organised around topics with articles inter-linked for related concepts. Blog posts on the other hand are not organised around topics and not so well inter-linked considering that old blog posts rarely changed to link to newer blog posts. Narrow focus - As someone who\u0026rsquo;s just starting to write publicly, I like the narrow focus of a wiki article compared to the open ended nature of a blog post. I can write about even the most trivial thing as a wiki article without too much self reflection on the fact that whether this really deserves writing a blog post about! A wiki would be a good way to organise knowledge and know hows in a personalised way. The point of a personal wiki in my mind is not to be an exhaustive source of information, a la Wikipedia, but to organise information as one learns things on a daily basis. This information while not exhaustive or even authoritative, is pretty useful for recall, and incidentally, might be useful for others as well.\nGitBook Integration There are plenty of personal wiki software, but I wanted to find something which can be integrated with my existing blog easily. I followed the excellent wiki by Nikita Voloboev. Nikita\u0026rsquo;s wiki is the primary source of inspiration for starting a wiki on my own, especially when it comes to the format and the hosting option.\nI signed up with GitBook with their Github integration. The interface for setting up a new book is pretty simple. GitBook has the option to link the book to a Github repository. Source for the new wiki is at Personal knowledge wiki in my case.\nGitBook also enables serving via a custom sub-domain and it thus was quite painless integrate it with this domain at wiki.dewaka.com.\nEven though I much prefer org-mode considering most of my writing is done via Emacs these days, I\u0026rsquo;m fine with Markdown format. In fact Markdown has much better support in a wider variety of tools compared to org-mode which is mostly used within the Emacs ecosystem. Also there\u0026rsquo;s pandoc3 for converting my existing notes to Markdown format should I so choose.\nPlans for the Wiki I plan to distil some of my personal notes into a these wiki articles for my own use and others who might find useful. For example, there are many things in day to day work or in my own explorations I learn and I want to remember for later use. It could be as simple as a Vim trick, or something like a programming language concept.\nResources 1: org-mode - Org mode is for keeping notes and more! 2: evil-mode - Evil is an extensible vi layer for Emacs 3: Pandoc - A Universal Document Converter ","permalink":"https://dewaka.com/blog/starting-a-personal-wiki/","summary":"I have been keeping org-mode1 notes on a daily basis for a couple of years now. I started keeping journal notes with Evernote around 2012, but soon got disillusioned on proprietary formats for keeping notes, especially given that I pretty much hate to use any text interface without good Vi key bindings.\nAfter learning about the power, flexibility and simplicity of org-mode with Emacs, which does have a pretty good Vi mode2, I transitioned to use org-mode for journal notes exclusively.","title":"Personal Wiki"},{"content":"Vim in IntelliJ IDEA IDEA is one of the IDEs with relatively good support for Vim with the IdeaVim Plugin2. Even though one can come close to functionality offered by IntelliJ with either Vim or Emacs Plugins, I find that IntelliJ IDEA is a must have for Scala development, in my experience. However, with IdeaVim Plugin you can still get the best of both world\u0026rsquo;s by leveraging your Vim editing muscle memory via IdeaVim plugin.\nIdeaVim can be customised in a similar way to Vim by editing a configuration file: ~/.ideavimrc.\nI would refer to my current config file to get the full details2, but following are some of the more useful settings to bring the experience closer to full Vim capabilities.\n\u0026quot; Emulated Plugins set surround \u0026quot; Use Idea to join lines smartly set ideajoin \u0026quot; Copy to system clipboard as well set clipboard+=unnamed \u0026quot; Multiple cursors support set multiple-cursors Vim surround enables support for popular vim-surround support3. ideajoin is a recent setting which emulates IntelliJ\u0026rsquo;s builtin line join semantics when you use Vim commands to join lines, such as J. As with Vanilla Vim, by default, yanked text will not be put in to system clipboard. However, it is quite handy to have consistent behaviour when it comes to copying as if you didn\u0026rsquo;t use IdeaVim in the first place. With clipboard+=unnamed setting, text you copy within IDEA will also be copied to the system clipboard. My settings are quite tailor made to my work setup, so it wouldn\u0026rsquo;t be a good idea to copy them verbatim. I would suggest taking useful settings from there for your own personalised setup. That is also what I\u0026rsquo;ve done from multiple sources, some of which I\u0026rsquo;ve referenced in comments in the config file itself.\nFinding out available actions To get a list of available actions which you can bind keys for, run the following command in normal mode in IDEA after enabling IdeaVim plugin.\n:actionlist This command is pretty useful to extend key bindings because IntelliJ Plugins actions are also avaialble via a unified action system.\nSummon real Vim for quick edits Inevitably you\u0026rsquo;ll find that IdeaVim, though really good, does not really support all the myriad advanced ways you do ediging in vanilla Vim. For those times, I recommend adding a leader key binding as follows to open a Vim instance.\n\u0026quot; External GVim nmap \u0026lt;leader\u0026gt;v :action Tool_External Tools_gvim\u0026lt;cr\u0026gt; Interested readers can find my current .ideavimrc file here.\nFor this binding to work, first you will need to setup gvim as an external tool.\nSetting up GVim as an external tool in IDEA Make sure to tick the setting for Synchronize files after execution setting as shown above in the settings window image.\nI find that this is pretty useful for doing block edits in Vim which I\u0026rsquo;m more used to than doing them in IntelliJ editor.\nI have used similar settings for MacVim on macOS and Windows GVim as well, although in the latter case I have not tested Vim client-server behaviour. This is a simple usability improvement to reuse existing Vim instance for multiple files opened via IntelliJ.\nFor ease of copying, here\u0026rsquo;s the full command.\n--servernaem IdeaVim --remote-silent \u0026quot;+call cursor($LineNumber$, $ColumnNumber$)\u0026quot; \u0026quot;$FilePaths$\u0026quot; Resources 1: IdeaVim 2: Personal .ideavimrc 3: Vim Surround ","permalink":"https://dewaka.com/blog/customising-ideavim/","summary":"Vim in IntelliJ IDEA IDEA is one of the IDEs with relatively good support for Vim with the IdeaVim Plugin2. Even though one can come close to functionality offered by IntelliJ with either Vim or Emacs Plugins, I find that IntelliJ IDEA is a must have for Scala development, in my experience. However, with IdeaVim Plugin you can still get the best of both world\u0026rsquo;s by leveraging your Vim editing muscle memory via IdeaVim plugin.","title":"Customising IdeaVim"},{"content":"I have been eyeing to change the default shell from Zsh to Fish shell for a while now, but never made the transition because I missed a couple of power tools and configurations which didn\u0026rsquo;t work in the quite the same way on fish.\nAfter giving fish shell configuration another go, I found that I could configure fish to match the functionality of my current zsh configuration with some new features and niceties which comes with a modern shell.\nThis post is about how I went about configuring fish shell for my usage patterns.\nInstalling and managing fish plugins Fish shell comes with powerful autocompletion and other conveniences out of the box without the need for extensive configuration from the user. There are plugins to extend the functionality even further, and two most popular ones for fish seems to be,\noh-my-fish fisherman Of the two fisherman seems to be more minimalist, focusing on providing a package manager for fish plugins. Thus after installing fisherman you are required to install plugins of your choosing. It also seems that the impact on shell startup time with fisherman is lower than with oh-my-fish, but this is not something I have benchmarked myself.\nAs of this writing, I have installed following plugins with fisherman, but if you choose oh-my-fish the same plugins are available as well.\nManaging plugins with fisherman Update plugins - fisher update Remove a plugin - fisher rm \u0026lt;plugin name\u0026gt; If you want to get rid of fisherman plugin manager itself - fisher self-uninstall Integrating fzf Installing fish fzf is pretty easy - fisher fzf. Note that for this plugin to work you should have already installed fzf tool itself.\nFZF is a powerful fuzzy filtering tool. Till version 2.6 fish shell had issues with fzf, and that was the main reason I held up transitioning to fish as I am a heavy user of fzf for filtering directories and files. With the 2.7 version I\u0026rsquo;m using now, those issues seems to be fixed and I have been able to replicate most of the useful functions for fish shell as well.\nThere are couple of differences worth noting,\nFish shell does not support fuzzy glob expansion - with zsh or bash, you can press Tab on command line after entering \u0026gt; ~/Dropbox/** and fzf would give you filtering based on the path you entered before the glob **. This does not work in the same way on fish, but you can get the same functionality by just pressing Ctrl+T after entering part of the path.\nMake sure that your $FZF_DEFAULT_OPTS variable contains options in a format which is valid for the fish shell. This is something I had to debug to fix because I had an old config option which was set for zsh, but invalid for fish shell. If you see error or warning messages when you run fzf completion commands, then it is a good idea to check this environment variable, and probably set it to a simple value in your fish config file (usually at ~/.config/fish/config.fish)\nIntegrating fasd I have written about integrating fasd with respect to zsh integration - [Using Fasd for Command Line Navigation]({% post_url 2018-02-07-fasd-for-navigation %}). Fasd works in the same way with fish shell as well.\nInstalling fish fasd plugin is pretty easy - fisher gretel/fasd. Please follow instructions to install fasd for your OS.\nWith fzf we can make directory switching even more awesome. Default behavioiur for d command which is provided by fasd does not give ability to filter output if there are multiple matches. We can utilise fzf to get that behaviour with the following function.\n# Function to filter through recently used directories function zd --argument-names \u0026#39;name\u0026#39; set -l zd_command \u0026#34;command fasd -Rdl $name 2\u0026gt; /dev/null\u0026#34; fish -c \u0026#34;$zd_command\u0026#34; | __fzfcmd -1 -0 --no-sort -m | read -la select if test ! (count $select) -eq 0 cd \u0026#34;$select\u0026#34; end end # Set above function to even shorter j alias alias j \u0026#34;zd\u0026#34; Cleaner prompt fish pure prompt provides popular pure shell prompt in zsh for the fish shell. This can be installed with fisher as follows - fisher rafaelrinaldi/pure\nSome thoughts One thing I tried to port from my zsh config was backgrounding and foregrounding of Vim in a terminal with the same key combination - Ctrl+Z. After a bit of research, I found that, as of now it, is not possible to assign Ctrl+Z for this functionality with the fish shell.\nZsh completion is quite nice, but fish has even better completion! I quite like how fish offers completions based on history and they are most of the time the right one as well which I want to run.\nFish shell seems to start a bit faster than zsh for me, which could be due to my zsh configuration! This is not a major point, but fish shell feels a bit snappier overall.\n","permalink":"https://dewaka.com/blog/fish-shell-configuration/","summary":"I have been eyeing to change the default shell from Zsh to Fish shell for a while now, but never made the transition because I missed a couple of power tools and configurations which didn\u0026rsquo;t work in the quite the same way on fish.\nAfter giving fish shell configuration another go, I found that I could configure fish to match the functionality of my current zsh configuration with some new features and niceties which comes with a modern shell.","title":"Configuring Fish Shell"},{"content":"Global command1 is a very powerful, and a little under-utilised command from my personal usage. Global command offers a powerful, composable alternative to macros.\nUse cases Usefulness of global commands is best explained through some practical examples.\nUsing Vim global command to increment numbers \u0026lt;inventory\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Coffee\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;230\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Sugar\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;280\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Tea\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;120\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; ... \u0026lt;/inventory\u0026gt; Let\u0026rsquo;s say you have an XML file which looks as above, and you want to increase the price of the items by 100 each. There are couple of ways to do this in Vim.\nManually edit - this is the simplest and most straightforward way to go about this task, however it is not practical esp. if the file is a large one. Use Vim macros - this can be far more efficient than the editing manually. Vim macros are quite powerful and you can explicitly do that. Use multi-cursors2 - this is also a powerful option, might be more familiar to power users of Sublime Text, for example. Use a global command - see below! Vim provides a way3 to increment or decrement numbers in a buffer, by pressing Ctrl+a and Ctrl+x, respectively. As with other commands you can prepend such a command by a number to specify how many times it should be repeated - thus, to increment a number 100 times, you will press 100Ctrl+a in normal mode.\nWhat if there is a way to go to each price value, and repeat 100Ctrl+a command? Global command provides exactly, that capability as shown below.\n:g/price/normal 100^A Now all the prices in the file should be incremented by 100, as follows.\n\u0026lt;inventory\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Coffee\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;330\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Sugar\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;380\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Tea\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;220\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; ... \u0026lt;/inventory\u0026gt; Note - we need to input Ctrl+A on the Vim command line, and to do that we need to first press Ctrl+V followed by Ctrl+A.\nGeneral structure of a global command is :\u0026lt;range\u0026gt;g/\u0026lt;pattern\u0026gt;/\u0026lt;command\u0026gt;.\nrange - is the usual Vim ranges which can be just a couple of lines or the whole buffer itself (as used above). pattern - can be powerful Vim regex. In the above example, we are just matching for lines which has the word \u0026ldquo;price\u0026rdquo;, which is a crude match, but which works in this case. command - can be any Ex command, and in our example we have used normal command for incrementing numbers. Note - For Emacs users out there who might be using evil mode for editing, there is good news and bad news. Good news is that evil mode has support for global commands, but the bad news is that without some extensions above example command would not work for incrementing numbers. In evil mode, Ctrl+a in normal mode, gets the cursor to the start of the line, not incrementing numbers as in Vim.\nSee evil numbers for similar functionality in Emacs.\nDeleting matching lines It is useful to learn the complement of g command, v as well. v runs the command on non-matching lines given by the pattern.\n0: \u0026lt;ul\u0026gt; 1: \u0026lt;li style=\u0026#34;even\u0026#34;\u0026gt;Coffee\u0026lt;/li\u0026gt; 2: \u0026lt;li style=\u0026#34;odd\u0026#34;\u0026gt;Tea\u0026lt;/li\u0026gt; 3: \u0026lt;li style=\u0026#34;even\u0026#34;\u0026gt;Milk\u0026lt;/li\u0026gt; 4: \u0026lt;li style=\u0026#34;odd\u0026#34;\u0026gt;Sugar\u0026lt;/li\u0026gt; 5: \u0026lt;/ul\u0026gt; Given above example content of a buffer, with line numbers as shown on the left, the following v command gets rid of all list items not matching even style.\n:1,4v/even/d Resulting in following where only the even styled list items are preserved.\n0: \u0026lt;ul\u0026gt; 1: \u0026lt;li style=\u0026#34;even\u0026#34;\u0026gt;Coffee\u0026lt;/li\u0026gt; 2: \u0026lt;li style=\u0026#34;even\u0026#34;\u0026gt;Milk\u0026lt;/li\u0026gt; 3: \u0026lt;/ul\u0026gt; There are many more uses of global commands worth knowing about given in the Vim wiki1.\nResources 1: Power of g 2: vim-multiple-cursors 3: Increasing or decreasing numbers ","permalink":"https://dewaka.com/blog/vim-global-commands/","summary":"Global command1 is a very powerful, and a little under-utilised command from my personal usage. Global command offers a powerful, composable alternative to macros.\nUse cases Usefulness of global commands is best explained through some practical examples.\nUsing Vim global command to increment numbers \u0026lt;inventory\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Coffee\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;230\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Sugar\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;280\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; \u0026lt;item\u0026gt; \u0026lt;name\u0026gt;Tea\u0026lt;/name\u0026gt; \u0026lt;price\u0026gt;120\u0026lt;/price\u0026gt; \u0026lt;/item\u0026gt; ... \u0026lt;/inventory\u0026gt; Let\u0026rsquo;s say you have an XML file which looks as above, and you want to increase the price of the items by 100 each.","title":"Vim Global Commands"},{"content":"Changing working directories is one of the most common operations you do while working on the command line. While tab completion can help make path completion more efficient, it is still a chore to do things manually, especially when moving back and forth between commonly worked on project locations.\nfasd is a tools which can help improve the efficiency of navigating the file system. Fasd tool is a shell tool which integrates with shells to remember directories and files you have worked on recectly. Think of fasd as keeping a MRU cache of files and directories you have worked on.\nWith fasd integration, it is possible to jump back to a directory you have worked on previously with a few keystrokes with the power of fuzzy matching. Same goes for files.\nRefer to fasd project for full documentation regarding installation. Fasd is available for installation on most Linux distributions through system packages, and macOS through Homebrew and Macports.\nCombining fasd with fzf You can make fasd integration even more powerful by combining a fuzzy filter tool, such as fzf through piping.\nFollowing are some of the most useful and oft-used utility functions which I have defined for use in Zsh terminal, and these should work in the same way for Bash as well.\nRecently used directories Following function helps changing back into most recently used directories.\n# cd into recent directories zd() { local dir dir=\u0026#34;$(fasd -Rdl \u0026#34;$1\u0026#34; | fzf -1 -0 --no-sort +m)\u0026#34; \u0026amp;\u0026amp; cd \u0026#34;${dir}\u0026#34; || return 1 } Since this is going to be a very common use case, you can set an easy to use alias as follows,\n# j: jump to directories alias j=zd Above function will directly jump to the directory if you invoke it with an argument which results in an unambiguous match. Otherwise, fzf prompt will be displayed for filtering through possible matches, as shown below.\n# jump to recenty worked directory starting with word helm \u0026gt; zd helm Recently used files Following bash function gives you a quick way to filter through your most recently used files and open them in your default editor.\n# View recent f files v() { local file file=\u0026#34;$(fasd -Rfl \u0026#34;$1\u0026#34; | fzf -1 -0 --no-sort +m)\u0026#34; \u0026amp;\u0026amp; $EDITOR \u0026#34;${file}\u0026#34; || return 1 } Sometimes you remember a file you worked on but not the directory containing it , which can be a common occurrence when you have multiple projects. Following function ~cd~ into the directory of the project containing the file selected based on fasd filtering through fzf.\n# cd into the directory containing a recently used file vd() { local dir local file file=\u0026#34;$(fasd -Rfl \u0026#34;$1\u0026#34; | fzf -1 -0 --no-sort +m)\u0026#34; \u0026amp;\u0026amp; dir=$(dirname \u0026#34;$file\u0026#34;) \u0026amp;\u0026amp; cd \u0026#34;$dir\u0026#34; } There are other utility functions which can be developed based on fasd and fzf, some of which are given in the fzf wiki.\n","permalink":"https://dewaka.com/blog/fasd-for-navigation/","summary":"Changing working directories is one of the most common operations you do while working on the command line. While tab completion can help make path completion more efficient, it is still a chore to do things manually, especially when moving back and forth between commonly worked on project locations.\nfasd is a tools which can help improve the efficiency of navigating the file system. Fasd tool is a shell tool which integrates with shells to remember directories and files you have worked on recectly.","title":"Using Fasd for Command Line Navigation"},{"content":"Typing remote repository passwords for Github and the like quickly becomes tedious when you are working on a couple of repositories on a daily basis. To help that case, modern git comes tools integrating with keyring implementations on various platforms.\nA credential helper integrates with system installed keyring to securely store username/passwords, so that you do not have to type them everytime you want to interact with a remote repository. Popular keyrings include gnome-keyring, which is the one I use on both my Linux installations - Arch and Fedora.\nRecently, when I was trying to configure a git credential helper in Fedora, I found that things have changed a bit from the configuration I used with Arch Linux sometime back. I used to have a configuration as follows on Arch Linux, for gnome-keyring integration:\n[credential] helper = /usr/lib/git-core/git-credential-gnome-keyring Following the Arch configuration, I tried to set the same for Fedora 27, only to find that there is no such git-credential-gnome-keyring in /usr/libexec/git-core. After a bit of googling I found that the configuration to use is as follows now:\n[credential] helper = /usr/libexec/git-core/git-credential-libsecret libsecret provides a unified library for accessing keyrings on Linux platforms, and this is the setting to use if you have gnome-keyring as your keyring on Fedora. Arch Wiki also shows this configuration as of this writing - GNome Keyring - Git Integration.\n","permalink":"https://dewaka.com/blog/linux-git-credentials-helper/","summary":"Typing remote repository passwords for Github and the like quickly becomes tedious when you are working on a couple of repositories on a daily basis. To help that case, modern git comes tools integrating with keyring implementations on various platforms.\nA credential helper integrates with system installed keyring to securely store username/passwords, so that you do not have to type them everytime you want to interact with a remote repository. Popular keyrings include gnome-keyring, which is the one I use on both my Linux installations - Arch and Fedora.","title":"Linux - Git Credential Helpers"},{"content":"These are the books I have read thus far in 2018.\nA Conflict of Visions: Ideological Origins of Political Struggles by Thomas Sowell.\nThis is a great book to read in times like ours where political climate so polarised and driven by partisan frenzy. This books sheds light on different modes of thinking between traditional Liberal vs. Conservative political ideas.\nArtemis by Andy Weir.\nI got started reading this book because of the more famous book - The Martian, even though I haven\u0026rsquo;t read it yet. Artemis, however, wasn\u0026rsquo;t that interesting read even though I kind of liked the plot. I couldn\u0026rsquo;t simply ignore the incongruities of the heroine\u0026rsquo;s character.\nKybalion: A Study of the Hermetic Philosophy of Ancient Egypt and Greece.\nThis book was my first dipping into Hermetic philosophy and mysticism. There are lot of things I would like to read about in Western mystical traditions, and this book was a good starting point.\nOrigin by Dan Brown.\nThe only reason I had to read the book was that I have read the other books from Robert Langdon series by Dan Brown. I didn\u0026rsquo;t have great expectations that this book was going to be great, and thus, I wasn\u0026rsquo;t disappointed to find it formulaic and predictable.\nOn the other hand, I quite liked the real implications of a (near?) future where AIs might play a very significant role in everyday life with more and more autonomy. This book was stimulating in that aspect.\nThe Quest for Cosmic Justice by Thomas Sowell.\nThis was my first introduction to Thomas Sowell\u0026rsquo;s writings, and I immediately got interested to read more of his writings. In this book, Sowell tries to discuss about a very important subject, cosmic justice, in a dispassionate manner. I think that kind of matter of fact analysis is always good to have, especially on a subject as contentious as Cosmic justice, or its recent formulations in the form of Social justice.\nThe Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life by Mark Manson.\nThis was a quick fun read.\nCall Me by Your Name by André Aciman.\nThis was a truly engrossing read. I read the book before watching the movie, and this book got me even more interested to watch the film.\nPrometheus Rising by Robert Anton Wilson.\nThis is my first introduction to Robert Anton Wilson and it was a fun read. He tries to synthesise a different strands of thoughts into a cohesive framework with explanations borrowed from both Western and Eastern traditions from Quantum mechanics to Pranayama Yoga. This was a thought provoking read, and I\u0026rsquo;m interested to read more books from him.\nIntellectuals and Race by Thomas Sowell.\nThis is a book talking about a complex topic in an objective manner as much as possible without being dogmatic about its own conclusions. Similar to The Quest for Cosmic Justice by Sowell, this book also discusses how to bring change and improvements classes of people who were historically marginalised.\nThe Dhammapada translated by Eknath Easwaran\nI have read a couple of Dhammapada translations, and I started reading this translation based on good reviews for translations by Eknath Easwaran on ancient Indian texts.\nThis translation does not contain original Pali verse on which the translation is based on, so if someone is looking to learn original verses this is not the book. There are really good open resources to learn about Dhammapada with original verses.\nTo get the most out of the Dhammapada, at least this translation, one should be a bit familiar with (Theravada) Buddhism. For example, do not expect this book to explain what the Eightfold Path is, but concepts like this are mentioned in the translated verses. However only a handful of integral Buddhist concepts are referenced in this book, thus even someone who is not familiar at all with Buddhism should be able to get something out of this book. Most of the messages in the book can be interpreted even in a non-religious way - say, good aphorisms to live life by.\n12 Rules for Life: An Antidote to Chaos by Jordan B. Peterson\nThis is not the first Jordan Peterson book I started reading; that would be his earlier work Maps of Meaning. However, I postponed reading Maps of Meaning book since I wanted to get a better context for the material he is discussing in the book by reading the works of Carl Jung etc. as a prelude for the book.\n12 Rules for Life is supposed to be a very different beast from his earlier work, targeting general public contrasting the general academic bent of his earlier work.\nI have come across and followed Peterson\u0026rsquo;s positions through his prolific Youtube interviews and sometimes his lectures, which are also available through Youtube. So, the topics and \u0026ldquo;stories\u0026rdquo; the book talks about weren\u0026rsquo;t completely alien to me.\nI think his message resonates with many people because he talks about taking personal responsibility and making your own mark standing to stand out from the crowd, without blindly following with herd mentality be it positions from left or right of the broader political divide. Yes, sometimes his positions can come out as \u0026ldquo;controversial\u0026rdquo;, but if one takes time to evaluate them carefully one can see the reasoning he bases his positions on.\nHis Jungian interpretations of Biblical stories was a fascinating read, but I kept wondering whether this is the only way to evaluate those stories. I kept wondering how the book would have looked had he espoused a different religious tradition, say Buddhism for example.\nAt times the book read almost as a one from the Stoic philosophical tradition; he does not try to sugarcoat life\u0026rsquo;s suffering, and as a realist (and a Buddhist!) I appreciated the honesty. Yet, I do not think the central message of the book is pessimistic at all. On the contrary it is life affirming, and fundamentally about finding meaning in a chaotic world.\nThis book is not a short bullet point list of things you should be doing to confront chaos in life. Peterson has carried his conversationalist style which works well in a lecture format into the book as well. Thus, do not expect the chapters getting to the point in a succinct manner. Although I quite enjoyed most of the stories he had to tell and I think that is one of the alluring aspects of the book, sometimes I just wanted to advance to the next rule a hurry.\nAll in all the book was a great read, and I hope it was also a good introduction to the general themes for Maps of Meaning which I intend to finish.\nLove Poems by Pablo Neruda translated by Devenish Walsh\nThis is my first foray into Pablo Neruda\u0026rsquo;s literature, and those poems were a good start as any. This book contain side by side translations in English of the original poems which are in (Chilean) Spanish.\nEven in their translation, the poems are quite raw and beautiful. I wish to read them again when I have enough command in Spanish to understand the originals.\n","permalink":"https://dewaka.com/blog/books-read-in-2018/","summary":"These are the books I have read thus far in 2018.\nA Conflict of Visions: Ideological Origins of Political Struggles by Thomas Sowell.\nThis is a great book to read in times like ours where political climate so polarised and driven by partisan frenzy. This books sheds light on different modes of thinking between traditional Liberal vs. Conservative political ideas.\nArtemis by Andy Weir.\nI got started reading this book because of the more famous book - The Martian, even though I haven\u0026rsquo;t read it yet.","title":"Books Read in 2018"},{"content":"This is the blog of Chathura Colombage. I tend to write semi-regularly about things which happens to interest me.\nInterests Programming Reading Running1 Hiking1 Chess - I\u0026rsquo;m mostly active on chess.com, but also use lichess.org for training and puzzles. Resume You an download an up to date resume from here - resume.\nBlog This blog is hosted through netlify from a public Github repository with an SSL certificate from letsencrypt. I\u0026rsquo;m currently using the PaperMod Hugo theme.\nPost archive Posts by topic Contacting My email can be found in the resume. You can also contact me via ~dewaka/public-inbox on a public mailing list.\nAffiliate links Some of the posts in this blog can contain amazon affiliate links.\nI track runs and hikes on Strava\u0026#160;\u0026#x21a9;\u0026#xfe0e;\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://dewaka.com/about/","summary":"About Chathura Colombage. This section details what he does \u0026amp; everything else you might want to know about him.","title":"About Me"},{"content":"Under construction.\nKnowledge Wiki Rust Book Public repositories can be found in,\ngithub.com/dewaka - this is where most publicly visible projects can be found at the moment. bitbucket.org/dewaka - I have lot of repositories laying in Bitbucket, but most of them are not public. ","permalink":"https://dewaka.com/projects/","summary":"Chathura Colombage\u0026rsquo;s projects","title":"Projects"},{"content":" Detailed resume One page resume LinkedIn Credily certifications ","permalink":"https://dewaka.com/cv/","summary":"Chathura Colombage\u0026rsquo;s Resume","title":"Resume"}]