<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:media="http://search.yahoo.com/mrss/"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:georss="http://www.georss.org/georss">

  <channel>
    <title>
      <![CDATA[  Ashish Panigrahi&#39;s log  ]]>
    </title>
    <link> https://ashishpanigrahi.com </link>
    <description>
      <![CDATA[  Thoughts on physics, society and technology  ]]>
    </description>
    <atom:link
      href="https://ashishpanigrahi.com/feed.xml"
      rel="self"
      type="application/rss+xml" />


<item>
  <title>
    <![CDATA[  Hope &#40;my poem&#41;  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2025-11-18-hope/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2025-11-18-hope/index.html </guid>
  <description>
    <![CDATA[  My poem on hope.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<blockquote>
<p>A shining light in the tunnel of darkness.<br />That&#39;s how I see hope, with a longingness.<br />Sometimes good and sometimes bad,<br />But somehow makes me glad.<br /><br />Is it hope that I&#39;m looking for?<br />Like a drop of water, in a large desert outdoor.<br />Is it just something made up?<br />A lie told even after I slipup.<br /><br />Hope is a dangerous thing.<br />The results can feel like a swing.<br />But is it enough to justify my life?<br />The way I&#39;m living, with so much strife.<br /><br />I keep clinging to this hope.<br />Even with my life being a downward slope.<br />Sometimes I fear it won&#39;t be there.<br />At that point, would I still care?<br /><br />I find myself in an abyss.<br />At times, devoid of any bliss.<br />Hope is the only thing in my mind.<br />Alas it is hard to see, perhaps I left it too far behind.<br /></p>
</blockquote>
 ]]>
  </content:encoded>
    
  <pubDate>Tue, 18 Nov 2025 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Bypassing the storage limit on Zotero with Syncthing  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2025-03-22-zotero-pdf-sync/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2025-03-22-zotero-pdf-sync/index.html </guid>
  <description>
    <![CDATA[  Recently I discovered a neat little trick to having &#40;basically&#41; unlimited storage on Zotero for free&#33;  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<p>Recently, I found out about this neat little trick to bypass the storage limit on <a href="https://zotero.org">Zotero</a> for PDFs. Currently on the &quot;free&quot; tier there is a limit of 300 MB which fills up pretty quickly when you&#39;re doing serious research. This guide helps bypass this limit &#40;subject to your computer&#39;s storage&#41;.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/zotero-storage-price.png" style=width:55%>
<figcaption>The current pricing model. Not bad but you don't need it
if it's just for personal use.</figcaption>
</center><p>The prices are there for if you&#39;d like to store associated PDFs on the cloud and makes sense if two or more people would like to share the same bibliography data. What this blogpost helps with is storing the files locally and syncing them <a href="https://en.wikipedia.org/wiki/Peer-to-peer">peer-to-peer</a>.</p>
<p>Best part is it&#39;s <strong>free</strong>&#33;</p>
<h3 id="prior_situation">Prior situation</h3>
<p>Usually if you&#39;re employed at a university/research institution, the institute has a subscription to various journals. I would use this with Zotero, strictly only storing the metadata and journal links and opening them on the browser. The PDF can then be downloaded if you&#39;re on the institute&#39;s intranet.</p>
<h3 id="storage_location_for_pdfs">Storage location for PDFs</h3>
<p>On 
Linux<label for="fn1">1</label><input type="checkbox" id="fn1">
<small>
this guide assumes you're using linux but i see no reason why it
cannot be adapted for windows and macos.
</small>
 , by default I believe Zotero creates a directory <code>~/Zotero/</code> for storage of files, notes and metadata. I usually create my own custom location for the directory, <code>~/.zotero/</code> in this case as I don&#39;t like having my home directory 
cluttered.<label for="fn2">2</label><input type="checkbox" id="fn2">
<small>
To actually keep your `~/` uncluttered, the best approach would be
something along the lines of `~/.local/share/zotero` which is
`XDG_DATA_HOME` according to XDG standards.
</small>
</p>
<p>To change this, go to <strong>Edit -&gt; Settings -&gt; Advanced</strong> and under &quot;<strong>Data Directory Location</strong>&quot; you can specify a custom path.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/zotero-location.png">
<figcaption>Dialog box for specifying custom location for Zotero directory.</figcaption>
</center><p>Now assuming you already have a sizeable zotero database, we go to this location and are interested in the <code>~/.zotero/storage</code> folder. This is where the PDFs are stored.</p>
<h4 id="changing_a_few_settings">Changing a few settings</h4>
<p>Now, by default Zotero syncs all your files to the cloud. We don&#39;t want that. To disable it, go to <strong>Edit -&gt; Settings -&gt; Sync</strong> and under <strong>File Syncing</strong> uncheck both &quot;Sync attachment files in My Library&quot; and &quot;Sync attachment files in group libraries using Zotero storage&quot;.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/zotero-syncing.png">
<figcaption>Uncheck both the boxes.</figcaption>
</center><p>Now that we have unchecked the boxes, one can simply save the PDFs as we like and use it on their computer. But what if we need to access files on a different computer? That&#39;s where peer-to-peer syncing comes in.</p>
<h3 id="syncing_with_syncthing">Syncing with Syncthing</h3>
<p><a href="https://syncthing.net">Syncthing</a> is an excellent piece of software. As described on their website:</p>
<blockquote>
<p>Syncthing is a <strong>continuous file synchronization</strong> program.</p>
</blockquote>
<p>Basically it helps sync files between different computers in a peer-to-peer fashion.</p>
<h3 id="quickstart_guide">Quickstart guide</h3>
<p>I would highly recommend the <a href="https://docs.syncthing.net/intro/getting-started.html">official user-guide</a> for using syncthing. However, the following covers a quick and brief guide to getting syncing setup with Zotero.</p>
<p>Launching <code>syncthing</code> in a terminal opens up <code>localhost:8384</code> on your web browser and you&#39;re greeted with the GUI.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/syncthing-gui.png" style=width:100%>
<figcaption>Syncthing GUI</figcaption>
</center><p>The GUI shows three components, two of which we are concerned with. On the left are the folders that are synced. The right bottom section consists of the devices to which certain folders are being synced. In my case, I have the <em>zotero storage</em> folder synced with my office PC and some other folders synced with my Android phone.</p>
<p>The &quot;Add Folder&quot; button is a good starting point. Clicking it leads us to a dialog box asking for a <em>folder label</em> and a <em>folder path</em>. The latter is important. For now, just ignore the <em>folder ID</em> variable. It is auto-generated by syncthing and is meant to let syncthing know which folders to sync across different computers based on this ID.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/syncthing-add-folder.png" style=width:90%>
<figcaption>Adding folder for syncing.</figcaption>
</center><p>Now, just set the folder path to <code>~/.zotero/storage</code> &#40;or whatever is the custom folder path you&#39;ve set in Zotero&#41; and click save.</p>
<h4 id="adding_remote_device">Adding remote device</h4>
<p>On the secondary device that you&#39;d like to access your PDFs on &#40;laptop or perhaps a desktop at your office like me&#41;, then you need to launch syncthing on the remote device and add it on your main computer by clicking &quot;Add Remote Device&quot; at the bottom right corner in the GUI.</p>
<p>The device can be added either via a device ID or via a QR-code, which is accessible under the &quot;Actions&quot; tab and clicking &quot;Show ID&quot;.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/syncthing-add-device.png" style=width:100%>
<figcaption>Accessing QR code for current device.</figcaption>
</center><p>Follow similar instructions on the remote device for setting up a sync folder &#40;should be empty as for the first sync, we&#39;re really transferring PDFs from the main device to the remote one&#41;. Make sure to have the same path in your Zotero settings on the remote device&#33;</p>
<p>After adding the remote device, we need to share the folder we had set with the remote device. To do this, simply go to the <em>zotero-storage</em> folder under the &quot;Folders&quot; section and click edit. This will bring up a dialog box that we had previously edited. Under the &quot;Sharing&quot; tab, check the box for the added remote 
device.<label for="fn3">3</label><input type="checkbox" id="fn3">
<small>
Don't worry about the "enter encryption password". You only need it if
you're concerned with security and would like to have encrypted
folders. I don't really care about that for zotero so I leave it unchecked.
</small>
 And just hit save. 
<center>
<img src="https://ashishpanigrahi.com/assets/images/syncthing-share-folder.png" style=width:90%>
<figcaption>Sharing the folder with remote device.</figcaption>
</center>
</p>
<p>If you have everything setup properly, the folder should get synced across both the devices and you should be able to access the PDFs in both these device&#33; Of course, you can add more devices if you&#39;d like.</p>
<p>I&#39;ve been extremely happy with this setup and I hope it&#39;s useful to you as it has been for me, thanks to my friend <a href="https://marci.gunyho.com">Marci</a> who introduced me to the idea.</p>
 ]]>
  </content:encoded>
    
  <pubDate>Sat, 22 Mar 2025 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  When did I stop being a child? &#40;my poem&#41;  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2024-06-19-when-did-i-become-an-adult/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2024-06-19-when-did-i-become-an-adult/index.html </guid>
  <description>
    <![CDATA[  My poem on transitioning from childhood.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<blockquote>
<p>When did I stop being a child?<br />It&#39;s been so long, but I used to be quite beguiled.<br />While I reminisce the days of not caring about the world.<br />I wonder, when that child stopped being one, as an adult labelled.<br /><br />Perhaps it was when my interests changed.<br />Things that I used to like, now feel estranged.<br />Oh, how I wish I could go back to those simpler times.<br />That child exists no more, but an adult begrimed.<br /><br />Carefree is the emotion I took for granted.<br />Now that I&#39;m older, responsibilities have been handed.<br />I remember a time when I used to run wild.<br />Oh, but when did I stop being a child?<br /><br />As I grow old, my anxiety only becomes stronger.<br />Is adulthood really supposed to be this way, with nothing more to offer?<br />Alas, it is too late now to think about a time bygone.<br />But the only way forward, is to look ahead and march into the unknown.<br /></p>
</blockquote>
 ]]>
  </content:encoded>
    
  <pubDate>Wed, 19 Jun 2024 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  What is my purpose? &#40;my poem&#41;  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2024-04-21-what-is-my-purpose/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2024-04-21-what-is-my-purpose/index.html </guid>
  <description>
    <![CDATA[  My poem on seeking purpose.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<blockquote>
<p>What is my purpose but a tiny speck on this big blue dot?<br />Is it already decided or do I get myself taught?<br />I do wonder how the rest of my life shall continue.<br />Will it be the same things I now pursue?<br /><br />Family it is for some people.<br />For others, it is their career to excel.<br />But does it matter in the end?<br />Perhaps the greater reason is to make oneself enlighten.<br /><br />Often I find myself asking such questions.<br />I keep looking for entities of substance<br />in this rollercoaster that is life.<br />What can I do to make it more rife?<br /><br />For far too long I&#39;ve been looking far away.<br />Always fearing that my life might go astray.<br />Is it deep down something more precious?<br />Only to find myself asking, &quot;what is my purpose?&quot;.<br /></p>
</blockquote>
 ]]>
  </content:encoded>
    
  <pubDate>Sun, 21 Apr 2024 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Switching to GNU Emacs  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2024-04-14-switching-to-emacs/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2024-04-14-switching-to-emacs/index.html </guid>
  <description>
    <![CDATA[  Switching to GNU Emacs from NeoVim.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<p>Over the past five years, I&#39;ve been using <a href="https://www.vim.org">Vim</a> &#40;well <a href="https://neovim.io">NeoVim</a> specifically&#41; for all of my text editing needs ranging from tinkering with config files, shell scripts, to writing this website, making LaTeX reports and theses, etc. The paradigm of modal text editing that is Vim, just feels right. The user communicates exactly how text needs to be edited. For instance: delete all characters until a specific character appears? Done. Only delete lines in the file that cover certain patterns? Built-in regex has you covered&#33; The point is, once you understand how modal editing works, any other form of text editing feels like it&#39;s from the stone ages.</p>
<p>Now you might ask, why am I switching to <a href="https://www.gnu.org/software/emacs/">GNU Emacs</a>, the opposing contender to Vim in the well known <a href="https://en.wikipedia.org/wiki/Editor_war">editor war</a>? Well, the more &quot;silly&quot; reason is that it gives me an opportunity to learn a new piece of software, understand it&#39;s inner workings, etc. The more pragmatic reason is that, like any rivalry, both sides have their pros and cons. GNU Emacs presents itself as a truly hackable editor in any way the user desires. This is thanks to the editor being written and configured in <a href="https://en.wikipedia.org/wiki/Emacs_Lisp">Emacs lisp</a>, a dialect of the Lisp family of languages. Vim on the other hand is written mostly in C but is configured in an obscure language that is Vimscript. The advantage with Emacs lisp is that one can write not only specific functions to help in any form of text editing and beyond &#40;one of the charms of Emacs&#41; but also supplements more experienced users in contributing to the core development of Emacs. This appeals to me from a FOSS perspective as I truly believe that free software development being run by volunteers should be tightly knit with its user community. This helps not only in raising issues with the software better but also in users contributing to the development.</p>
<p>This truly hackable experience, presented by Emacs also benefits in the form of tasks that are not necessarily based around text-editing. Thanks to the wonderful community, Emacs boasts a wide-range of well-written packages such as <a href="https://orgmode.org">org-mode</a> &#40;Task management system with a markup style of its own&#41; and <a href="https://magit.vc/">Magit</a> &#40;A Git porcelain inside Emacs&#41;. One of the primary reasons I&#39;ve decided to switch is due to org-mode &#40;which I intend to cover in detail in subsequent blog entries&#41;.</p>
<p>Some people might argue that Emacs goes against the UNIX philosophy of minimalism and &quot;doing one thing right&quot;. Technically Emacs is more of a Lisp environment than a text editor, or like the more famous vim adage: &quot;Emacs is a great operating system, but it lacks a good text editor&quot;. I cannot really comment here because I&#39;m still very new to Emacs but the quote does hold some truth. Emacs &#40;atleast from my first impressions&#41; has esoteric keybindings which are completely foreign to new users let alone someone coming from a vim background. <code>Ctrl</code> and <code>Alt</code> &#40;known as <code>Meta</code> in Emacs parlance&#41; are the most common keys which form part of the key-chord style of using emacs. These keys obviously are placed at positions on a standard QWERTY keyboard layout that when used frequently leads to the more infamous <a href="https://stackoverflow.com/questions/52492/what-is-the-best-way-to-avoid-getting-emacs-pinky">Emacs pinky</a> which is basically <a href="https://en.wikipedia.org/wiki/Repetitive_strain_injury">repetitive strain injury &#40;RSI&#41;</a>. For this reason, I will be using emacs with <a href="https://github.com/emacs-evil/evil">Evil</a> which is the Vi-emulation package in emacs, atleast until I get the hang of working with Emacs before perhaps trying the stock keybindings &#40;which apparently most of the emacs community adheres to&#41;.</p><center>
<img src="https://ashishpanigrahi.com/assets/images/real_programmers.png">
<figcaption>Relevant xkcd</figcaption>
</center><p>For the next couple weeks I will try to steadily convert to using Emacs and hopefully perform all of my computing needs with emacs in the not-so-long future. This blog post is mainly for me to make this commitment. As a first step, this blog entry is written entirely in Emacs.</p>
 ]]>
  </content:encoded>
    
  <pubDate>Sun, 14 Apr 2024 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Easy fix for F4 mute LED light on ThinkPad laptops on GNU/Linux  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2023-09-05-thinkpad-micmute-led/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2023-09-05-thinkpad-micmute-led/index.html </guid>
  <description>
    <![CDATA[  Fixing the always on backlight on F4 &#40;mute&#41; button on Lenovo ThinkPad laptops running GNU/Linux.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  
<p>Recently I purchased a ThinkPad E14 Gen 5 laptop after spending 5 years with my previous workhorse machine, the HP Pavilion 14 with an Intel i5 &#40;4 cores&#41; CPU. The upgrade is quite significant, coming with an eight core AMD Ryzen 7 CPU... but I digress.</p>
<h3 id="the_problem">The Problem</h3>
<p>With modern day laptops, often there are backlit keys on certain media keys like mute sound, mute mic, airplane mode and so on. The light being switched on, for obvious reasons indicates that the particular function is in operation. This is easy on Windows for which these machines are always tested 
against.<label for="fn1">1</label><input type="checkbox" id="fn1">
<small>
The travesty being that laptop manufacturers being the profit oriented
businesses that they are, cater to the masses which unfortunately
sides with malicious, proprietary garbage like Windows.
</small>
 Similarly, macOS works well on Apple devices. With 
GNU/Linux<label for="fn2">2</label><input type="checkbox" id="fn2">
<small>
Technically Linux is the kernel and not the operating system (the rest
is supplied by the GNU operating system sans its own kernel).
<a href="https://www.gnu.org/gnu/why-gnu-linux.html">Here</a> is a better
explanation.
</small>
 however, almost all machines work but the tiny quality of life improvements like those media key lights can be a hit or miss.</p>
<p>As usual, I went ahead and installed <a href="https://archlinux.org">Arch Linux</a> on my machine with <a href="https://dwm.suckless.org">dwm</a> as my window manager. After the installation and a test drive of my laptop, I see this...</p><center>
<img src="https://ashishpanigrahi.com/assets/images/thinkpad-micmute-led.jpg">
<figcaption>The annoying led being always ON</figcaption>
</center><p>At first I thought perhaps it&#39;s a driver issue but all my drivers were up-to-date. Looking through the <a href="https://wiki.archlinux.org">Arch wiki</a> didn&#39;t help with the issue. Knowing the vibrant thinkpad community, I ended up posting about my problem on <a href="https://reddit.com/r/thinkpad">r/thinkpad</a>.</p>
<h3 id="simple_fix">Simple Fix</h3>
<p>I&#39;d much rather have the backlight fully off than have it functional. So, a fellow redditor let me know to check for the output in a particular system file:</p>
<pre><code class="language-shell">~: &#36; cat /sys/class/leds/platform::micmute/brightness
1</code></pre>
<p>&#39;1&#39; here represents the light in the ON state, which is exactly the problem&#33; 
<s>Changing the value to '0' in the file instantly fixes the problem!</s>
 Changing it to &#39;0&#39; only fixes it temporarily until the next time the machine is booted up. A rather simple &quot;hack&quot; is to make this change every time the user logs into the machine. This is done simply through the <code>.xprofile</code> or <code>.xinitrc</code> file &#40;most people would use <code>.xinitrc</code>&#41; by adding the following line in said file:</p>
<pre><code class="language-shell">echo &quot;0&quot; &gt; /sys/class/leds/platform::micmute/brightness</code></pre>
<p>This line simply replaces whatever the file previously had, with &#39;0&#39;. This works rather well until I find a more permanent solution.</p>
<h3 id="edit">Edit</h3>
<p>Unfortunately, the above method doesn&#39;t work anymore. I&#39;m not exactly sure what changed but apparently it isn&#39;t supposed to work in the first place simply because <code>/sys/class/leds/platform::micmute/brightness</code> isn&#39;t a real directory.</p>
<p>In any case, here&#39;s an updated method for the same that is slightly more involved. It is adapted for any Linux distribution running systemd. For other init systems &#40;openrc, runit, etc.&#41;, I assume it&#39;s fairly simply to make the relevant changes.</p>
<ul>
<li><p>Create a shell script <code>disable-mute.sh</code> in your preferred directory &#40;<code>~/.local/bin/</code> in my case&#41; containing the following:</p>
</li>
</ul>
<pre><code class="language-sh">#&#33;/bin/shecho 0 | tee /sys/class/leds/platform::micmute/brightness</code></pre>
<ul>
<li><p>With root privileges, create a file <code>disable-mute.service</code> in <code>/etc/systemd/system/</code> with the following 
  content:<label for="fn3">3</label><input type="checkbox" id="fn3">
  <small>
  See <a
  href="https://linuxhandbook.com/create-systemd-services/">here</a>
  for a detailed tutorial on writing systemd service files.
  </small>
  </p>
</li>
</ul>
<pre><code class="language-text">&#91;Unit&#93;
Description&#61;Disables the annoying mute light on keyboard
After&#61;multi-user.target&#91;Service&#93;
ExecStart&#61;/bin/sh /home/ashish/.local/bin/disable-mute.sh
Type&#61;simple&#91;Install&#93;
WantedBy&#61;multi-user.target</code></pre>
<ul>
<li><p>Simply run <code>sudo systemctl enable disable-mute.service</code> and the LED should turn off the next time you boot up your machine.</p>
</li>
</ul>
<p><strong>Late 2024 Update</strong>: This method works so far for the 6.6-LTS Kernel, NOT the bleeding edge one.</p>
 ]]>
  </content:encoded>
    
  <pubDate>Tue, 05 Sep 2023 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Hello, World in Qiskit  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2021-07-16-qiskit-hello-world/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2021-07-16-qiskit-hello-world/index.html </guid>
  <description>
    <![CDATA[  This blog post provides a tutorial on implementing a first &quot;hello, world&quot; program in a quantum computing framework called Qiskit.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  <p>Qiskit is a python SDK for simulating and running quantum algorithms on real quantum computers. As mentioned on <a href="https://qiskit.org/">qiskit.org</a>:</p>
<blockquote>
<p>Qiskit &#91;kiss-kit&#93; is an open-source SDK for working with quantum computers at the level of pulses, circuits and application modules.</p>
</blockquote>
<p>I plan on writing a series of tutorials on getting started with quantum computing using qiskit, as I learn as well. Like any other programming tutorial, we start with a simple &quot;Hello, world&quot; program.</p>
<h2 id="measuring_a_quantum_state">Measuring a quantum state</h2>
<p>With conventional computers, the simplest program that one could perhaps make is printing out &quot;hello, world&quot;. However, in contrast to this, in quantum systems, we go ahead and measure a quantum state &#40;this seems to be the most rudimentary but complete program in quantum terms&#41;. Let&#39;s proceed to do just that&#33;</p>
<h3 id="defining_a_quantum_state">Defining a quantum state</h3>
<p>We import the necessary modules from Qiskit for this operation. To define a quantum circuit, we require the classes <code>QuantumCircuit</code>, <code>QuantumRegister</code>, <code>ClassicalRegister</code> and define a state variable <code>psi</code> as</p>
\[
| \psi \rangle =
\frac{1}{\sqrt{2}}
\begin{pmatrix}
1\\
1
\end{pmatrix}
\]
<p>Notice that the state \(| \psi \rangle\) is normalized. This is important, otherwise we&#39;ll end up with an error.</p>
<pre><code class="language-python">from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from math import sqrt# define an initial state
psi &#61; &#91;1/sqrt&#40;2&#41;, 1/sqrt&#40;2&#41;&#93;</code></pre>
<p>We then define a function <code>prepare&#40;&#41;</code> which takes two parameters: a <code>QuantumCircuit</code> object named <code>qc</code> and the initial state <code>psi</code>. Remember that the quantum circuit that we define, only uses 1 qubit &#40;notice the vector representation of \(| \psi \rangle\)&#41;.</p>
<pre><code class="language-python">def prepare&#40;qc, psi&#41;:
    qc.initialize&#40;psi, &#91;0&#93;&#41;     # &#91;0&#93; indicates the zeroth index &#40;or&#41; the first qubit</code></pre>
<p>Python by default, calls by reference, so we don&#39;t have to worry about returning anything from <code>prepare&#40;&#41;</code>.</p>
<h3 id="building_a_quantum_circuit">Building a quantum circuit</h3>
<p>Let&#39;s proceed with making an actual quantum circuit. For this, we define a <code>QuantumRegister</code> object <code>qr</code>, which stores the qubits and a <code>ClassicalRegister</code> object <code>cr</code> which stores the measured values of those qubits.</p>
<pre><code class="language-python">qr &#61; QuantumRegister&#40;1&#41;
cr &#61; ClassicalRegister&#40;1&#41;</code></pre>
<p>Combining the two registers, we now make a quantum circuit:</p>
<pre><code class="language-python">qc &#61; QuantumCircuit&#40;qr, cr&#41;</code></pre>
<h3 id="initializing_and_measuring_the_qubit">Initializing and measuring the qubit</h3>
<p>We then call our function <code>prepare&#40;&#41;</code> to initialize the first qubit &#40;the only qubit&#41; of our quantum circuit <code>qc</code>.</p>
<pre><code class="language-python">prepare&#40;qc, psi&#41;</code></pre>
<p>How do we go about measuring our state? That&#39;s where the <code>ClassicalRegister</code> object <code>cr</code> comes in. We use the <code>measure</code> method under the <code>qc</code> object to actually measure the qubit.</p>
<pre><code class="language-python">qc.measure&#40;qr&#91;0&#93;, cr&#91;0&#93;&#41;</code></pre>
<p>The above syntax generally means that we&#39;re measuring the state of <code>qr&#91;0&#93;</code> &#40;the first qubit&#41; onto the classical register <code>cr&#91;0&#93;</code> where we store the measured value.</p>
<h2 id="visualizing_the_circuit">Visualizing the circuit</h2>
<p>Ok so all of this is nice, but one can only describe so much. Let&#39;s see how our circuit actually looks like after applying the above operations. For this, we use the <code>draw&#40;&#41;</code> method with the <code>matplotlib</code> backend.</p>
<pre><code class="language-python">&gt;&gt;&gt; qc.draw&#40;output&#61;&#39;mpl&#39;&#41;</code></pre><figure>
<center>
    <img src="https://ashishpanigrahi.com/assets/images/qc.png" style="width:50%">
</center>
</figure><h2 id="choosing_a_backend_for_measurement">Choosing a backend for measurement</h2>
<p>To measure the qubit and store the result in the classical register <code>cr</code>, we use the <code>qasm_simulator</code> backend. As we know from basic quantum mechanics,</p>
<pre><code class="language-python">from qiskit import Aer
backend &#61; Aer.get_backend&#40;&#39;qasm_simulator&#39;&#41;</code></pre>
<p>We then transpile our circuit for the <code>qasm_simulator</code> backend to understand and execute the circuit.</p>
<pre><code class="language-python">from qiskit import transpile
qc_compiled &#61; transpile&#40;qc, backend&#41;</code></pre>
<p>Now, we simply execute the circuit and gather the measurement results.</p>
<pre><code class="language-python">job &#61; backend.run&#40;qc_compiled, shots&#61;1024&#41;  # shots is the number of times we run the experiment
results &#61; job.result&#40;&#41;</code></pre>
<p>We store the value of the <code>result</code> object and can further access the number of times we end up with a certain value of expected outcome with the <code>get_counts&#40;&#41;</code> method.</p>
<pre><code class="language-python">counts &#61; results.get_counts&#40;qc_compiled&#41;
print&#40;counts&#41;</code></pre>
<pre><code class="language-plaintext">&#123;&#39;0&#39;: 518, &#39;1&#39;: 506&#125;</code></pre>
<p>Here we end up with a dictionary of key values <code>&#39;0&#39;</code> and <code>&#39;1&#39;</code>, which indicate the following quantum states:</p>
\[
| 0 \rangle =
\begin{pmatrix}
1\\
0
\end{pmatrix}\qquad| 1 \rangle =
\begin{pmatrix}
0\\
1
\end{pmatrix}
\]
<p>As expected, we get a 50-50 distribution of the states \(|0\rangle\) and \(|1\rangle\), since our starting state was \(|\psi\rangle\). We can also calculate this probability via the inner-product,</p>
\[
|\langle 0 | \psi \rangle|^2 = \frac{1}{2} \qquad |\langle 1 | \psi \rangle|^2 = \frac{1}{2}
\]
<p>Let&#39;s visualize this in the form of a histogram. For this, we import the <code>plot_histogram</code> function.</p>
<pre><code class="language-python">&gt;&gt;&gt; from qiskit.visualization import plot_histogram
&gt;&gt;&gt; plot_histogram&#40;counts&#41;</code></pre><figure>
<center>
    <img src="https://ashishpanigrahi.com/assets/images/histogram.png" style="width:80%">
</center>
</figure><p>You can find the entire script in this <a href="https://gist.github.com/paniash/52497bf574ea4570ce5f0a21fa093b12">gist</a>.</p>
 ]]>
  </content:encoded>
    
  <pubDate>Fri, 16 Jul 2021 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Font Rendering in Firefox  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2021-05-30-firefox-fonts/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2021-05-30-firefox-fonts/index.html </guid>
  <description>
    <![CDATA[  Are you irritated by the font rendering in firefox? This blog post explains how to fix it on unix-based systems.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  <p>If you&#39;re on a &#42;nix system and compare the fonts on chrome and firefox, you&#39;d notice the difference. The fonts on the latter just look... <em>off</em>, or atleast that was the case on my system.</p>
<h2 id="my_personal_odyssey">My personal odyssey</h2>
<p>Recently I had made the switch from firefox to brave, for the naive reason that fonts were just rendered better &#40;and LaTeX looks like it&#41; on it &#40;being a chromium based browser&#41;. However, I really missed the customizability and other nifty features of firefox. It just felt like home. I knew for sure that I&#39;m missing something, because surely firefox couldn&#39;t be responsible for messing fonts, right? &#40;atleast I hoped&#41;.</p>
<p>On firefox, you may have come across the font settings that look something like this:</p><center>
<img src="https://ashishpanigrahi.com/assets/images/firefox-font.png">
</center><p>My past self would unselect the option <em><strong>Allow pages to choose their own fonts, instead of your selections above</strong></em>, just so that I can have my custom fonts rendered. But oh boy, would that turn out disastrous to say the least. I visit a good number of websites that render math equations in TeX, but with this setting turned off, LaTeX looked more like some flunky &#39;90s PC trying to render math.</p>
<p>What was the fix you might ask? Well, just select the option that I had unselected earlier. But this would bring that the atrocious fonts back on many websites.</p>
<h2 id="the_fix">The fix</h2>
<p>I later came across <a href="https://nolanlawson.com/2020/05/02/customizing-fonts-in-firefox-on-linux/">this</a> blog post where I got to know that firefox depends on an OS-level font configuration called <a href="https://wiki.archlinux.org/title/Font_configuration">fontconfig</a> and is located at <code>~/.config/fontconfig/fonts.conf</code>.</p>
<h3 id="create_a_fontconfig_file">Create a fontconfig file</h3>
<p>If you don&#39;t have one, just create it at the specific location.</p>
<pre><code class="language-xml">&lt;?xml version&#61;&#39;1.0&#39;?&gt;
&lt;&#33;DOCTYPE fontconfig SYSTEM &#39;fonts.dtd&#39;&gt;
&lt;fontconfig&gt;
    &lt;alias&gt;
        &lt;family&gt;Helvetica&lt;/family&gt;
        &lt;prefer&gt;&lt;family&gt;IBM Plex Sans&lt;/family&gt;&lt;/prefer&gt;
    &lt;/alias&gt;
    &lt;alias&gt;
        &lt;family&gt;sans-serif&lt;/family&gt;
        &lt;prefer&gt;&lt;family&gt;IBM Plex Sans&lt;/family&gt;&lt;/prefer&gt;
    &lt;/alias&gt;
    &lt;alias&gt;
        &lt;family&gt;monospace&lt;/family&gt;
        &lt;prefer&gt;&lt;family&gt;DejaVu Sans Mono&lt;/family&gt;&lt;/prefer&gt;
    &lt;/alias&gt;
&lt;/fontconfig&gt;</code></pre>
<p>A lot of websites these days use Helvetica as their serif font, and firefox will fallback to a specific font if Helvetica is not found. By default, this fallback seems to be Nimbus Sans, which is not pretty to say the least. This is where fontconfig comes in.</p>
<p>The above XML file tells firefox that, &quot;Hey&#33; If you&#39;re trying to render Helvetica, just use IBM Plex Sans&quot;, and similar font rules for sans-serif and monospace fonts.</p>
<h3 id="the_result">The result</h3><figure>
<center>
    <img src="https://ashishpanigrahi.com/assets/images/oldfonts.png" style="width:100%">
    <figcaption>Daniel</figcaption>
    <br></br>
    <img src="https://ashishpanigrahi.com/assets/images/newfonts.png" style="width:100%">
    <figcaption>The cooler Daniel</figcaption>
</center>
</figure><p>I was really happy when I came across this fix&#33; and I hope this has helped you as well.</p>
 ]]>
  </content:encoded>
    
  <pubDate>Sun, 30 May 2021 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  A Primer to the No-Cloning Theorem  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2020-07-26-no-cloning-theorem/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2020-07-26-no-cloning-theorem/index.html </guid>
  <description>
    <![CDATA[  A primer to no-cloning theorem explaining why it is forbidden to copy a general unknown quantum state A onto another quantum state B.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  <p>Before we dive into the no-cloning theorem, it is important to glance over certain methods and concepts apriori.</p>
<h3 id="unitary_transform"><em>Unitary transform:</em></h3>
<p>An operator \(U\) is unitary if</p>
\[
U U^\dagger = U^\dagger U = I
\]
<p>where \(U^\dagger\) is the complex conjugate &#40;interchange rows &amp; columns and replace \(i\) with \(-i\)&#41; of \(U\).</p>
<h3 id="tensor_product"><em>Tensor product:</em></h3>
<p>Let there be 2 matrices \(A\) and \(B\) where</p>
\[
A =
\begin{pmatrix}
a_{00} & a_{01} \\
a_{10} & a_{11} \\
\end{pmatrix}
\]
\[
B =
\begin{pmatrix}
b_{00} & b_{01} \\
b_{10} & b_{11} \\
\end{pmatrix}
\]
<p>The tensor product of \(A\) and \(B\) is represented as \(A \otimes B\) and is evaluated as</p>
\[
A \otimes B =
\begin{pmatrix}
a_{00} \cdot
\begin{pmatrix}
b_{00} & b_{01} \\
b_{10} & b_{11} \\
\end{pmatrix}
&
a_{01} \cdot
\begin{pmatrix}
b_{00} & b_{01} \\
b_{10} & b_{11} \\
\end{pmatrix}
\\
a_{10} \cdot
\begin{pmatrix}
b_{00} & b_{01} \\
b_{10} & b_{11} \\
\end{pmatrix}
&
a_{11} \cdot
\begin{pmatrix}
b_{00} & b_{01} \\
b_{10} & b_{11} \\
\end{pmatrix}
\\
\end{pmatrix}
\]
<h4 id="disclaimer">Disclaimer</h4>
<p>I have used the term unitary transform and unitary operation interchangeably &#40;since they mean the same thing&#41;.</p>
<h2 id="introduction">Introduction</h2>
<p>Given a quantum state \(\left| \psi \right> = \alpha \left| 0 \right> + \beta \left| 1
\right>\) with unknown complex coefficients \(\alpha\) and \(\beta\), is it possible to replicate the state onto another qubit? In other words, is it possible to go from \(\left| \psi \right>\) to \(\left| \psi \right> \otimes \left| \psi \right>\)? Let us form a hypothesis.</p>
<h3 id="hypothesis"><em>Hypothesis:</em></h3>
<p>Given an unknown quantum state \(\left| \psi \right>\), there exists a unitary transform \(U\) such that it replicates the state \(\left| \psi \right>\) to \(\left| \psi
\right> \otimes \left| \psi \right>\).</p>
<p>From the postulates of quantum mechanics, any transformation of a quantum system must be unitary. Hence, we are trying to look for a unitary operation \(U\) to make the following transform:</p>
\[
U \left| \psi \right> \otimes \left| 0 \right> = \left| \psi \right> \otimes \left| \psi \right>
\]
<p>Here the inputs are \(\left| \psi \right>\) and an ancilla qubit &#40;in our case \(\left | 0 \right>\)&#41;.</p>
<p>The no cloning theorem tells us that such a unitary transform does not exist. Let us see how this is true, algebraically. We will do this by disproving the hypothesis. Let us look at the cases when \(\left| \psi \right> = \left| 0 \right>\) and when \(\left| \psi \right> = \left| 1 \right>\). On applying the operation \(U\), the 2-qubit state becomes,</p>
\[
\left| 0 \right> \otimes \left| 0 \right> = \left| 00 \right> \xrightarrow[]{U} \left| 00 \right>
\]
\[
\left| 1 \right> \otimes \left| 0 \right> = \left| 10 \right> \xrightarrow[]{U} \left| 11 \right>
\]
<p>Now let us apply \(U\) to the original state \(\left| \psi \right> (= \alpha \left| 0 \right> + \beta \left| 1 \right>)\) based on the above transformations.</p>
\[
(\alpha \left| 0 \right> + \beta \left| 1 \right>) \otimes \left| 0 \right> = \alpha \left| 00 \right> + \beta \left| 10 \right> \xrightarrow[]{U} \alpha U \left| 00 \right> + \beta U \left| 10 \right> = \alpha \left| 00 \right> + \beta \left| 11 \right>
\]
<p>Based on our original hypothesis, the output is</p>
\[
(\alpha \left| 0 \right> + \beta \left| 1 \right>) \otimes (\alpha \left| 0 \right> + \beta \left| 1 \right>) = \alpha ^2 \left| 00 \right> + \alpha \beta \left| 01 \right> + \beta \alpha \left| 10 \right> + \beta ^2 \left| 11 \right>
\]
<p>In matrix notation this looks like</p>
\[
\begin{pmatrix}
\alpha ^2 \\
\alpha \beta \\
\beta \alpha \\
\beta ^2 \\
\end{pmatrix}
=
U
\begin{pmatrix}
\alpha \\
0 \\
\beta \\
0 \\
\end{pmatrix}
\]
<p>Now comparing the coefficients of the output states, such a case is only possible if \(\alpha = 1\) or \(\beta = 1\). This disproves the hypothesis, hence proving the no cloning theorem.</p>
<h2 id="references">References</h2>
<ol>
<li><p><a href="https://www.youtube.com/watch?v&#61;1X7CDd1lvR0&amp;list&#61;PLXEJgM3ycgQW5ysL69uaEdPoof4it6seB">Quantum Computing lectures by Dr. Umesh Vazirani</a></p>
</li>
<li><p>Principles of Quantum Mechanics - Shankar</p>
</li>
<li><p>Quantum Computation and quantum information - Nielsen &amp; Chuang</p>
</li>
</ol>
 ]]>
  </content:encoded>
    
  <pubDate>Sun, 26 Jul 2020 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>

<item>
  <title>
    <![CDATA[  Intro to Public-key Cryptography  ]]>
  </title>
  <link> https://ashishpanigrahi.com/blog/2020-07-20-cryptography-intro/index.html </link>
  <guid> https://ashishpanigrahi.com/blog/2020-07-20-cryptography-intro/index.html </guid>
  <description>
    <![CDATA[  This post talks about the basics of asymmetric cryptography a.k.a. public-key cryptography explaining how the protocol works from a layman&#39;s perspective.  ]]>
  </description>  
  
  <content:encoded>
    <![CDATA[  <p>We have all heard fancy jargon like &quot;encryption&quot;, &quot;cryptography&quot; and what not, but what do these terms actually mean? In this article, I attempt to give you a brief introduction to the world of cryptography and how in particular, public-key cryptography, a popular means of encryption works.</p>
<p>In layman terms, <a href="https://en.wikipedia.org/wiki/Cryptography"><em>cryptography</em></a> is the study of securing messages between two parties without a third party knowing what the message is. <a href="https://en.wikipedia.org/wiki/Encryption"><em>Encryption</em></a> is the process of securing these messages.</p>
<p>Think of encryption as a process which is easy to do in one direction but rather difficult to do in reverse. One such example is <strong>colour mixing</strong>. One can mix various colours and make a mixture out of it. However, if you ask another person, it would be <em>almost</em> impossible to tell the constituent colours from the mixture.</p>
<h2 id="the_barebones_method_-_symmetric_encryption">The barebones method - symmetric encryption</h2>
<p>The most basic and easy to understand method is the <a href="https://en.wikipedia.org/wiki/Symmetric-key_algorithm">symmetric encryption</a> method. It basically involves the following: Alice, who wants to send a message; Bob, who receives the message; and a secret key used to encrypt the message &#40;essentially turning the message into gibberish&#41;.</p>
<p>Alice has a message, encrypts the message using the secret key, sends the message. Bob now decrypts the message using the same secret key and reads the message. This way during the process when the message is sent, even if a third party gets a hold of the message; they cannot read the message since they do not have the secret key.</p>
<h3 id="caveats">Caveats</h3>
<p>The above method has a major flaw, which is that both the parties must have a common key. That means that the key to be used for encryption must be decided upon by the two parties beforehand. So the two parties have to meet at a place or send the key to the other through some means which isn&#39;t secure, unless one encrypts this key information which requires another key.</p>
<h2 id="a_better_method_-_asymmetric_encryption">A better method - asymmetric encryption</h2>
<p>Asymmetric encryption AKA <a href="https://en.wikipedia.org/wiki/Public-key_cryptography"><em>public-key cryptography</em></a> involves the same scenario as that of symmetric encryption, the only difference being that instead of one secret key, two keys are used &#40;called a <em>key pair</em>&#41;. Let them be <em>key A</em> and <em>key B</em>.</p>
<p>Let us use the same scenario as before: Alice wishes to send a message; she encrypts it with <em>key A</em> and sends it to Bob; he receives it and decrypts it using <em>key B</em>. Note that there was no exchange regarding the information of the keys themselves. <em>Key A</em> cannot be guessed from <em>key B</em> and vice-versa however they are linked in such a way that a message encrypted with <em>key A</em> can only be decrypted with <em>key B</em> and a message encrypted with <em>key B</em> can only be decrypted with <em>key A</em>.</p>
<h3 id="real-world_implications">Real-world implications</h3>
<p>When using asymmetric encryption, a key-pair is generated i.e. a <em>public</em> key and a <em>private</em> key.</p>
<p>The public key is made public &#40;who knew&#33;&#41; and is published everywhere, on websites, posters and so on. The private key is kept to yourself. Any messages intended for you could be then encrypted using your public-key that only you can decrypt since you have the private-key.</p>
<p>What about the other way round? You could encrypt a message that you wish to send, using your private-key. But then you might ask, why should I encrypt a message that can be decrypted using my public-key since anyone can decrypt the message? &#40;since you&#39;ve made your public-key, public&#41;</p>
<h3 id="signature_algorithms">Signature algorithms</h3>
<p>By encrypting the message using your private-key, one can know that the message is authentic since it can be decrypted using your public-key meaning, it must have been encrypted using your private-key which only you have access to.</p>
<h3 id="a_proper_communication">A proper communication</h3>
<p>So the best way to communicate using this protocol would be as follows: Alice has a key-pair and Bob has a key-pair. Alice wishes to send a message; she encrypts it using her private-key <em>ensuring that the message is authentic</em> and then encrypts it again using Bob&#39;s public key <em>ensuring that only Bob can read the message</em>. Bob upon receiving the gibberish decrypts it using his private-key and then once again using Alice&#39;s public-key establishing a secure channel for communication.</p>
<p>Note that in this method no keys were exchanged, in fact, Alice and Bob might not have even met before and this method still works. Isn&#39;t that amazing?</p>
<h2 id="disclaimer">Disclaimer</h2>
<p>I understand that I have over-simplified things. This post is only meant to get a brief overview of encryption. For a better understanding refer the <strong>Crypto 101</strong> textbook linked below.</p>
<hr />
<p>This post was inspired by the book, <a href="https://www.crypto101.io">Crypto 101</a> by Laurens Van Houtven and this <a href="https://www.youtube.com/watch?v&#61;GSIDS_lvRv4">video</a> from the YouTube channel <a href="https://www.youtube.com/user/Computerphile">Computerphile</a> where Dr. Robert Miles explains about public-key encryption.</p>
<p>Lastly, I would like to end this post with a quote from Bruce Schneier:</p>
<blockquote>
<p>There are two kinds of cryptography in this world: cryptography that will stop your kid sister from reading your files, and cryptography that will stop major governments from reading your files.</p>
</blockquote>
 ]]>
  </content:encoded>
    
  <pubDate>Mon, 20 Jul 2020 00:00:00 +0000</pubDate>  
  
  
  <atom:author>
    <atom:name>Ashish Panigrahi</atom:name>
  </atom:author>
        
</item>
</channel></rss>