<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Ashish Panigrahi</title>
    <subtitle>Ashish&#x27;s website</subtitle>
    <link rel="self" type="application/atom+xml" href="https://ashishpanigrahi.com/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-05-26T00:00:00+00:00</updated>
    <id>https://ashishpanigrahi.com/atom.xml</id>
    <entry xml:lang="en">
        <title>New update for this website</title>
        <published>2026-05-26T00:00:00+00:00</published>
        <updated>2026-05-26T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/zola-website/"/>
        <id>https://ashishpanigrahi.com/blog/zola-website/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/zola-website/">&lt;p&gt;It has been a while since I updated my website. Over the years, I&#x27;ve
grown to like minimal yet aesthetic websites which comply with
legibility standards.&lt;&#x2F;p&gt;
&lt;p&gt;Recently, I came across the excellent &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;bearblog.dev&quot;&gt;Bear
blog&lt;&#x2F;a&gt; and was enamored by its simplistic yet
appealing stylistic nature. I think it&#x27;s a great platform to get
started with writing your own blog page. But anyway, I was more
interested in the stylesheet rather than the actual method of
publishing a website. After diving into this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;bearblog.dev&#x2F;discover&#x2F;&quot;&gt;rabbit hole of various
bear blogs&lt;&#x2F;a&gt;, I was pleased to come
across the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;robertbirming.com&#x2F;bearming&#x2F;&quot;&gt;Bearming theme&lt;&#x2F;a&gt; made
by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;robertbirming.com&quot;&gt;Robert Birming&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Along with this, comes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;getzola.org&quot;&gt;Zola&lt;&#x2F;a&gt; which is yet
another static site generator. For now, I&#x27;ve become so accustomed to
the boilerplate that SSG&#x27;s provide that it&#x27;s hard to move onto
something truly minimal&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. But like they say &lt;em&gt;perfectionism is the
enemy of progress&lt;&#x2F;em&gt;, and so here&#x27;s another attempt at updating my
website more frequently&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Now that the stylistic nature of this website is to my liking, I can
write more blogposts about things that interest me. Stay tuned!&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Hopefully I can move my entire website to being built by
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;orgmode.org&quot;&gt;orgmode&lt;&#x2F;a&gt; and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;emacs&#x2F;&quot;&gt;emacs&lt;&#x2F;a&gt; some day. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;Depending on how much free time I can get as a PhD student. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hope (my poem)</title>
        <published>2025-11-18T00:00:00+00:00</published>
        <updated>2025-11-18T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/hope/"/>
        <id>https://ashishpanigrahi.com/blog/hope/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/hope/">&lt;blockquote&gt;
&lt;p&gt;A shining light in the tunnel of darkness.&lt;br &#x2F;&gt;
That&#x27;s how I see hope, with a longingness.&lt;br &#x2F;&gt;
Sometimes good and sometimes bad,&lt;br &#x2F;&gt;
But somehow makes me glad.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Is it hope that I&#x27;m looking for?&lt;br &#x2F;&gt;
Like a drop of water, in a large desert outdoor.&lt;br &#x2F;&gt;
Is it just something made up?&lt;br &#x2F;&gt;
A lie told even after I slipup.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Hope is a dangerous thing.&lt;br &#x2F;&gt;
The results can feel like a swing.&lt;br &#x2F;&gt;
But is it enough to justify my life?&lt;br &#x2F;&gt;
The way I&#x27;m living, with so much strife.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
I keep clinging to this hope.&lt;br &#x2F;&gt;
Even with my life being a downward slope.&lt;br &#x2F;&gt;
Sometimes I fear it won&#x27;t be there.&lt;br &#x2F;&gt;
At that point, would I still care?&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
I find myself in an abyss.&lt;br &#x2F;&gt;
At times, devoid of any bliss.&lt;br &#x2F;&gt;
Hope is the only thing in my mind.&lt;br &#x2F;&gt;
Alas it is hard to see, perhaps I left it too far behind.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Bypassing the storage limit on Zotero with Syncthing</title>
        <published>2025-03-22T00:00:00+00:00</published>
        <updated>2025-03-22T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/zotero-pdf-sync/"/>
        <id>https://ashishpanigrahi.com/blog/zotero-pdf-sync/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/zotero-pdf-sync/">&lt;p&gt;Recently, I found out about this neat little trick to bypass the
storage limit on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;zotero.org&quot;&gt;Zotero&lt;&#x2F;a&gt; for PDFs. Currently on
the &quot;free&quot; tier there is a limit of 300 MB which fills up pretty
quickly when you&#x27;re doing serious research. This guide helps bypass
this limit (subject to your computer&#x27;s storage).&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;zotero-storage-price.png&quot; style=width:55%&gt;
&lt;figcaption&gt;The current pricing model. Not bad but you don&#x27;t need it
if it&#x27;s just for personal use.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;The prices are there for if you&#x27;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 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Peer-to-peer&quot;&gt;peer-to-peer&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Best part is it&#x27;s &lt;strong&gt;free&lt;&#x2F;strong&gt;!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prior-situation&quot;&gt;Prior situation&lt;&#x2F;h3&gt;
&lt;p&gt;Usually if you&#x27;re employed at a university&#x2F;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&#x27;re
on the institute&#x27;s intranet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-location-for-pdfs&quot;&gt;Storage location for PDFs&lt;&#x2F;h3&gt;
&lt;p&gt;On Linux&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, by default I believe Zotero creates a directory
&lt;code&gt;~&#x2F;Zotero&#x2F;&lt;&#x2F;code&gt; for storage of files, notes and metadata. I usually create
my own custom location for the directory, &lt;code&gt;~&#x2F;.zotero&#x2F;&lt;&#x2F;code&gt; in this case as
I don&#x27;t like having my home directory cluttered&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To change this, go to &lt;strong&gt;Edit -&amp;gt; Settings -&amp;gt; Advanced&lt;&#x2F;strong&gt; and under
&quot;&lt;strong&gt;Data Directory Location&lt;&#x2F;strong&gt;&quot; you can specify a custom path.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;zotero-location.png&quot;&gt;
&lt;figcaption&gt;Dialog box for specifying custom location for Zotero directory.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;Now assuming you already have a sizeable zotero
database, we go to this location and are interested in the
&lt;code&gt;~&#x2F;.zotero&#x2F;storage&lt;&#x2F;code&gt; folder. This is where the PDFs are stored.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;changing-a-few-settings&quot;&gt;Changing a few settings&lt;&#x2F;h4&gt;
&lt;p&gt;Now, by default Zotero syncs all your files to the cloud. We don&#x27;t
want that. To disable it, go to &lt;strong&gt;Edit -&amp;gt; Settings -&amp;gt; Sync&lt;&#x2F;strong&gt; and under
&lt;strong&gt;File Syncing&lt;&#x2F;strong&gt; uncheck both &quot;Sync attachment files in My Library&quot; and
&quot;Sync attachment files in group libraries using Zotero storage&quot;.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;zotero-syncing.png&quot;&gt;
&lt;figcaption&gt;Uncheck both the boxes.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;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&#x27;s where peer-to-peer syncing comes
in.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;syncing-with-syncthing&quot;&gt;Syncing with Syncthing&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;syncthing.net&quot;&gt;Syncthing&lt;&#x2F;a&gt; is an excellent piece of software.
As described on their website:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Syncthing is a &lt;strong&gt;continuous file synchronization&lt;&#x2F;strong&gt; program.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Basically it helps sync files between different computers in a
peer-to-peer fashion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;quickstart-guide&quot;&gt;Quickstart guide&lt;&#x2F;h3&gt;
&lt;p&gt;I would highly recommend the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.syncthing.net&#x2F;intro&#x2F;getting-started.html&quot;&gt;official
user-guide&lt;&#x2F;a&gt; for
using syncthing. However, the following covers a quick and brief guide
to getting syncing setup with Zotero.&lt;&#x2F;p&gt;
&lt;p&gt;Launching &lt;code&gt;syncthing&lt;&#x2F;code&gt; in a terminal opens up &lt;code&gt;localhost:8384&lt;&#x2F;code&gt; on your
web browser and you&#x27;re greeted with the GUI.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;syncthing-gui.png&quot; style=width:100%&gt;
&lt;figcaption&gt;Syncthing GUI&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;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 &lt;em&gt;zotero storage&lt;&#x2F;em&gt; folder synced with my office PC
and some other folders synced with my Android phone.&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;Add Folder&quot; button is a good starting point. Clicking it leads us
to a dialog box asking for a &lt;em&gt;folder label&lt;&#x2F;em&gt; and a &lt;em&gt;folder path&lt;&#x2F;em&gt;. The
latter is important. For now, just ignore the &lt;em&gt;folder ID&lt;&#x2F;em&gt; 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.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;syncthing-add-folder.png&quot; style=width:90%&gt;
&lt;figcaption&gt;Adding folder for syncing.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;Now, just set the folder path to &lt;code&gt;~&#x2F;.zotero&#x2F;storage&lt;&#x2F;code&gt; (or whatever is
the custom folder path you&#x27;ve set in Zotero) and click save.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;adding-remote-device&quot;&gt;Adding remote device&lt;&#x2F;h4&gt;
&lt;p&gt;On the secondary device that you&#x27;d like to access your PDFs on (laptop
or perhaps a desktop at your office like me), 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.&lt;&#x2F;p&gt;
&lt;p&gt;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;.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;syncthing-add-device.png&quot; style=width:100%&gt;
&lt;figcaption&gt;Accessing QR code for current device.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;Follow similar instructions on the remote device for setting up a sync
folder (should be empty as for the first sync, we&#x27;re really
transferring PDFs from the main device to the remote one). Make sure
to have the same path in your Zotero settings on the remote device!&lt;&#x2F;p&gt;
&lt;p&gt;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 &lt;em&gt;zotero-storage&lt;&#x2F;em&gt;
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&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And just hit save.&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;syncthing-share-folder.png&quot; style=width:90%&gt;
&lt;figcaption&gt;Sharing the folder with remote device.&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;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! Of course, you can add more devices if you&#x27;d like.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;ve been extremely happy with this setup and I hope it&#x27;s useful to
you as it has been for me, thanks to my friend
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;marci.gunyho.com&quot;&gt;Marci&lt;&#x2F;a&gt; who introduced me to the idea.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;This guide assumes you&#x27;re using Linux but I see no reason why it
cannot be adapter for Windows and macOS. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;To actually keep your &lt;code&gt;~&#x2F;&lt;&#x2F;code&gt; uncluttered, the best approach would be
something along the lines of &lt;code&gt;~&#x2F;.local&#x2F;share&#x2F;zotero&lt;&#x2F;code&gt; which is
&lt;code&gt;XDG_DATA_HOME&lt;&#x2F;code&gt; according to XDG standards. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;Don&#x27;t worry about the &quot;enter encryption password&quot;. You only need it if
you&#x27;re concerned with security and would like to have encrypted
folders. I don&#x27;t really care about that for zotero so I leave it unchecked. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>When did I stop being a child? (my poem)</title>
        <published>2024-06-19T00:00:00+00:00</published>
        <updated>2024-06-19T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/when-did-i-become-an-adult/"/>
        <id>https://ashishpanigrahi.com/blog/when-did-i-become-an-adult/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/when-did-i-become-an-adult/">&lt;blockquote&gt;
&lt;p&gt;When did I stop being a child?&lt;br &#x2F;&gt;
It&#x27;s been so long, but I used to be quite beguiled.&lt;br &#x2F;&gt;
While I reminisce the days of not caring about the world.&lt;br &#x2F;&gt;
I wonder, when that child stopped being one, as an adult labelled.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Perhaps it was when my interests changed.&lt;br &#x2F;&gt;
Things that I used to like, now feel estranged.&lt;br &#x2F;&gt;
Oh, how I wish I could go back to those simpler times.&lt;br &#x2F;&gt;
That child exists no more, but an adult begrimed.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Carefree is the emotion I took for granted.&lt;br &#x2F;&gt;
Now that I&#x27;m older, responsibilities have been handed.&lt;br &#x2F;&gt;
I remember a time when I used to run wild.&lt;br &#x2F;&gt;
Oh, but when did I stop being a child?&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
As I grow old, my anxiety only becomes stronger.&lt;br &#x2F;&gt;
Is adulthood really supposed to be this way, with nothing more to offer?&lt;br &#x2F;&gt;
Alas, it is too late now to think about a time bygone.&lt;br &#x2F;&gt;
But the only way forward, is to look ahead and march into the unknown.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>What is my purpose (my poem)</title>
        <published>2024-04-21T00:00:00+00:00</published>
        <updated>2024-04-21T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/what-is-my-purpose/"/>
        <id>https://ashishpanigrahi.com/blog/what-is-my-purpose/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/what-is-my-purpose/">&lt;blockquote&gt;
&lt;p&gt;What is my purpose but a tiny speck on this big blue dot?&lt;br &#x2F;&gt;
Is it already decided or do I get myself taught?&lt;br &#x2F;&gt;
I do wonder how the rest of my life shall continue.&lt;br &#x2F;&gt;
Will it be the same things I now pursue?&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Family it is for some people.&lt;br &#x2F;&gt;
For others, it is their career to excel.&lt;br &#x2F;&gt;
But does it matter in the end?&lt;br &#x2F;&gt;
Perhaps the greater reason is to make oneself enlighten.&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
Often I find myself asking such questions.&lt;br &#x2F;&gt;
I keep looking for entities of substance&lt;br &#x2F;&gt;
in this rollercoaster that is life.&lt;br &#x2F;&gt;
What can I do to make it more rife?&lt;br &#x2F;&gt;
&lt;br &#x2F;&gt;
For far too long I&#x27;ve been looking far away.&lt;br &#x2F;&gt;
Always fearing that my life might go astray.&lt;br &#x2F;&gt;
Is it deep down something more precious?&lt;br &#x2F;&gt;
Only to find myself asking, &quot;what is my purpose?&quot;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Switching to GNU Emacs</title>
        <published>2024-04-14T00:00:00+00:00</published>
        <updated>2024-04-14T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/switching-to-emacs/"/>
        <id>https://ashishpanigrahi.com/blog/switching-to-emacs/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/switching-to-emacs/">&lt;p&gt;Over the past five years, I&#x27;ve been using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.vim.org&quot;&gt;Vim&lt;&#x2F;a&gt;
(well &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;neovim.io&quot;&gt;NeoVim&lt;&#x2F;a&gt; specifically) 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! The point is, once you understand how modal editing works,
any other form of text editing feels like it&#x27;s from the stone ages.&lt;&#x2F;p&gt;
&lt;p&gt;Now you might ask, why am I switching to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;emacs&#x2F;&quot;&gt;GNU
Emacs&lt;&#x2F;a&gt;, the opposing contender to
Vim in the well known &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Editor_war&quot;&gt;editor
war&lt;&#x2F;a&gt;? Well, the more &quot;silly&quot;
reason is that it gives me an opportunity to learn a new piece of
software, understand it&#x27;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 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Emacs_Lisp&quot;&gt;Emacs lisp&lt;&#x2F;a&gt;,
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
(one of the charms of Emacs) 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.&lt;&#x2F;p&gt;
&lt;p&gt;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 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;orgmode.org&quot;&gt;org-mode&lt;&#x2F;a&gt; (Task
management system with a markup style of its own) and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;magit.vc&#x2F;&quot;&gt;Magit&lt;&#x2F;a&gt; (A Git porcelain inside Emacs). One of the
primary reasons I&#x27;ve decided to switch is due to org-mode (which I
intend to cover in detail in subsequent blog entries).&lt;&#x2F;p&gt;
&lt;p&gt;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&#x27;m still very new
to Emacs but the quote does hold some truth. Emacs (atleast from my
first impressions) has esoteric keybindings which are completely
foreign to new users let alone someone coming from a vim background.
&lt;code&gt;Ctrl&lt;&#x2F;code&gt; and &lt;code&gt;Alt&lt;&#x2F;code&gt; (known as &lt;code&gt;Meta&lt;&#x2F;code&gt; in Emacs parlance) 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
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;52492&#x2F;what-is-the-best-way-to-avoid-getting-emacs-pinky&quot;&gt;Emacs
pinky&lt;&#x2F;a&gt;
which is basically &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Repetitive_strain_injury&quot;&gt;repetitive strain injury
(RSI)&lt;&#x2F;a&gt;. For
this reason, I will be using emacs with
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;emacs-evil&#x2F;evil&quot;&gt;Evil&lt;&#x2F;a&gt; which is the Vi-emulation
package in emacs, atleast until I get the hang of working with Emacs
before perhaps trying the stock keybindings (which apparently most of
the emacs community adheres to).&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;real_programmers.png&quot;&gt;
&lt;figcaption&gt;Relevant xkcd&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Easy fix for F4 mute LED light on ThinkPad laptops on GNU&#x2F;Linux</title>
        <published>2023-09-05T00:00:00+00:00</published>
        <updated>2023-09-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/thinkpad-micmute-led/"/>
        <id>https://ashishpanigrahi.com/blog/thinkpad-micmute-led/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/thinkpad-micmute-led/">&lt;p&gt;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 (4 cores) CPU. The
upgrade is quite significant, coming with an eight core AMD Ryzen 7 CPU... but I
digress.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-problem&quot;&gt;The Problem&lt;&#x2F;h3&gt;
&lt;p&gt;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&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, macOS works well on Apple devices. With GNU&#x2F;Linux&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;
however, almost all machines work but the tiny quality of life
improvements like those media key lights can be a hit or miss.&lt;&#x2F;p&gt;
&lt;p&gt;As usual, I went ahead and installed &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;archlinux.org&quot;&gt;Arch Linux&lt;&#x2F;a&gt; on my
machine with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dwm.suckless.org&quot;&gt;dwm&lt;&#x2F;a&gt; as my window manager. After the
installation and a test drive of my laptop, I see this...&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;thinkpad-micmute-led.jpg&quot;&gt;
&lt;figcaption&gt;The annoying led being always ON&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;At first I thought perhaps it&#x27;s a driver issue but all my drivers were up-to-date.
Looking through the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&quot;&gt;Arch wiki&lt;&#x2F;a&gt; didn&#x27;t help with the
issue. Knowing the vibrant thinkpad community, I ended up posting about my problem on
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;reddit.com&#x2F;r&#x2F;thinkpad&quot;&gt;r&#x2F;thinkpad&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-fix&quot;&gt;Simple Fix&lt;&#x2F;h3&gt;
&lt;p&gt;I&#x27;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:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;: $ cat &#x2F;sys&#x2F;class&#x2F;leds&#x2F;platform::micmute&#x2F;brightness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&#x27;1&#x27; here represents the light in the ON state, which is exactly the problem!
&lt;del&gt;Changing the value to &#x27;0&#x27; in the file instantly fixes the problem!&lt;&#x2F;del&gt;
Changing it to &#x27;0&#x27; 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 &lt;code&gt;.xprofile&lt;&#x2F;code&gt; or &lt;code&gt;.xinitrc&lt;&#x2F;code&gt; file
(most people would use &lt;code&gt;.xinitrc&lt;&#x2F;code&gt;) by adding the following line in said file:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; &#x2F;sys&#x2F;class&#x2F;leds&#x2F;platform::micmute&#x2F;brightness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This line simply replaces whatever the file previously had, with &#x27;0&#x27;. This works
rather well until I find a more permanent solution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edit&quot;&gt;Edit&lt;&#x2F;h3&gt;
&lt;p&gt;Unfortunately, the above method doesn&#x27;t work anymore. I&#x27;m not exactly sure what changed but
apparently it isn&#x27;t supposed to work in the first place simply because &lt;code&gt;&#x2F;sys&#x2F;class&#x2F;leds&#x2F;platform::micmute&#x2F;brightness&lt;&#x2F;code&gt; isn&#x27;t a real directory.&lt;&#x2F;p&gt;
&lt;p&gt;In any case, here&#x27;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
(openrc, runit, etc.), I assume it&#x27;s fairly simply to make the relevant changes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Create a shell script &lt;code&gt;disable-mute.sh&lt;&#x2F;code&gt; in your preferred directory
(&lt;code&gt;~&#x2F;.local&#x2F;bin&#x2F;&lt;&#x2F;code&gt; in my case) containing the following:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt;&#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;echo&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt; tee&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; &#x2F;sys&#x2F;class&#x2F;leds&#x2F;platform::micmute&#x2F;brightness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;With root privileges, create a file &lt;code&gt;disable-mute.service&lt;&#x2F;code&gt; in
&lt;code&gt;&#x2F;etc&#x2F;systemd&#x2F;system&#x2F;&lt;&#x2F;code&gt; with the following content&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Unit]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Description=Disables the annoying mute light on keyboard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;After=multi-user.target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Service]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ExecStart=&#x2F;bin&#x2F;sh &#x2F;home&#x2F;ashish&#x2F;.local&#x2F;bin&#x2F;disable-mute.sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Type=simple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[Install]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;WantedBy=multi-user.target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Simply run &lt;code&gt;sudo systemctl enable disable-mute.service&lt;&#x2F;code&gt; and the LED should turn off
the next time you boot up your machine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Late 2024 Update&lt;&#x2F;strong&gt;: This method works so far for the 6.6-LTS Kernel,
NOT the bleeding edge one.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;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. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;Technically Linux is the kernel and not the operating system (the rest
is supplied by the GNU operating system sans its own kernel).
&lt;a href=&quot;https:&#x2F;&#x2F;www.gnu.org&#x2F;gnu&#x2F;why-gnu-linux.html&quot;&gt;Here&lt;&#x2F;a&gt; is a better
explanation. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;linuxhandbook.com&#x2F;create-systemd-services&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;
for a detailed tutorial on writing systemd service files. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hello, World in Qiskit</title>
        <published>2021-07-16T00:00:00+00:00</published>
        <updated>2021-07-16T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/qiskit-hello-world/"/>
        <id>https://ashishpanigrahi.com/blog/qiskit-hello-world/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/qiskit-hello-world/">&lt;p&gt;Qiskit is a python SDK for simulating and running quantum algorithms on real quantum
computers. As mentioned on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;qiskit.org&#x2F;&quot;&gt;qiskit.org&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Qiskit [kiss-kit] is an open-source SDK for working with quantum computers at the
level of pulses, circuits and application modules.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;measuring-a-quantum-state&quot;&gt;Measuring a quantum state&lt;&#x2F;h2&gt;
&lt;p&gt;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 (this seems to be the most rudimentary but complete
program in quantum terms). Let&#x27;s proceed to do just that!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;defining-a-quantum-state&quot;&gt;Defining a quantum state&lt;&#x2F;h3&gt;
&lt;p&gt;We import the necessary modules from Qiskit for this operation. To define a quantum
circuit, we require the classes &lt;code&gt;QuantumCircuit&lt;&#x2F;code&gt;, &lt;code&gt;QuantumRegister&lt;&#x2F;code&gt;,
&lt;code&gt;ClassicalRegister&lt;&#x2F;code&gt; and define a state variable &lt;code&gt;psi&lt;&#x2F;code&gt; as&lt;&#x2F;p&gt;
&lt;p&gt;$$
| \psi \rangle =
\frac{1}{\sqrt{2}}
\begin{pmatrix}
1\
1
\end{pmatrix}
$$&lt;&#x2F;p&gt;
&lt;p&gt;Notice that the state $| \psi \rangle$ is normalized. This is important, otherwise we&#x27;ll end up with an error.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; qiskit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; QuantumCircuit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; QuantumRegister&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ClassicalRegister&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; sqrt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt; define an initial state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;psi&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;sqrt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;sqrt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We then define a function &lt;code&gt;prepare()&lt;&#x2F;code&gt; which takes two parameters: a &lt;code&gt;QuantumCircuit&lt;&#x2F;code&gt;
object named &lt;code&gt;qc&lt;&#x2F;code&gt; and the initial state &lt;code&gt;psi&lt;&#x2F;code&gt;. Remember that the quantum circuit that
we define, only uses 1 qubit (notice the vector representation of $| \psi \rangle$).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt; prepare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; psi&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    qc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;psi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt; [0] indicates the zeroth index (or) the first qubit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Python by default, calls by reference, so we don&#x27;t have to worry about returning
anything from &lt;code&gt;prepare()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;building-a-quantum-circuit&quot;&gt;Building a quantum circuit&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s proceed with making an actual quantum circuit. For this, we define a
&lt;code&gt;QuantumRegister&lt;&#x2F;code&gt; object &lt;code&gt;qr&lt;&#x2F;code&gt;, which stores the qubits and a &lt;code&gt;ClassicalRegister&lt;&#x2F;code&gt;
object &lt;code&gt;cr&lt;&#x2F;code&gt; which stores the measured values of those qubits.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; QuantumRegister&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cr&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ClassicalRegister&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Combining the two registers, we now make a quantum circuit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qc&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; QuantumCircuit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;initializing-and-measuring-the-qubit&quot;&gt;Initializing and measuring the qubit&lt;&#x2F;h3&gt;
&lt;p&gt;We then call our function &lt;code&gt;prepare()&lt;&#x2F;code&gt; to initialize the first qubit (the only qubit)
of our quantum circuit &lt;code&gt;qc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;prepare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; psi&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;How do we go about measuring our state? That&#x27;s where the &lt;code&gt;ClassicalRegister&lt;&#x2F;code&gt; object
&lt;code&gt;cr&lt;&#x2F;code&gt; comes in. We use the &lt;code&gt;measure&lt;&#x2F;code&gt; method under the &lt;code&gt;qc&lt;&#x2F;code&gt; object to actually measure
the qubit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;measure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qr&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cr&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above syntax generally means that we&#x27;re measuring the state of &lt;code&gt;qr[0]&lt;&#x2F;code&gt; (the first
qubit) onto the classical register &lt;code&gt;cr[0]&lt;&#x2F;code&gt; where we store the measured value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;visualizing-the-circuit&quot;&gt;Visualizing the circuit&lt;&#x2F;h2&gt;
&lt;p&gt;Ok so all of this is nice, but one can only describe so much. Let&#x27;s see how our
circuit actually looks like after applying the above operations. For this, we use the
&lt;code&gt;draw()&lt;&#x2F;code&gt; method with the &lt;code&gt;matplotlib&lt;&#x2F;code&gt; backend.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; qc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;draw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E36209, #FFAB70);&quot;&gt;output&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;mpl&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;figure&gt;
&lt;center&gt;
    &lt;img src=&quot;&#x2F;images&#x2F;qc.png&quot; style=&quot;width:50%&quot;&gt;
&lt;&#x2F;center&gt;
&lt;&#x2F;figure&gt;
&lt;h2 id=&quot;choosing-a-backend-for-measurement&quot;&gt;Choosing a backend for measurement&lt;&#x2F;h2&gt;
&lt;p&gt;To measure the qubit and store the result in the classical register &lt;code&gt;cr&lt;&#x2F;code&gt;, we use the
&lt;code&gt;qasm_simulator&lt;&#x2F;code&gt; backend. As we know from basic quantum mechanics,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; qiskit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Aer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backend&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Aer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_backend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;qasm_simulator&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We then transpile our circuit for the &lt;code&gt;qasm_simulator&lt;&#x2F;code&gt; backend to understand and
execute the circuit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; qiskit&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; transpile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qc_compiled&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transpile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; backend&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now, we simply execute the circuit and gather the measurement results.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;job&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; backend&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;run&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qc_compiled&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#E36209, #FFAB70);&quot;&gt; shots&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;1024&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6A737D, #6A737D);&quot;&gt; shots is the number of times we run the experiment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;results&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; job&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We store the value of the &lt;code&gt;result&lt;&#x2F;code&gt; object and can further access the number of times we end up with a certain value of expected outcome with the &lt;code&gt;get_counts()&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;counts&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; results&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_counts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;qc_compiled&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;counts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;#39;0&amp;#39;: 518, &amp;#39;1&amp;#39;: 506}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here we end up with a dictionary of key values &lt;code&gt;&#x27;0&#x27;&lt;&#x2F;code&gt; and &lt;code&gt;&#x27;1&#x27;&lt;&#x2F;code&gt;, which indicate the following quantum states:&lt;&#x2F;p&gt;
&lt;p&gt;$$
| 0 \rangle =
\begin{pmatrix}
1\
0
\end{pmatrix}
\qquad
| 1 \rangle =
\begin{pmatrix}
0\
1
\end{pmatrix}
$$&lt;&#x2F;p&gt;
&lt;p&gt;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,&lt;&#x2F;p&gt;
&lt;p&gt;$$
|\langle 0 | \psi \rangle|^2 = \frac{1}{2} \qquad |\langle 1 | \psi \rangle|^2 = \frac{1}{2}
$$&lt;&#x2F;p&gt;
&lt;p&gt;Let&#x27;s visualize this in the form of a histogram. For this, we import the
&lt;code&gt;plot_histogram&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; qiskit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;visualization&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; plot_histogram&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; plot_histogram&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;counts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;figure&gt;
&lt;center&gt;
    &lt;img src=&quot;&#x2F;images&#x2F;histogram.png&quot; style=&quot;width:80%&quot;&gt;
&lt;&#x2F;center&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;You can find the entire script in this
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;paniash&#x2F;52497bf574ea4570ce5f0a21fa093b12&quot;&gt;gist&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Font Rendering in Firefox</title>
        <published>2021-05-30T00:00:00+00:00</published>
        <updated>2021-05-30T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/firefox-fonts/"/>
        <id>https://ashishpanigrahi.com/blog/firefox-fonts/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/firefox-fonts/">&lt;p&gt;If you&#x27;re on a *nix system and compare the fonts on chrome and firefox, you&#x27;d notice
the difference. The fonts on the latter just look... &lt;em&gt;off&lt;&#x2F;em&gt;, or atleast that was the
case on my system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;my-personal-odyssey&quot;&gt;My personal odyssey&lt;&#x2F;h2&gt;
&lt;p&gt;Recently I had made the switch from firefox to brave, for the naive reason that fonts
were just rendered better (and LaTeX looks like it) on it (being a chromium based
browser). However, I really missed the customizability and other nifty features of
firefox. It just felt like home. I knew for sure that I&#x27;m missing something, because
surely firefox couldn&#x27;t be responsible for messing fonts, right? (atleast I hoped).&lt;&#x2F;p&gt;
&lt;p&gt;On firefox, you may have come across the font settings that look something like this:&lt;&#x2F;p&gt;
&lt;center&gt;
&lt;img src=&quot;&#x2F;images&#x2F;firefox-font.png&quot;&gt;
&lt;&#x2F;center&gt;
&lt;p&gt;My past self would unselect the option &lt;em&gt;&lt;strong&gt;Allow pages to choose their own fonts,
instead of your selections above&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, 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 &#x27;90s PC trying to render math.&lt;&#x2F;p&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-fix&quot;&gt;The fix&lt;&#x2F;h2&gt;
&lt;p&gt;I later came across
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nolanlawson.com&#x2F;2020&#x2F;05&#x2F;02&#x2F;customizing-fonts-in-firefox-on-linux&#x2F;&quot;&gt;this&lt;&#x2F;a&gt;
blog post where I got to know that firefox depends on an OS-level font configuration
called &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;Font_configuration&quot;&gt;fontconfig&lt;&#x2F;a&gt; and is
located at &lt;code&gt;~&#x2F;.config&#x2F;fontconfig&#x2F;fonts.conf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create-a-fontconfig-file&quot;&gt;Create a fontconfig file&lt;&#x2F;h3&gt;
&lt;p&gt;If you don&#x27;t have one, just create it at the specific location.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;xml&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;?&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;!&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;DOCTYPE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; fontconfig&lt;&#x2F;span&gt;&lt;span&gt; SYSTEM &amp;#39;fonts.dtd&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;fontconfig&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Helvetica&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;IBM Plex Sans&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;sans-serif&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;IBM Plex Sans&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;monospace&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;DejaVu Sans Mono&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;family&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;prefer&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;alias&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#22863A, #85E89D);&quot;&gt;fontconfig&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;p&gt;The above XML file tells firefox that, &quot;Hey! If you&#x27;re trying to render Helvetica,
just use IBM Plex Sans&quot;, and similar font rules for sans-serif and monospace fonts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-result&quot;&gt;The result&lt;&#x2F;h3&gt;
&lt;figure&gt;
&lt;center&gt;
    &lt;img src=&quot;&#x2F;images&#x2F;oldfonts.png&quot; style=&quot;width:100%&quot;&gt;
    &lt;figcaption&gt;Daniel&lt;&#x2F;figcaption&gt;
    &lt;br&gt;&lt;&#x2F;br&gt;
    &lt;img src=&quot;&#x2F;images&#x2F;newfonts.png&quot; style=&quot;width:100%&quot;&gt;
    &lt;figcaption&gt;The cooler Daniel&lt;&#x2F;figcaption&gt;
&lt;&#x2F;center&gt;
&lt;&#x2F;figure&gt;
&lt;p&gt;I was really happy when I came across this fix! and I hope this has helped you as
well.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Intro to Public-key Cryptography</title>
        <published>2020-07-20T00:00:00+00:00</published>
        <updated>2020-07-20T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ashishpanigrahi.com/blog/cryptography-intro/"/>
        <id>https://ashishpanigrahi.com/blog/cryptography-intro/</id>
        
        <content type="html" xml:base="https://ashishpanigrahi.com/blog/cryptography-intro/">&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;p&gt;In layman terms, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cryptography&quot;&gt;&lt;em&gt;cryptography&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; is the
study of securing messages between two parties without a third party knowing what the
message is. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Encryption&quot;&gt;&lt;em&gt;Encryption&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; is the process
of securing these messages.&lt;&#x2F;p&gt;
&lt;p&gt;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 &lt;strong&gt;colour mixing&lt;&#x2F;strong&gt;. One can mix
various colours and make a mixture out of it. However, if you ask another person, it
would be &lt;em&gt;almost&lt;&#x2F;em&gt; impossible to tell the constituent colours from the mixture.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-barebones-method-symmetric-encryption&quot;&gt;The barebones method - symmetric encryption&lt;&#x2F;h2&gt;
&lt;p&gt;The most basic and easy to understand method is the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Symmetric-key_algorithm&quot;&gt;symmetric
encryption&lt;&#x2F;a&gt; 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 (essentially
turning the message into gibberish).&lt;&#x2F;p&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;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&#x27;t secure, unless one encrypts this key
information which requires another key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;a-better-method-asymmetric-encryption&quot;&gt;A better method - asymmetric encryption&lt;&#x2F;h2&gt;
&lt;p&gt;Asymmetric encryption AKA &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Public-key_cryptography&quot;&gt;&lt;em&gt;public-key
cryptography&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; involves the
same scenario as that of symmetric encryption, the only difference being that instead
of one secret key, two keys are used (called a &lt;em&gt;key pair&lt;&#x2F;em&gt;). Let them be &lt;em&gt;key A&lt;&#x2F;em&gt; and
&lt;em&gt;key B&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let us use the same scenario as before: Alice wishes to send a message; she encrypts
it with &lt;em&gt;key A&lt;&#x2F;em&gt; and sends it to Bob; he receives it and decrypts it using &lt;em&gt;key B&lt;&#x2F;em&gt;.
Note that there was no exchange regarding the information of the keys themselves.
&lt;em&gt;Key A&lt;&#x2F;em&gt; cannot be guessed from &lt;em&gt;key B&lt;&#x2F;em&gt; and vice-versa however they are linked in such
a way that a message encrypted with &lt;em&gt;key A&lt;&#x2F;em&gt; can only be decrypted with &lt;em&gt;key B&lt;&#x2F;em&gt; and a
message encrypted with &lt;em&gt;key B&lt;&#x2F;em&gt; can only be decrypted with &lt;em&gt;key A&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;real-world-implications&quot;&gt;Real-world implications&lt;&#x2F;h3&gt;
&lt;p&gt;When using asymmetric encryption, a key-pair is generated i.e. a &lt;em&gt;public&lt;&#x2F;em&gt; key and a
&lt;em&gt;private&lt;&#x2F;em&gt; key.&lt;&#x2F;p&gt;
&lt;p&gt;The public key is made public (who knew!) 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.&lt;&#x2F;p&gt;
&lt;p&gt;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? (since
you&#x27;ve made your public-key, public)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-algorithms&quot;&gt;Signature algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-proper-communication&quot;&gt;A proper communication&lt;&#x2F;h3&gt;
&lt;p&gt;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 &lt;em&gt;ensuring that the message is authentic&lt;&#x2F;em&gt; and then encrypts it
again using Bob&#x27;s public key &lt;em&gt;ensuring that only Bob can read the message&lt;&#x2F;em&gt;. Bob upon
receiving the gibberish decrypts it using his private-key and then once again using
Alice&#x27;s public-key establishing a secure channel for communication.&lt;&#x2F;p&gt;
&lt;p&gt;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&#x27;t that amazing?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;disclaimer&quot;&gt;Disclaimer&lt;&#x2F;h2&gt;
&lt;p&gt;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 &lt;strong&gt;Crypto 101&lt;&#x2F;strong&gt;
textbook linked below.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;This post was inspired by the book, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.crypto101.io&quot;&gt;Crypto 101&lt;&#x2F;a&gt; by Laurens
Van Houtven and this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=GSIDS_lvRv4&quot;&gt;video&lt;&#x2F;a&gt; from the
YouTube channel &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;user&#x2F;Computerphile&quot;&gt;Computerphile&lt;&#x2F;a&gt; where Dr.
Robert Miles explains about public-key encryption.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, I would like to end this post with a quote from Bruce Schneier:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;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.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
        
    </entry>
</feed>
