<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Projects on Berin&#39;s Webpage</title>
    <link>https://berinaniesh.xyz/projects/</link>
    <description>Recent content in Projects on Berin&#39;s Webpage</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 06 Oct 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://berinaniesh.xyz/projects/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Bible Web 2</title>
      <link>https://berinaniesh.xyz/projects/bible-web-2/</link>
      <pubDate>Fri, 06 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://berinaniesh.xyz/projects/bible-web-2/</guid>
      <description>&lt;p&gt;Git Repo: &lt;a href=&#34;https://gitlab.com/scripture/scripture.gitlab.io&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Deployed at: &lt;a href=&#34;https://scripture.berinaniesh.xyz&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is an alternate frontend to the &lt;a href=&#34;https://berinaniesh.xyz/projects/bible-api/&#34;&gt;bible-api&lt;/a&gt; in which everything is generated prior and the whole site is served as static content.&lt;/p&gt;
&lt;p&gt;The objective here is to provide a featureful and book like reading experience. Though the site is not as fast as &lt;a href=&#34;https://berinaniesh.xyz/projects/bible-web-1/&#34;&gt;Bible Web 1&lt;/a&gt; (which is due to prefetching and fetching on hover) the site is still very fast, responsive and serves it&amp;rsquo;s purpose well.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Git Repo: <a href="https://gitlab.com/scripture/scripture.gitlab.io">Link</a></p>
<p>Deployed at: <a href="https://scripture.berinaniesh.xyz">Link</a></p>
<p>This is an alternate frontend to the <a href="/projects/bible-api/">bible-api</a> in which everything is generated prior and the whole site is served as static content.</p>
<p>The objective here is to provide a featureful and book like reading experience. Though the site is not as fast as <a href="/projects/bible-web-1/">Bible Web 1</a> (which is due to prefetching and fetching on hover) the site is still very fast, responsive and serves it&rsquo;s purpose well.</p>
<h2 id="generation-process">Generation Process</h2>
<p>The site uses <a href="https://rust-lang.github.io/mdBook/index.html">mdbook</a>, which is a static site generator written in rust by the rust team themselves. It is fast, minimal, extendable and featureful.</p>
<p>The problem is that <code>mdbook</code> requires each page to be typed out in their <code>SUMMARY.md</code>. There are 1189 chapters in a standard bible and the UI serves four bibles (right now), which amounts to 4756 generated pages.</p>
<p>So, we used a python script, which fetches verses from the <a href="/projects/bible-api/">Bible API</a> and constructs a <a href="https://en.wikipedia.org/wiki/Tree_(data_structure)">tree</a>. This tree is serialized to markdown files and mdbook then generates html and css for the generated markdown files.
The script can be found <a href="https://gitlab.com/scripture/scripture.gitlab.io/-/blob/generation_branch/generator.py?ref_type=heads">here</a>.</p>
<h2 id="hurdles">Hurdles</h2>
<p>There are a total of 4758 pages and we hit limits on various stages.</p>
<ol>
<li><code>mdbook</code> is not designed to write this many pages. It rerenders the whole book on a single thread with each change. This of course is problematic and so, the generated code and the generation scripts are at separate branches.</li>
<li><code>mdbook</code> running on GitLab CI, due to some unknown reason (probably memory/storage/cpu limitations), won&rsquo;t generate any content on pages since the number of bibles reached 2. So, we moved everything to local build and hosting.</li>
<li>GitLab has a limit on the size of the repo that can be hosted on Gitlab Pages. So, this is hosted on a linux server (which made the app load much faster).</li>
</ol>
]]></content:encoded>
    </item>
    
    <item>
      <title>Bible Web 1</title>
      <link>https://berinaniesh.xyz/projects/bible-web-1/</link>
      <pubDate>Wed, 04 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://berinaniesh.xyz/projects/bible-web-1/</guid>
      <description>&lt;p&gt;Git Repo: &lt;a href=&#34;https://github.com/berinaniesh/bible-web&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Deployed at: &lt;a href=&#34;https://bible.berinaniesh.xyz&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is a frontend to the &lt;a href=&#34;https://berinaniesh.xyz/projects/bible-api/&#34;&gt;bible-api&lt;/a&gt;, written using SvelteKit and TailwindCSS.&lt;/p&gt;
&lt;p&gt;The objective is to provide a minimal UI to read The Bible. The application is very fast and responsive and is deployed on a linux server.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Git Repo: <a href="https://github.com/berinaniesh/bible-web">Link</a></p>
<p>Deployed at: <a href="https://bible.berinaniesh.xyz">Link</a></p>
<p>This is a frontend to the <a href="/projects/bible-api/">bible-api</a>, written using SvelteKit and TailwindCSS.</p>
<p>The objective is to provide a minimal UI to read The Bible. The application is very fast and responsive and is deployed on a linux server.</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Bible API</title>
      <link>https://berinaniesh.xyz/projects/bible-api/</link>
      <pubDate>Mon, 02 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://berinaniesh.xyz/projects/bible-api/</guid>
      <description>&lt;p&gt;Git Repo: &lt;a href=&#34;https://github.com/berinaniesh/bible-api&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Deployed at: &lt;a href=&#34;https://api.bible.berinaniesh.xyz/docs&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Bible API as the name implies, is an API server which serves bible verses over REST endpoints. To avoid licensing issues, only bibles in the Public Domain are available.&lt;/p&gt;
&lt;p&gt;It uses a postgresql database and is written using &lt;a href=&#34;https://github.com/actix/actix-web&#34;&gt;Actix Web&lt;/a&gt; and &lt;a href=&#34;https://github.com/launchbadge/sqlx&#34;&gt;SQLx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Right now, two frontends get data from the API.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://bible.berinaniesh.xyz&#34;&gt;UI 1&lt;/a&gt; - SSR with hydration, fast and responsive UI (prerendering, fetch on hover, etc).&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://scripture.berinaniesh.xyz&#34;&gt;UI 2&lt;/a&gt; - SSG, more mature UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;license&#34;&gt;License&lt;/h2&gt;
&lt;p&gt;The server, the data and the bibles are all in the public domain and so feel free to self host, distribute everything.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Git Repo: <a href="https://github.com/berinaniesh/bible-api">Link</a></p>
<p>Deployed at: <a href="https://api.bible.berinaniesh.xyz/docs">Link</a></p>
<p>Bible API as the name implies, is an API server which serves bible verses over REST endpoints. To avoid licensing issues, only bibles in the Public Domain are available.</p>
<p>It uses a postgresql database and is written using <a href="https://github.com/actix/actix-web">Actix Web</a> and <a href="https://github.com/launchbadge/sqlx">SQLx</a>.</p>
<p>Right now, two frontends get data from the API.</p>
<ul>
<li><a href="https://bible.berinaniesh.xyz">UI 1</a> - SSR with hydration, fast and responsive UI (prerendering, fetch on hover, etc).</li>
<li><a href="https://scripture.berinaniesh.xyz">UI 2</a> - SSG, more mature UI.</li>
</ul>
<h2 id="license">License</h2>
<p>The server, the data and the bibles are all in the public domain and so feel free to self host, distribute everything.</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Server Jukebox</title>
      <link>https://berinaniesh.xyz/projects/server-jukebox/</link>
      <pubDate>Sun, 02 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>https://berinaniesh.xyz/projects/server-jukebox/</guid>
      <description>&lt;p&gt;Git Repo: &lt;a href=&#34;https://github.com/berinaniesh/server-jukebox&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Server Jukebox, as the name implies is a &lt;a href=&#34;https://en.wikipedia.org/wiki/Jukebox&#34;&gt;jukebox&lt;/a&gt; for a server (no coins needed though :P). It allows anyone on the local network (or the internet) to queue songs to be played on the server.&lt;/p&gt;
&lt;p&gt;It uses &lt;code&gt;yt-dlp&lt;/code&gt; to download audio and &lt;code&gt;mpv&lt;/code&gt; to play the downloaded audio. It also uses a &lt;code&gt;mariadb&lt;/code&gt; database to keep state.&lt;/p&gt;
&lt;h2 id=&#34;deploy&#34;&gt;Deploy&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Clone the &lt;a href=&#34;https://github.com/berinaniesh/server-jukebox&#34;&gt;repo&lt;/a&gt; and &lt;code&gt;cd&lt;/code&gt; into it.&lt;/li&gt;
&lt;li&gt;Create a copy of &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt; and make necessary changes.&lt;/li&gt;
&lt;li&gt;Install &lt;code&gt;sqlx-cli&lt;/code&gt; with &lt;code&gt;cargo install sqlx-cli&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run migrations with &lt;code&gt;sqlx migrate run&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run the application with &lt;code&gt;cargo run --release&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;To deploy as a systemd service, check out &lt;a href=&#34;https://github.com/berinaniesh/server-jukebox/blob/main/jukebox.service&#34;&gt;this&lt;/a&gt; file in the repo.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;screenshots&#34;&gt;Screenshots&lt;/h2&gt;
&lt;h3 id=&#34;web-ui&#34;&gt;Web UI&lt;/h3&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://berinaniesh.xyz/server_jukebox1.png&#34; type=&#34;&#34; alt=&#34;Screenshot1&#34;  /&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Git Repo: <a href="https://github.com/berinaniesh/server-jukebox">Link</a></p>
<p>Server Jukebox, as the name implies is a <a href="https://en.wikipedia.org/wiki/Jukebox">jukebox</a> for a server (no coins needed though :P). It allows anyone on the local network (or the internet) to queue songs to be played on the server.</p>
<p>It uses <code>yt-dlp</code> to download audio and <code>mpv</code> to play the downloaded audio. It also uses a <code>mariadb</code> database to keep state.</p>
<h2 id="deploy">Deploy</h2>
<ul>
<li>Clone the <a href="https://github.com/berinaniesh/server-jukebox">repo</a> and <code>cd</code> into it.</li>
<li>Create a copy of <code>.env.example</code> to <code>.env</code> and make necessary changes.</li>
<li>Install <code>sqlx-cli</code> with <code>cargo install sqlx-cli</code></li>
<li>Run migrations with <code>sqlx migrate run</code></li>
<li>Run the application with <code>cargo run --release</code></li>
<li>To deploy as a systemd service, check out <a href="https://github.com/berinaniesh/server-jukebox/blob/main/jukebox.service">this</a> file in the repo.</li>
</ul>
<h2 id="screenshots">Screenshots</h2>
<h3 id="web-ui">Web UI</h3>
<p><img loading="lazy" src="/server_jukebox1.png" type="" alt="Screenshot1"  /></p>
<h3 id="application-log">Application Log</h3>
<p><img loading="lazy" src="/server_jukebox2.png" type="" alt="Screenshot2"  /></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Universal Code Formatter</title>
      <link>https://berinaniesh.xyz/projects/ucf/</link>
      <pubDate>Wed, 25 Jan 2023 00:00:00 +0000</pubDate>
      
      <guid>https://berinaniesh.xyz/projects/ucf/</guid>
      <description>&lt;p&gt;Git Repo: &lt;a href=&#34;https://github.com/berinaniesh/ucf&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Crates.io: &lt;a href=&#34;https://crates.io/crates/ucf&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Universal Code Formatter (UCF) is a command line application that formats most programming language files.&lt;/p&gt;
&lt;h2 id=&#34;why-ucf&#34;&gt;Why ucf&lt;/h2&gt;
&lt;p&gt;Each programming / markup language has a different formatting tool with different command line flags and different behaviours. The burden of selecting a tool and calling it with the right parameters lies on the IDE or the end user. UCF takes that on to itself. So, without UCF&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;black code1.py
gofmt -w code2.go
rustfmt code3.rs
prettier -w code4.html
clang-format -i code5.cpp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With UCF&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Git Repo: <a href="https://github.com/berinaniesh/ucf">Link</a></p>
<p>Crates.io: <a href="https://crates.io/crates/ucf">Link</a></p>
<p>Universal Code Formatter (UCF) is a command line application that formats most programming language files.</p>
<h2 id="why-ucf">Why ucf</h2>
<p>Each programming / markup language has a different formatting tool with different command line flags and different behaviours. The burden of selecting a tool and calling it with the right parameters lies on the IDE or the end user. UCF takes that on to itself. So, without UCF</p>
<pre tabindex="0"><code>black code1.py
gofmt -w code2.go
rustfmt code3.rs
prettier -w code4.html
clang-format -i code5.cpp
</code></pre><p>With UCF</p>
<pre tabindex="0"><code>ucf code1.py
ucf code2.go
ucf code3.rs
ucf code4.html
ucf code5.cpp
</code></pre><h2 id="installation">Installation</h2>
<h3 id="with-cargo">With cargo</h3>
<pre tabindex="0"><code>cargo install ucf
</code></pre><h3 id="aur">AUR</h3>
<pre tabindex="0"><code>yay -S ucf
</code></pre><h2 id="working">Working</h2>
<p>Under the hood, <code>ucf</code> is a simple program. It determines the file extension of the file and calls the appropriate code formatter with appropriate arguments. The called code formatter should be present in the system&rsquo;s <code>$PATH</code>.</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
