Something went wrong. Try again.
Something went wrong. Try again.
kaychaks.github.io atom.xml
85 kB · 759 lines
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"> <title>Kaushikc.Org</title> <link href="https://kaushikc.org/atom.xml" rel="self" /> <link href="https://kaushikc.org" /> <id>https://kaushikc.org/atom.xml</id> <author> <name>Kaushik Chakraborty</name> <email>feed@kaushikc.org</email> </author> <updated>2020-04-10T00:00:00Z</updated> <entry> <title>Declarative, Decentralised, and Secure communication via Matrix, Jitsi, & NixOS</title> <link href="https://kaushikc.org/posts/matrix-jitsi-nixos.html" /> <id>https://kaushikc.org/posts/matrix-jitsi-nixos.html</id> <published>2020-04-10</published> <updated>2020-04-10T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/matrix-jitsi-nixos.html"> Declarative, Decentralised, and Secure communication via Matrix, Jitsi, & NixOS </a> <a href="/posts/matrix-jitsi-nixos.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">April 10, 2020</p> <p class="author"><a title="All pages tagged 'technology'." href="/tags/technology.html">technology</a>, <a title="All pages tagged 'nixos'." href="/tags/nixos.html">nixos</a></p></div><div class="bodycopy"> <p>It has been one of my strong pursuit to figure out a properly encrypted and decentralisedcommunication setup. <a href="matrix.org">Matrix</a>’s claim to provide that is prettystrong against other alternatives. I’ve been using <a href="riot.im">Riot</a>, the most feature richMatrix client, but mainly as an IRC bouncer.</p><p>Just the other day I read thisawesome guide on <em><a href="https://matrix.org/blog/2020/04/06/running-your-own-secure-communication-service-with-matrix-and-jitsi">Running your own secure communication service with Matrix andJitsi</a></em>and realised it’s not that difficult nowadays to setup all the pieces of thepuzzle.</p><p>And so if I want to follow those steps shown in the above article but ratherdo it in NixOS - another project I am really excited about - how easy/difficultit would be ?</p><p>Well apart from minor tweaks, it was pretty straightforward and I would arguemore simpler than how its done for a Debian based system. Following is therundown of how I made the relevant steps work for my setup. I am not going torepeat all the nice technical explanations of above article. So anyone following<strong>should </strong>first read the above article.</p><p>Before we begin, I would also like to address one difference from the basic premise ofthe above article - Unlike in the above article the main domain(<em>dangerousdemos.net</em>) is already pointing to an existing blog <a href="https://help.github.com/en/github/working-with-github-pages/configuring-a-custom-domain-for-your-github-pages-site">hosted from aGithubrepository</a>.I think this might be a case for many like me who already have a domain nameserving a static blog (like this one) butwant to setup Matrix via the subdomains.</p><p>So lets begin,</p><h2 id="nixos">NixOS</h2><p>With NixOS every step is declarative and hence we don’t have to worry about themechanical rigor as is the case with most of the steps in the original article.What it entails for us broadly are these 3 steps (<em>apart from some additional stuff</em>)</p><ul><li>Update <code>/etc/nixos/configuration.nix</code></li><li>Run <code>sudo nixos-rebuild switch</code></li><li>Done!</li></ul><p><a href="https://nixos.org/">NixOS</a> made following the original article really easy as I could makemistakes and not worry because I could rollback and start again. Let that sinkin as I think that in itself is mind-blowing.</p><h2 id="dns">DNS</h2><p>Let’s use the same domain name - <em>dangerousdemos.net</em> - as used in the originalarticle for our explanations. As mentioned above, we have one change here that the root domainalready is redirecting to the static blog hosted in Github Pages. So we need tosetup <code>A</code> records for the following subdomains:</p><ul><li><code>matrix.dangerousdemos.net</code> (for Synapse)</li><li><code>riot.dangerousdemos.net</code> (for Riot/Web)</li><li><code>jitsi.dangerousdemos.net</code> (for Jitsi)</li><li><em><code>turn.dangerousdemos.net</code></em> (for coturn based <code>TURN</code> server that in original article istaken care by <code>jitsi-meet</code> installer)</li></ul><p><em>Its important for all these to setup in the DNS before we run our configurationsso that LetsEncrypt challenge flow works fine or else we might face errors.</em></p><h2 id="firewall">Firewall</h2><p>We need to ensure that following ports are open in the NixOS firewall for allthe configurations to work fine</p><div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">networking.firewall</span> = {</span><span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">allowedUDPPorts</span> = [ 5349 5350]<span class="kw">;</span></span><span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">allowedTCPPorts</span> = [ 80 443 3478 3479]<span class="kw">;</span></span><span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span></span></code></pre></div><h2 id="nginx-with-letsencrypt">Nginx with LetsEncrypt</h2><div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">services.nginx</span> = {</span><span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">enable</span> = true<span class="kw">;</span></span><span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">virtualHosts</span> = {</span><span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a> <span class="co">## virtual host for Syapse</span></span><span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"matrix.dangerousdemos.net"</span> = {</span><span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> <span class="co">## for force redirecting HTTP to HTTPS</span></span><span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> <span class="ex">forceSSL</span> = true<span class="kw">;</span></span><span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> <span class="co">## this setting takes care of all LetsEncrypt business</span></span><span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> <span class="ex">enableACME</span> = true<span class="kw">;</span></span><span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> <span class="ex">locations.</span><span class="st">"/"</span> = {</span><span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> <span class="ex">proxyPass</span> = <span class="st">"http://localhost:8008"</span><span class="kw">;</span></span><span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> <span class="co">## virtual host for Riot/Web</span></span><span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> <span class="st">"riot.dangerousdemos.net"</span> = {</span><span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a> <span class="co">## for force redirecting HTTP to HTTPS</span></span><span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a> <span class="ex">forceSSL</span> = true<span class="kw">;</span></span><span id="cb2-24"><a href="#cb2-24" aria-hidden="true" tabindex="-1"></a> <span class="co">## this setting takes care of all LetsEncrypt business</span></span><span id="cb2-25"><a href="#cb2-25" aria-hidden="true" tabindex="-1"></a> <span class="ex">enableACME</span> = true<span class="kw">;</span></span><span id="cb2-26"><a href="#cb2-26" aria-hidden="true" tabindex="-1"></a> <span class="co">## root points to the riot-web package content, also configured via Nix</span></span><span id="cb2-27"><a href="#cb2-27" aria-hidden="true" tabindex="-1"></a> <span class="ex">locations.</span><span class="st">"/"</span> = {</span><span id="cb2-28"><a href="#cb2-28" aria-hidden="true" tabindex="-1"></a> <span class="ex">root</span> = pkgs.riot-web<span class="kw">;</span></span><span id="cb2-29"><a href="#cb2-29" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-30"><a href="#cb2-30" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-31"><a href="#cb2-31" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-32"><a href="#cb2-32" aria-hidden="true" tabindex="-1"></a> <span class="co">## virtual host for Jitsi, reusing the same hostname as used</span></span><span id="cb2-33"><a href="#cb2-33" aria-hidden="true" tabindex="-1"></a> <span class="co">## while configuring jitsi-meet</span></span><span id="cb2-34"><a href="#cb2-34" aria-hidden="true" tabindex="-1"></a> <span class="va">${config</span><span class="er">.services.jitsi-meet.hostName</span><span class="va">}</span> = {</span><span id="cb2-35"><a href="#cb2-35" aria-hidden="true" tabindex="-1"></a> <span class="ex">enableACME</span> = true<span class="kw">;</span></span><span id="cb2-36"><a href="#cb2-36" aria-hidden="true" tabindex="-1"></a> <span class="ex">forceSSL</span> = true<span class="kw">;</span></span><span id="cb2-37"><a href="#cb2-37" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-38"><a href="#cb2-38" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb2-39"><a href="#cb2-39" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-40"><a href="#cb2-40" aria-hidden="true" tabindex="-1"></a> <span class="co">## other nginx specific best practices</span></span><span id="cb2-41"><a href="#cb2-41" aria-hidden="true" tabindex="-1"></a> <span class="ex">recommendedGzipSettings</span> = true<span class="kw">;</span></span><span id="cb2-42"><a href="#cb2-42" aria-hidden="true" tabindex="-1"></a> <span class="ex">recommendedOptimisation</span> = true<span class="kw">;</span></span><span id="cb2-43"><a href="#cb2-43" aria-hidden="true" tabindex="-1"></a> <span class="ex">recommendedTlsSettings</span> = true<span class="kw">;</span></span><span id="cb2-44"><a href="#cb2-44" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><p>The above setups Nginx along with LetsEncrypt. If it’s required (like in theoriginal article) to setup main domain as a virtual host then make an additionalentry inside <code>virtualHosts</code></p><div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a></span><span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="st">"dangerousdemos.net"</span> = {</span><span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">forceSSL</span> = true<span class="kw">;</span></span><span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">enableACME</span> = true<span class="kw">;</span></span><span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">locations.</span><span class="st">"/"</span> = {</span><span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">root</span> = <span class="st">"/var/www/dangerousdemos.net"</span></span><span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span></span><span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a><span class="er">}</span></span></code></pre></div><h2 id="synapse">Synapse</h2><div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">services.matrix-synapse</span> = {</span><span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">enable</span> = true<span class="kw">;</span></span><span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="co">## domain for the Matrix IDs</span></span><span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">server_name</span> = <span class="st">"dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="co">## enable metrics collection</span></span><span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> <span class="ex">enable_metrics</span> = true<span class="kw">;</span></span><span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> <span class="co">## enable user registration</span></span><span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">enable_registration</span> = true<span class="kw">;</span></span><span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> <span class="co">## Synapse guys recommend to use PostgreSQL over SQLite</span></span><span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> <span class="ex">database_type</span> = <span class="st">"psycopg2"</span><span class="kw">;</span></span><span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> <span class="co">## database setup clarified later</span></span><span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> <span class="ex">database_args</span> = {</span><span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a> <span class="ex">password</span> = <span class="st">"synapse"</span><span class="kw">;</span></span><span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a> <span class="co">## default http listener which nginx will passthrough to</span></span><span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a> <span class="ex">listeners</span> = [</span><span id="cb4-25"><a href="#cb4-25" aria-hidden="true" tabindex="-1"></a> <span class="kw">{</span></span><span id="cb4-26"><a href="#cb4-26" aria-hidden="true" tabindex="-1"></a> <span class="ex">port</span> = 8008<span class="kw">;</span></span><span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a> <span class="ex">tls</span> = false<span class="kw">;</span></span><span id="cb4-28"><a href="#cb4-28" aria-hidden="true" tabindex="-1"></a> <span class="ex">resources</span> = [</span><span id="cb4-29"><a href="#cb4-29" aria-hidden="true" tabindex="-1"></a> <span class="kw">{</span></span><span id="cb4-30"><a href="#cb4-30" aria-hidden="true" tabindex="-1"></a> <span class="ex">compress</span> = true<span class="kw">;</span></span><span id="cb4-31"><a href="#cb4-31" aria-hidden="true" tabindex="-1"></a> <span class="ex">names</span> = [<span class="st">"client"</span> <span class="st">"webclient"</span> <span class="st">"federation"</span>]<span class="kw">;</span></span><span id="cb4-32"><a href="#cb4-32" aria-hidden="true" tabindex="-1"></a> <span class="kw">}</span></span><span id="cb4-33"><a href="#cb4-33" aria-hidden="true" tabindex="-1"></a> <span class="ex">]</span><span class="kw">;</span></span><span id="cb4-34"><a href="#cb4-34" aria-hidden="true" tabindex="-1"></a> <span class="kw">}</span></span><span id="cb4-35"><a href="#cb4-35" aria-hidden="true" tabindex="-1"></a> <span class="ex">]</span><span class="kw">;</span></span><span id="cb4-36"><a href="#cb4-36" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-37"><a href="#cb4-37" aria-hidden="true" tabindex="-1"></a> <span class="co">## coturn based TURN server integration (TURN server setup mentioned later),</span></span><span id="cb4-38"><a href="#cb4-38" aria-hidden="true" tabindex="-1"></a> <span class="co">## shared secret generated while configuring coturn</span></span><span id="cb4-39"><a href="#cb4-39" aria-hidden="true" tabindex="-1"></a> <span class="co">## and reused here (power of Nix being a real programming language)</span></span><span id="cb4-40"><a href="#cb4-40" aria-hidden="true" tabindex="-1"></a> <span class="ex">turn_uris</span> = [</span><span id="cb4-41"><a href="#cb4-41" aria-hidden="true" tabindex="-1"></a> <span class="st">"turn:turn.dangerousdemos.net:3478?transport=udp"</span></span><span id="cb4-42"><a href="#cb4-42" aria-hidden="true" tabindex="-1"></a> <span class="st">"turn:turn.dangerousdemos.net:3478?transport=tcp"</span></span><span id="cb4-43"><a href="#cb4-43" aria-hidden="true" tabindex="-1"></a> <span class="ex">]</span><span class="kw">;</span></span><span id="cb4-44"><a href="#cb4-44" aria-hidden="true" tabindex="-1"></a> <span class="ex">turn_shared_secret</span> = config.services.coturn.static-auth-secret<span class="kw">;</span></span><span id="cb4-45"><a href="#cb4-45" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><p>Unlike in the original article we will do <a href="https://github.com/matrix-org/synapse#using-postgresql">what’s recommended by Synapse team</a> andconfigure PostgreSQL. In the current NixOS configuration for<code>services.matrix-synapse</code> it might be configuring PostgreSQL automatically basedon the <code>database_type</code> setting but that will change in the new versions of NixOS wherePostgreSQL setups need to happen separately. Here’s how we will do it for Synapse</p><div class="sourceCode" id="cb5"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">services.postgresql</span> = {</span><span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">enable</span> = true<span class="kw">;</span></span><span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span><span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="co">## postgresql user and db name remains in the</span></span><span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="co">## service.matrix-synapse.database_args setting which</span></span><span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="co">## by default is matrix-synapse</span></span><span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">initialScript</span> = pkgs.writeText <span class="st">"synapse-init.sql"</span> <span class="st">''</span></span><span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a> <span class="ex">CREATE</span> ROLE <span class="st">"matrix-synapse"</span> WITH LOGIN PASSWORD <span class="st">'synapse'</span><span class="kw">;</span></span><span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> <span class="ex">CREATE</span> DATABASE <span class="st">"matrix-synapse"</span> WITH OWNER <span class="st">"matrix-synapse"</span></span><span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> <span class="ex">TEMPLATE</span> template0</span><span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">LC_COLLATE</span> = <span class="st">"C"</span></span><span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> <span class="ex">LC_CTYPE</span> = <span class="st">"C"</span><span class="kw">;</span></span><span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a> <span class="st">''</span><span class="kw">;</span></span><span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><p><strong>Federation setting</strong></p><p>Original article’s description for <a href="https://matrix.org/blog/2020/04/06/running-your-own-secure-communication-service-with-matrix-and-jitsi#synapse">how to configure so that Matrix could findone’s server is nice</a>. I am just leveraging that with one additional settingrequired when there is already a static blogrunning via Github Pages pointing to base domain:</p><ul><li><p>create a file having this path <code>.well-known/matrix/server</code> in the top level of the Githubrepository serving the static site having the following content</p><div class="sourceCode" id="cb6"><pre class="sourceCode json"><code class="sourceCode json"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span> <span class="dt">"m.server"</span><span class="fu">:</span> <span class="st">"matrix.dangerousdemos.net:443"</span> <span class="fu">}</span></span></code></pre></div></li><li><p>Github Pages via Jekyll exclude dotfiles/dotdirs from serving, so we need toexplicitly include them by creating <code>_config.yml</code> at the top level of theGithub repository having the following content</p><div class="sourceCode" id="cb7"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">include</span><span class="kw">:</span><span class="at"> </span><span class="kw">[</span><span class="st">".well-known"</span><span class="kw">]</span></span></code></pre></div></li></ul><h2 id="riotweb">Riot/Web</h2><p><code>riot-web</code> is a package already available within Nix packages which will takecare of getting the right release package along with signature verification. So wecan safely add the same to <code>systemPackages</code> like this</p><div class="sourceCode" id="cb8"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">environment</span> = {</span><span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">systemPackages</span> = with pkgs<span class="kw">;</span> <span class="bu">[</span></span><span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a> riot-web</span><span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a> <span class="bu">]</span><span class="kw">;</span></span><span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><p>However, we need to let know Nix of the additional configuration required onceriot-web is setup. That we could do via <em>overlays</em>. This is another advantage ofdeclarative package management where we state in clear terms the state of oursystem which also help us revert in case unexpected happens.</p><div class="sourceCode" id="cb9"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">nixpkgs.overlays</span> = [</span><span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">(</span><span class="ex">self:</span> super: {</span><span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">riot-web</span> = super.riot-web.override {</span><span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">conf</span> = {</span><span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">default_server_config</span> = {</span><span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"m.homeserver"</span> = {</span><span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"base_url"</span> = <span class="st">"https://matrix.dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a> <span class="st">"server_name"</span> = <span class="st">"dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> <span class="st">"m.identity_server"</span> = {</span><span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a> <span class="st">"base_url"</span> = <span class="st">"https://vector.im"</span><span class="kw">;</span></span><span id="cb9-14"><a href="#cb9-14" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb9-15"><a href="#cb9-15" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb9-16"><a href="#cb9-16" aria-hidden="true" tabindex="-1"></a></span><span id="cb9-17"><a href="#cb9-17" aria-hidden="true" tabindex="-1"></a> <span class="co">## jitsi will be setup later,</span></span><span id="cb9-18"><a href="#cb9-18" aria-hidden="true" tabindex="-1"></a> <span class="co">## but we need to add to Riot configuration</span></span><span id="cb9-19"><a href="#cb9-19" aria-hidden="true" tabindex="-1"></a> <span class="ex">jitsi.preferredDomain</span> = <span class="st">"jitsi.dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb9-20"><a href="#cb9-20" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb9-21"><a href="#cb9-21" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span><span id="cb9-22"><a href="#cb9-22" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">)</span></span><span id="cb9-23"><a href="#cb9-23" aria-hidden="true" tabindex="-1"></a> <span class="ex">]</span><span class="kw">;</span></span></code></pre></div><h2 id="jitsi">Jitsi</h2><p>Finally we head towards our last leg of configurations - setting up<code>jitsi-meet</code>. Unfortunately, current master and stable channels of Nix packageslack <code>jitsi-meet</code> and other supporting packages required to setup Jitsi.However, it will change pretty soon thanks to the awesome work from user<a href="https://github.com/mmilata">mmilata</a> in this <a href="https://github.com/NixOS/nixpkgs/pull/82920">pullrequest</a>. It’s feature completeand might come as part of the next Nix release (20.03). However, we canalready use the same via <a href="https://github.com/nix-community/NUR">NUR</a>.</p><div class="sourceCode" id="cb10"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">imports</span> =</span><span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">let</span></span><span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">nur-no-pkgs</span> =</span><span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">import</span> <span class="er">(</span></span><span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">builtins.fetchTarball</span></span><span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"https://github.com/nix-community/NUR/archive/master.tar.gz"</span></span><span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">)</span> <span class="ex">{}</span><span class="kw">;</span></span><span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a> <span class="er">in</span></span><span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> <span class="bu">[</span></span><span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a> nur-no-pkgs.repos.mmilata.modules.jitsi-meet</span><span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a> <span class="bu">]</span><span class="kw">;</span></span></code></pre></div><p>The above import add only the new service to setup <code>jitsi-meet</code> without anyother OS specific stuff. And the configuration for the new service wouldauto-magically setup the related software (like <code>videobridge</code> & <code>jicofo</code>) tohave a functioning Jitsi. We can then add a new virtual host to the Nginx configuration with the Jitsi <code>hostName</code>mentioned below (shown above in Nginx Section)</p><div class="sourceCode" id="cb11"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">services.jitsi-meet</span> = {</span><span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">enable</span> = true<span class="kw">;</span></span><span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">hostName</span> = <span class="st">"jitsi.dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a></span><span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> <span class="co">## this setting is going to add relevant ports to</span></span><span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a> <span class="co">## networking.firewall.allowedTCPPorts &</span></span><span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> <span class="co">## networking.firewall.allowedUDPPorts</span></span><span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> <span class="ex">videobridge.openFirewall</span> = true<span class="kw">;</span></span><span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><h2 id="turn-server">TURN server</h2><p><code>jitsi-meet</code> Debian package takes care of setting up TURN server but in our casewe need to take care of it ourselves. I followed the instructions mentioned in <a href="https://github.com/matrix-org/synapse/blob/master/docs/turn-howto.md">thisdocumentation</a>.Nix already has a service configuration to setup <code>coturn</code>. Once set up, we willintegrate the relevant parts to Synapse (which we have already done above).</p><div class="sourceCode" id="cb12"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a> <span class="co"># /etc/nixos/configuration.nix</span></span><span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">services.coturn</span> = {</span><span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">enable</span> = true<span class="kw">;</span></span><span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a> <span class="ex">use-auth-secret</span> = true<span class="kw">;</span></span><span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">static-auth-secret</span> = <span class="st">"XJmzTf6VixzX5pDZKHOxtiUenkKzr10tlhBWYoti5DvCxR4TM9XlRHxII3Ml6yV2"</span><span class="kw">;</span></span><span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">realm</span> = <span class="st">"turn.dangerousdemos.net"</span><span class="kw">;</span></span><span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> <span class="ex">no-tcp-relay</span> = true<span class="kw">;</span></span><span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="ex">no-tls</span> = true<span class="kw">;</span></span><span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> <span class="ex">no-dtls</span> = true<span class="kw">;</span></span><span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> <span class="ex">extraConfig</span> = <span class="st">''</span></span><span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> <span class="ex">user-quota=12</span></span><span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a> <span class="ex">total-quota=1200</span></span><span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> <span class="ex">denied-peer-ip=10.0.0.0-10.255.255.255</span></span><span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> <span class="ex">denied-peer-ip=192.168.0.0-192.168.255.255</span></span><span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> <span class="ex">denied-peer-ip=172.16.0.0-172.31.255.255</span></span><span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a></span><span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a> <span class="ex">allowed-peer-ip=192.168.191.127</span></span><span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a> <span class="st">''</span><span class="kw">;</span></span><span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a> <span class="er">}</span><span class="kw">;</span></span></code></pre></div><p><code>static-auth-secret</code> generated above is via the tool <code>pwgen</code> which in Nix wecould do like this</p><div class="sourceCode" id="cb13"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> nix-shell <span class="at">-p</span> pwgen <span class="at">--command</span> <span class="st">"pwgen -s 64 1"</span></span><span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="ex">XJmzTf6VixzX5pDZKHOxtiUenkKzr10tlhBWYoti5DvCxR4TM9XlRHxII3Ml6yV2</span></span></code></pre></div><h2 id="conclusion">Conclusion</h2><p>Once we have <a href="https://gist.github.com/kaychaks/c1a79aef68c32818dec7540412c9ee4b">all the above configuration in place</a>, now is the time to finally run themall. This will take time to get all the necessary stuff downloaded and setup.</p><div class="sourceCode" id="cb14"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> sudo nixos-rebuild switch</span></code></pre></div><p>However, once its done you can launch Riot/Web, register a new user, create a roomwith someone else from the same MatrixVerse, have end-to-end encrypted conversation,and also start having a video call via Jitsi. All that infrastructure nowbeing 100% owned by you with a protocol enforcing privacy and decentralisation.And finally every piece here is fully open-source.</p><p>In these times of covert and overt surveillance its imperative to take mattersat your hand. And when right tools make it simple to set them up and easy toreason their behavior, it’s a nice feeling.</p></div>
</article>]]></summary></entry><entry> <title>Logical equivalences in Haskell</title> <link href="https://kaushikc.org/posts/logical-equivalences-in-haskell.html" /> <id>https://kaushikc.org/posts/logical-equivalences-in-haskell.html</id> <published>2019-01-03</published> <updated>2019-01-03T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/logical-equivalences-in-haskell.html"> Logical equivalences in Haskell </a> <a href="/posts/logical-equivalences-in-haskell.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">January 3, 2019</p> <p class="author"><a title="All pages tagged 'technology'." href="/tags/technology.html">technology</a>, <a title="All pages tagged 'haskell'." href="/tags/haskell.html">haskell</a></p></div><div class="bodycopy"> <p>The blogpost <a href="https://cvlad.info/clasical-logic-in-haskell/">Classical Logic in Haskell</a> established a way to prove equivalences between logical propositions and <em>law of excluded middle</em> by writing intances of <code>Iso</code> for the same propositions wrapped in a <code>newtype</code>. <a href="https://twitter.com/cvlad">Vladimir’s</a> post contain proofs of some important propositions. I had fun proving them myself. I wanted to continue with some more.</p><p>Recently, I did the <a href="https://leanprover.github.io/logic_and_proof/">Logic and Proof</a> course to learn both proof techniques and <a href="https://leanprover.github.io/">Lean</a> theorem prover. It was fun. So I picked few propositions from the exercises of the <a href="https://leanprover.github.io/logic_and_proof/propositional_logic_in_lean.html#exercises">Propositional Logic in Lean</a> chapter to try write equivalence proofs for them.</p><p>Below are the propositions as newtypes (their logical notations mentioned as comment) and subsequently the <code>Iso</code> instances to prove their equivalences with <code>Lem</code>. As mentioned in the original blogpost, one nice way to progress here is by taking clues from the type system itself in the form of <a href="https://wiki.haskell.org/GHC/Typed_holes">typed holes</a>.</p><p>Let’s set some language pragmas</p><div class="sourceCode" id="cb1"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>set <span class="op">-</span><span class="dt">XMultiParamTypeClasses</span></span><span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>set <span class="op">-</span><span class="dt">XRankNTypes</span></span><span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>set <span class="op">-</span><span class="dt">XInstanceSigs</span></span><span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>set <span class="op">-</span><span class="dt">XScopedTypeVariables</span></span><span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="op">:</span>set <span class="op">-</span><span class="dt">XTupleSections</span></span></code></pre></div><p>Required <code>Iso</code> class from the original blogpost put inside a module so that it can be imported for rest of the sections</p><div class="sourceCode" id="cb2"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">module</span> <span class="dt">Proof</span> <span class="kw">where</span></span><span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="dt">Data.Void</span> (<span class="dt">Void</span>, absurd)</span><span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a></span><span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> <span class="dt">Iso</span> a b <span class="kw">where</span></span><span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="ot"> to ::</span> a <span class="ot">-></span> b</span><span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="ot"> from ::</span> b <span class="ot">-></span> a</span><span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> </span><span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="co">-- Law of excluded middle</span></span><span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="co">-- forall P. P \/ -P</span></span><span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="kw">newtype</span> <span class="dt">Lem</span> m <span class="ot">=</span> </span><span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> <span class="dt">Lem</span></span><span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> (<span class="kw">forall</span> a <span class="op">.</span></span><span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> m (<span class="dt">Either</span> a (a <span class="ot">-></span> m <span class="dt">Void</span>))) </span></code></pre></div><div class="sourceCode" id="cb3"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="dt">Data.Void</span></span><span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="dt">Proof</span></span></code></pre></div><p>And now the propositions…</p><div class="sourceCode" id="cb4"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co">-- forall. P,Q. P /\ (P -> Q) -> Q</span></span><span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="dt">Control.Monad.Fix</span></span><span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a></span><span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="kw">newtype</span> <span class="dt">Prop1</span> m <span class="ot">=</span> </span><span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="dt">Prop1</span> </span><span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> (<span class="kw">forall</span> a b<span class="op">.</span> </span><span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> (a , (a <span class="ot">-></span> m b)) <span class="ot">-></span> m b)</span><span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> </span><span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a><span class="co">-- proof, implication elimination <==> LEM</span></span><span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="kw">instance</span> <span class="dt">Monad</span> m <span class="ot">=></span> <span class="dt">Proof.Iso</span> (<span class="dt">Prop1</span> m) (<span class="dt">Lem</span> m) <span class="kw">where</span></span><span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="ot"> from ::</span> <span class="dt">Lem</span> m <span class="ot">-></span> <span class="dt">Prop1</span> m</span><span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a> from _ <span class="ot">=</span> <span class="dt">Prop1</span> <span class="op">$</span> <span class="fu">uncurry</span> (<span class="fu">flip</span> <span class="fu">id</span>)</span><span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a> </span><span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a><span class="ot"> to ::</span> <span class="dt">Prop1</span> m <span class="ot">-></span> <span class="dt">Lem</span> m</span><span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> to (<span class="dt">Prop1</span> i) <span class="ot">=</span> <span class="dt">Lem</span> <span class="op">$</span> <span class="fu">fmap</span> <span class="dt">Left</span> <span class="op">$</span> i (<span class="fu">id</span>, <span class="fu">pure</span> <span class="op">.</span> fix)</span></code></pre></div><div class="sourceCode" id="cb5"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co">-- forall. P,Q. P -> - (- P /\ B)</span></span><span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="kw">newtype</span> <span class="dt">Prop2</span> m <span class="ot">=</span> </span><span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="dt">Prop2</span></span><span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a> (<span class="kw">forall</span> a b<span class="op">.</span></span><span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> (a <span class="ot">-></span> m (((a <span class="ot">-></span> m <span class="dt">Void</span>), b) <span class="ot">-></span> m <span class="dt">Void</span>)))</span><span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> </span><span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="co">-- proof, Prop2 <==> LEM</span></span><span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a><span class="kw">instance</span> <span class="dt">Monad</span> m <span class="ot">=></span> <span class="dt">Proof.Iso</span> (<span class="dt">Prop2</span> m) (<span class="dt">Lem</span> m) <span class="kw">where</span></span><span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="ot"> to ::</span> <span class="dt">Prop2</span> m <span class="ot">-></span> <span class="dt">Lem</span> m</span><span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a> to (<span class="dt">Prop2</span> p) <span class="ot">=</span> <span class="dt">Lem</span> <span class="op">$</span> <span class="fu">pure</span> <span class="op">$</span> <span class="dt">Right</span> proof <span class="kw">where</span></span><span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a><span class="ot"> proof ::</span> a <span class="ot">-></span> m <span class="dt">Void</span></span><span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a> proof x <span class="ot">=</span> p x <span class="op">>>=</span> (<span class="op">$</span> (proof, x))</span><span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a> </span><span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a><span class="ot"> from ::</span> <span class="dt">Lem</span> m <span class="ot">-></span> <span class="dt">Prop2</span> m</span><span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> from (<span class="dt">Lem</span> l) <span class="ot">=</span> <span class="dt">Prop2</span> <span class="op">$</span> <span class="fu">flip</span> <span class="fu">fmap</span> l <span class="op">.</span> proof <span class="kw">where</span></span><span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a><span class="ot"> proof ::</span> a <span class="ot">-></span> <span class="dt">Either</span> a (a <span class="ot">-></span> m <span class="dt">Void</span>) <span class="ot">-></span> (((a <span class="ot">-></span> m <span class="dt">Void</span>), b) <span class="ot">-></span> m <span class="dt">Void</span>)</span><span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> proof x <span class="ot">=</span> <span class="fu">either</span> (<span class="fu">flip</span> <span class="fu">fst</span>) (\f _ <span class="ot">-></span> f x)</span><span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a> </span></code></pre></div><div class="sourceCode" id="cb6"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co">-- forall. P,Q. - (P /\ Q) -> (P -> - Q)</span></span><span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="dt">Control.Applicative</span> (liftA2)</span><span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a></span><span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="kw">newtype</span> <span class="dt">Prop3</span> m <span class="ot">=</span> </span><span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">Prop3</span></span><span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> (<span class="kw">forall</span> a b<span class="op">.</span></span><span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> ((a,b) <span class="ot">-></span> m <span class="dt">Void</span>) <span class="ot">-></span> m (a <span class="ot">-></span> m (b <span class="ot">-></span> m <span class="dt">Void</span>)))</span><span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> </span><span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a><span class="co">-- proof, Prop3 <==> LEM</span></span><span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="kw">instance</span> <span class="dt">Monad</span> m <span class="ot">=></span> <span class="dt">Proof.Iso</span> (<span class="dt">Prop3</span> m) (<span class="dt">Lem</span> m) <span class="kw">where</span></span><span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a><span class="ot"> to ::</span> <span class="dt">Prop3</span> m <span class="ot">-></span> <span class="dt">Lem</span> m</span><span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> to (<span class="dt">Prop3</span> p) <span class="ot">=</span> <span class="dt">Lem</span> </span><span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> <span class="fu">fmap</span> <span class="dt">Right</span> </span><span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> proof </span><span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a> <span class="op">>>=</span> </span><span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a> (\f <span class="ot">-></span> <span class="fu">pure</span> (liftA2 (<span class="op">>>=</span>) f (<span class="fu">flip</span> <span class="fu">id</span>))) </span><span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a> <span class="kw">where</span></span><span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a><span class="ot"> proof ::</span> m (a <span class="ot">-></span> m (a <span class="ot">-></span> m <span class="dt">Void</span>))</span><span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a> proof <span class="ot">=</span> p (\(x,y) <span class="ot">-></span> proof <span class="op">>>=</span> ((<span class="op">$</span> y) <span class="op">=<<</span>) <span class="op">.</span> (<span class="op">$</span> x))</span><span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a> </span><span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a><span class="ot"> from ::</span> <span class="dt">Lem</span> m <span class="ot">-></span> <span class="dt">Prop3</span> m</span><span id="cb6-22"><a href="#cb6-22" aria-hidden="true" tabindex="-1"></a> from (<span class="dt">Lem</span> l) <span class="ot">=</span> <span class="dt">Prop3</span></span><span id="cb6-23"><a href="#cb6-23" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> (\f <span class="ot">-></span></span><span id="cb6-24"><a href="#cb6-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">pure</span></span><span id="cb6-25"><a href="#cb6-25" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> \a <span class="ot">-></span></span><span id="cb6-26"><a href="#cb6-26" aria-hidden="true" tabindex="-1"></a> <span class="fu">either</span> (<span class="fu">const</span> <span class="op">.</span> f <span class="op">.</span> (a ,)) <span class="fu">id</span> <span class="op"><$></span> l)</span></code></pre></div><div class="sourceCode" id="cb7"><pre class="sourceCode haskell"><code class="sourceCode haskell"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co">-- forall. P,Q. -P /\ -Q -> - (P \/ Q)</span></span><span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a></span><span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="kw">newtype</span> <span class="dt">Prop4</span> m <span class="ot">=</span> </span><span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a> <span class="dt">Prop4</span></span><span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a> (<span class="kw">forall</span> a b<span class="op">.</span></span><span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a> ((a <span class="ot">-></span> m <span class="dt">Void</span> , b <span class="ot">-></span> m <span class="dt">Void</span>) <span class="ot">-></span> m (<span class="dt">Either</span> a b <span class="ot">-></span> m <span class="dt">Void</span>)))</span><span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a> </span><span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="co">-- proof, Prop4 <==> LEM</span></span><span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="kw">instance</span> <span class="dt">Monad</span> m <span class="ot">=></span> <span class="dt">Proof.Iso</span> (<span class="dt">Prop4</span> m) (<span class="dt">Lem</span> m) <span class="kw">where</span></span><span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a><span class="ot"> to ::</span> <span class="dt">Prop4</span> m <span class="ot">-></span> <span class="dt">Lem</span> m</span><span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a> to (<span class="dt">Prop4</span> p) <span class="ot">=</span> <span class="dt">Lem</span> </span><span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> <span class="fu">pure</span> </span><span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a> <span class="op">$</span> <span class="dt">Right</span> </span><span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a> ((proof <span class="op">>>=</span>) <span class="op">.</span> <span class="fu">flip</span> <span class="fu">id</span> <span class="op">.</span> <span class="dt">Left</span>)</span><span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> <span class="kw">where</span></span><span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a><span class="ot"> proof ::</span> m (<span class="dt">Either</span> a a <span class="ot">-></span> m <span class="dt">Void</span>)</span><span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a> proof <span class="ot">=</span> <span class="fu">curry</span> p ((proof <span class="op">>>=</span>)</span><span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span> <span class="fu">flip</span> <span class="fu">id</span></span><span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span> <span class="dt">Left</span>) </span><span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a> ((proof <span class="op">>>=</span>)</span><span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span> <span class="fu">flip</span> <span class="fu">id</span></span><span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span> <span class="dt">Right</span>)</span><span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a> </span><span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a><span class="ot"> from ::</span> <span class="dt">Lem</span> m <span class="ot">-></span> <span class="dt">Prop4</span> m</span><span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a> from _ <span class="ot">=</span> <span class="dt">Prop4</span> <span class="op">$</span> <span class="fu">uncurry</span> <span class="op">$</span> (<span class="fu">pure</span> <span class="op">.</span>) <span class="op">.</span> <span class="fu">either</span></span></code></pre></div><hr /><p><em>This is an <a href="https://github.com/kaychaks/notebooks/blob/master/logical-equivalences-in-haskell.ipynb">IHaskell Notebook</a> which is pretty cool for above kind of experiments. Much more feature rich than GHCi. I got the inspiration from <a href="https://twitter.com/vbhvsgr">Vaibhav Sagar</a> who writes <a href="https://vaibhavsagar.com/">all his posts</a> as IHaskell Notebooks.</em></p></div>
</article>]]></summary></entry><entry> <title>Retrospecting 2018</title> <link href="https://kaushikc.org/posts/retro-2018.html" /> <id>https://kaushikc.org/posts/retro-2018.html</id> <published>2018-12-26</published> <updated>2018-12-26T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/retro-2018.html"> Retrospecting 2018 </a> <a href="/posts/retro-2018.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">December 26, 2018</p> <p class="author"><a title="All pages tagged 'technology'." href="/tags/technology.html">technology</a></p></div><div class="bodycopy"> <p>This year was mostly uneventful unlike 2017. However, I did do a lot more technical reading - mostly papers and a few books - than previous years. Professionally things changed quite drastically. I am now meant to do mostly research-y things than what used to be half & half with engineering before. Not that I complain, my feelings are on the contrary actually. But this whole new setting at work, both from an operations & vision standpoint, is still clumsy and need more time to shape up well.</p><p>I am beginning to focus on the areas of <em>Knowledge Engineering</em>. I want to tie it with fascinating things from <em>Type Systems</em>. I believe their shared foundations in <em>Mathematical Logic</em> will provide interesting things to work on. And my choice of technology to realise any such research will be <em>Haskell</em>, mostly.</p><p>So apart from spending most of the time reading papers on the history of knowledge bases, their representation, and reasoning I also tried to get used to logic and proofs. During one such excavation, I landed on a course aptly named <a href="https://leanprover.github.io/logic_and_proof/">Logic and Proof</a> which uses this beautiful language called <a href="https://leanprover.github.io/">Lean</a> to write the proofs. Lean, like Haskell, has its roots in Microsoft Research. It, like Agda, is dependently typed language which also provides means to do inductive/automated theorem proving. It was my first foray into the world of computational theorem proving and some serious work with dependent types (I did dabble with Idris but it is better not to talk about that). Working with Lean and learning more about its origins and background type systems research gave me ideas that I believe are relevant to knowledge systems.</p><p>With Lean, I digressed heavily into learning dependent types, this time with a larger vision to make them useful for knowledge systems. And hence I got this amazing book called <a href="https://mitpress.mit.edu/books/little-typer"><em>The Little Typer</em></a>. It provides the necessary foundations for me to relate dependent types, higher-order logic, relational programming, and eventually their role in knowledge systems. I am nowhere close to anything concrete to go after but I am having fun peeling the layers of these seemingly disjoint fields converging together elegantly.</p><p>Haskell with its dependent typing tools is nowhere close to things that Lean and Agda could do today. But it’s still amazing how far the current type system could take you. <a href="https://leanpub.com/thinking-with-types">Sandy Maguire’s new book</a> is how I am trying to get my head around all those esoteric corners of Haskell. It’s pretty good.</p><p>I also want to mention one other thing that is happening coincidentally and maybe right now I am not able to leverage it to its full extent only coz of my lack of understanding but I am pretty sure it will be something that I will be leaning a lot in future. And that is <a href="https://www.twitch.tv/ekmett/videos?filter=all&sort=time">Edward Kmett’s Twitch videos on his creation of Guanxi</a>. Ed’s videos are highly motivational (for some apparent indescribable reason).</p><p>Finally, I also want to highlight that I continued persevering with <em>Nix</em> irrespective of it still not friendly as a package manager in macOS. I realised that there’s no other way, right now, to reading <a href="https://github.com/NixOS/nixpkgs/">nixpkgs</a> source code to make stuff work properly with Nix especially in macOS. Hopefully, it will improve and I will also do my best towards that goal. But <em>Nix</em> is the future of so-called <em>devops</em> that I believe in and I want it to succeed at all costs.</p><p>As <a href="https://twitter.com/aarohi_c">my daughter</a> grows up to her 3rd year of existence in 2019, I am hoping her to be a bit more independent and me getting a bit more time off work to try to contribute to some open source Haskell projects. Having a 2-year-old kid around when you are trying to do some focussed programming session is not a happy setting (no offence to any 2-year-olds).</p><p>I learnt a lot of new things in 2018 that now I think I have some roadmap for next year to channel my energies on. But none of them is related to <em>Deep Learning</em>, <em>Blockchain</em>, or <em>Microservices</em> unfortunately !!</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Final Day: Game of the champions</title> <link href="https://kaushikc.org/posts/wc-2018-day-25-game-of-champions.html" /> <id>https://kaushikc.org/posts/wc-2018-day-25-game-of-champions.html</id> <published>2018-07-16</published> <updated>2018-07-16T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day-25-game-of-champions.html"> WC 2018: Final Day: Game of the champions </a> <a href="/posts/wc-2018-day-25-game-of-champions.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 16, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <h2 id="the-final">The Final</h2><p><strong>Croatia 2 - France 4</strong></p><p>It could not have been more engaging and dramatic than what unfolded as one of the best World Cup finals of recent times. The game started with Croatians putting their heart and soul into the game. They created the first scare for France and were relentless in their pursuit to score early. It was first 15-20 minutes of a gripping game of Croatian attack & pressure tactics. Unfortunately French got it past Croatian net for no credit of theirs. Croatian reply by the amazing Perisic was spellbinding. VAR came to the rescue of France as it’s been from their first game. I believe the resulting penalty was the turning point of the game.</p><p>The second half belonged to France. They showed their class with superb ball control and creative ball passing. Both Pogba’s and Mbappe’s goals were astounding. They are the signs of a team worthy of being a champion. Croatia, in the end, succumbed due to a bit of bad luck and a better opponent.</p><p>As the curtains dropped, I consider this edition of the World Cup to be one of the best of the modern era. It was full of honest surprises and impressive comebacks. But more than ever this World Cup was for those who dared to dream and deliberated on it by having fun rather than for those who either got complacent or were bored with the game.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 24: The consolation game</title> <link href="https://kaushikc.org/posts/wc-2018-day-24-consolation-game.html" /> <id>https://kaushikc.org/posts/wc-2018-day-24-consolation-game.html</id> <published>2018-07-15</published> <updated>2018-07-15T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day-24-consolation-game.html"> WC 2018: Day 24: The consolation game </a> <a href="/posts/wc-2018-day-24-consolation-game.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 15, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <h2 id="rd-4th-place-game">3rd & 4th place game</h2><p><strong>England 0 - Belgium 2</strong></p><p>Belgians came back with their inventive & creative gameplay. It was a treat to watch. England did not change much on playing boring football. It was fantastic watching Hazard & De Bruyne sweating & overcoming clueless English midfield & defence. Hazard, in particular, created more chances than out-of-form Lukaku could handle. Belgium in a way deserved more than the 3rd place. And England needs to find fun in their game to start with.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 23: Croatian dream run</title> <link href="https://kaushikc.org/posts/wc-2018-day-23-croatian-dream-run.html" /> <id>https://kaushikc.org/posts/wc-2018-day-23-croatian-dream-run.html</id> <published>2018-07-12</published> <updated>2018-07-12T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day-23-croatian-dream-run.html"> WC 2018: Day 23: Croatian dream run </a> <a href="/posts/wc-2018-day-23-croatian-dream-run.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 12, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <h2 id="semifinal-2">Semifinal #2</h2><p><strong>England 1 - Croatia 2</strong></p><p>Ivan Sršen <a href="http://www.nybooks.com/daily/2018/07/11/world-cup-2018-croatias-conflict-resolution/">describing the mood as Croatian goalkeeper saved the decisive penalty against Russia in quarterfinal</a></p><blockquote><p>For a brief moment at least, to me and perhaps to all of us in the bar, it felt as though the war was <em>finally</em> over.</p></blockquote><p>Ivan also talks about the legacy of Croatian football and background of some current Croatian players like Modrić and Lovren. It highlights the significance of Croatian progress in this World Cup.</p><p>Football, the so-called beautiful game, only needs a pair of legs and pile of passion. That way it binds people from every stratum of society.</p><p>Last night the Croatian players showcased matured & infallible football. It was a gripping game. Barring that superb 4th-minute free-kick, England had nothing to showcase in the whole 120 minutes. The Croatian players, like their coach, had a unique sense of calmness and deep focus. Which led them to dominate England in the whole match. England, as I have earlier mentioned as well, lacked both individual skills & collective playmaking. Their early lead was never meant to stand against the pressing Croatian attack.</p><p>Croatia will face a much tougher & skilful opposition in France in the final. They should work on improving their pass accuracy and man-tagging in the back, especially for the speedster Mbappe. But this nail-biting win over England should lift their spirits. They will attempt to cause the unthinkable for their country as they have done with their lives.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 22: Les bleus le progrès</title> <link href="https://kaushikc.org/posts/wc-2018-day-22-les-bleus-le-progres.html" /> <id>https://kaushikc.org/posts/wc-2018-day-22-les-bleus-le-progres.html</id> <published>2018-07-11</published> <updated>2018-07-11T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day-22-les-bleus-le-progres.html"> WC 2018: Day 22: Les bleus le progrès </a> <a href="/posts/wc-2018-day-22-les-bleus-le-progres.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 11, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <h2 id="semifinal-1">Semifinal #1</h2><p><strong>Belgium 0 - France 1</strong></p><p>Kylian Mbappé is a revolution. 4 mins in the match the way he ran from midfield to almost inside the Belgium goal post with the ball set the tone of the rest of the match. It would have been more misery for Belgium if his out of form teammate Giroud would have converted some wonderful passes. Belgium suffered from a lack of interest shown by their centre-forward Lukaku. He hardly kicked the ball in the overall match. Hazard was persistent & De Bruyne tried his best to create chances from the flanks. Second half substitution of Mertens brought some much-needed energy to the team. But they suffered from a similar conundrum that Brazil had against them in the quarterfinal. France after scoring the crucial goal went to a full defensive mode. Which was kind of expected. It was a nice game & I feel bad for the Belgs. This was the best team they could ever have. France on the, on the other hand, is clear if Mbappé maintains his pace & check his cheekiness.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 21: The English March</title> <link href="https://kaushikc.org/posts/wc-2018-day-21-english-march.html" /> <id>https://kaushikc.org/posts/wc-2018-day-21-english-march.html</id> <published>2018-07-08</published> <updated>2018-07-08T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day-21-english-march.html"> WC 2018: Day 21: The English March </a> <a href="/posts/wc-2018-day-21-english-march.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 8, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <p>England has the best chance to go for the cup and hosts, unfortunately, had to stop at Quarters.</p><p><strong>Sweden 0 - England 2</strong></p><p>This English team is playing like a well-oiled machine. Lacking individual skills they rely more on each other & set pieces to deliver. And they are doing that pretty well. They now have clear shot to the finals. And depending on who will stand on the other side if this team play sensibly they might do the unthinkable.</p><p><strong>Russia 2 (3) - Croatia 2 (4)</strong></p><p>It might be the loudest game of the tournament. Much of that roar was for host nation Russia. Russians did not disappoint at all. It was a game of blistering pace & passion. Croatia, as I had previously pointed out, is playing with all their heart. They have not shown any sign of big tournament chill like many other underdogs. Which make their case against England in semis pretty interesting.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 20: South American exodus</title> <link href="https://kaushikc.org/posts/wc-2018-day20-south-american-exodus.html" /> <id>https://kaushikc.org/posts/wc-2018-day20-south-american-exodus.html</id> <published>2018-07-07</published> <updated>2018-07-07T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day20-south-american-exodus.html"> WC 2018: Day 20: South American exodus </a> <a href="/posts/wc-2018-day20-south-american-exodus.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 7, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <p>It will be again a European crown like last time.</p><p><strong>Uruguay 0 - France 2</strong></p><p>It was a game of tussle between Uruguayan desperation & French persuasion. Without Cavani, the Uruguayan attack was like an already amputated man losing his last leg. Suarez tried his best to muster a number of chances. But none of his teammates had the vision or talent to work with them. France realised that & made sure they don’t do anything silly on the back. French game had the same fluidity like last time. Mbappe showed some interesting skills both with his legs & drama. However, I felt Uruguayans were not that bewildered by French defence. Which might be enough for Martinez’s jubilant men to easily triumph in the semis.</p><p><strong>Brazil 1 - Belgium 2</strong></p><p>This was the best match of the tournament so far for me (many consider Belgium’s last match with Japan to be the best). It was a great night of football where teams played to their best with a worthy winner in the end. Brazil’s painstaking efforts to penetrate Belgium defence was a treat to watch. Also quite heartbreaking. Belgium’s superb tactic to make De Bruyne play from the centre with Lukaku in the flanks split wide open Brazilian defence. Lukaku was unstoppable & Hazard was critical. But I would say the real hero of the match was Courtois. His gravity-defying saves took the match away from Brazil.</p><p>Tite’s plan to not start with Firmino again might be a bad move. He along with Costa made quite an impression in the second half. However, I felt Brazil lacks a physically strong attacking player who could withstand the pushing & shoving to rush inside a stubborn defence. Current talents like Neymar & Coutinho are too feeble to make their way in & hence spend most of the time strolling around the penalty circle. Brazil also missed some straightforward chances which are a criminal offence in the World Cup. Brazil did not disappoint like last time. I wish they progress further next time in Qatar.</p><p>In the meantime, I am betting on Belgium as champions.</p></div>
</article>]]></summary></entry><entry> <title>WC 2018: Day 19: Boring drama</title> <link href="https://kaushikc.org/posts/wc-2018-day19-boring-drama.html" /> <id>https://kaushikc.org/posts/wc-2018-day19-boring-drama.html</id> <published>2018-07-04</published> <updated>2018-07-04T00:00:00Z</updated> <summary type="html"><![CDATA[<article class="post"> <h1> <a href="/posts/wc-2018-day19-boring-drama.html"> WC 2018: Day 19: Boring drama </a> <a href="/posts/wc-2018-day19-boring-drama.html" class="link-perma"> <span>●</span> </a> </h1> <div class="byline"> <p class="date">July 4, 2018</p> <p class="author"><a title="All pages tagged 'sports'." href="/tags/sports.html">sports</a>, <a title="All pages tagged 'football'." href="/tags/football.html">football</a>, <a title="All pages tagged 'world-cup'." href="/tags/world-cup.html">world-cup</a>, <a title="All pages tagged 'wc-2018'." href="/tags/wc-2018.html">wc-2018</a></p></div><div class="bodycopy"> <h2 id="knockouts-day-3">Knockouts Day 3</h2><p>Sweeden & Switzerland should be banned for playing the most boring game of the World Cup. And England narrowly missed <em>their exit</em>.</p><p><strong>Columbia 1 (3) - England 1 (4)</strong></p><p>Watching English players on the field is like watching a Twitch stream of someone playing the latest version of EA Sports’ FIFA. Their gameplay and style were so mechanical that it bored me to death. Columbians, on the other hand, showed exquisite legwork whenever they found time after doing those unnecessary pushing, shoving, and play-acting drama. The game was more of reality tv than a real sport. I pity the referee who should avoid travelling to South America anytime soon. England’s path till finals henceforth is easy (assuming Croatia don’t panic against Russia and then get beaten by the English luck). Also, their next game should be called off by sending Sweeden home for wasting the time of thousands of spectators with the most dreadful game of the tournament against Switzerland.</p></div>
</article>]]></summary></entry>
</feed>