Return True Only When One of the Three Inputs Is True

2 Feb, 2021 - 2 minutes
At the $DAYJOB I was trying to figure out how to have a contract for a function that ensures that only one of the three conditionals needed is true. Given that I had come from an electrical engineering background, my first thought was to write a boolean expression. One goes about this by first constructing a truth table and either forming an expressing with a “Sum of Products” (SOP) or a “Product of Sums” expression from the table.

Small Python Snipet to Export Firefox Bookmarks To Markdown

29 Dec, 2020 - 1 minutes
Firefox allows you to backup your bookmarks to a JSON file. I wanted to quickly export it to markdown rather than the HTML offered by Firefox itself. import json bdict = json.load(open('bookmarks-2020-12-29.json', 'r')) def parse_firefox_bookmark(bdict, header=""): if 'children' not in bdict.keys(): try: # There are some nodes with no uri and string comparisons slows # the program so just ignore the exceptions. print('*', '[' + bdict['title'] + ']' + '(' + bdict['uri'] + ')') except: pass return print(header, bdict['title']) for children in bdict['children']: parse_firefox_bookmark(children, header+'#') parse_firefox_bookmark(bdict) Sample output.

TIL Git: Add Untracked File to Index

14 Aug, 2019 - 3 minutes
Recently I was browsing through git add’s manual to find out how to split hunks and stage them. I found that there is an option called --intent-to-add which is pretty useful. Like it says, one can use it to add an untracked file to git’s index but not stage the file. Why is it useful? An untracked file doesn’t show up in diffs and cannot be staged by hunks since nothing is in the index yet.

Using DNSOverTLS With Unbound

10 Jul, 2019 - 4 minutes
Firstly, DNS is how web addresses are looked up to find their location in terms of IP addresses. So it is actually surprising that this lookup has always been unencrypted. The issue has become mainstream of sorts when UK’s Internet Service Provider’s Association nominated Firefox as an internet villain for enabling DNSOverHTTPS (DoH). This allowed people to bypass DNS based blocking performed by ISPs which further cemented the idea that one needs encrypted DNS to avoid being censored or worse MITMed by an authoritarian government by using domain level blocking.

Taking IM Back Using Prosody

26 May, 2019 - 4 minutes
The common way for most people to chat is using an app on their phone which typically one of Whatsapp, Messenger or Telegram. In the same vein we have apps like Threema and Signal which are more popular in certain circles. But the one consistent feature for all these services, is the centralization of accounts and forcing users to be trapped inside a silo. It is true whether the services or clients themselves are open source or not.

(Neo)vim Macro to Create Numbered Lists

17 Feb, 2019 - 1 minutes
I usually encounter this when saving notes about list of items that are not numbered but are generally better off being itemized. Since this is such a common scenario I did find a couple of posts1 2 that explained the method but they had edge cases which were not handled properly. Say you want to note down a shopping list and then decide to number it later, Soy milk Carrots Tomatoes Pasta Start off by numbering the first line and then move the cursor to the second line.

Ansible 101 by trishnag

6 Feb, 2019 - 1 minutes
We had an introductory session on Ansible in #dgplug and these are some notes from the class. Learned about hosts file to create an inventory, https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#hosts-and-groups Different connections (ssh and local for now). I had also tested it against a server running CentOS. We then went on to create an ansible.cfg file in the demo directory which takes precedence over the global configuration. Learned to write a basic playbook which is a YAML file.

Thoughts on Atomic Habits Commentary by Jason Braganza

20 Jan, 2019 - 2 minutes
Original post at https://mjbraganza.com/atomic-habits/ Schedule and structure make or break the plan. Goals only show the direction of the task. Personally I would say this has brought all change I need. Answer in the affirmative. You don’t try quitting smoking, you don’t smoke period. Personally I don’t identify as someone who can’t eat butter or meat but as someone who won’t. This confirms my resolve in what I believe to be done.

New Templates in Dolphin

23 Oct, 2018 - 2 minutes
I was using kio-gdrive to access my Google drive account using Dolphin (file manager). Since these are mounted as a virtual filesystem, I was not able to save files in them directly from libreoffice or any external program. So I thought creating a new document from dolphin and then editing an empty document would be easier to use. But information was scant regarding how to put together. I knew we needed a template which is just an empty file but I didn’t know how to put all this together to make it show up in Dolphin’s “Create New” context menu.

Moving to systemd-networkd

27 Jul, 2018 - 3 minutes
systemd-networkd is a network manager that comes built in with Systemd. It has features, similar to NetworkManager and ConnMan which are more commonly used in distributions like Ubuntu and Fedora. My old system I had moved away from NetworkManager one year back due to constant issues with connecting to enterprise Wi-Fi with logs and errors that were difficult to debug or fix. It was also difficult to see where the failures occurred prompted me to move towards a more modular system.