<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tech on Suriya's site</title><link>https://subygan.com/tags/tech/</link><description>Recent content in Tech on Suriya's site</description><generator>Hugo</generator><language>en</language><copyright>This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</copyright><item><title>Performance Hints, notes</title><link>https://subygan.com/tech/performance/abseil/</link><pubDate>Tue, 04 Aug 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/performance/abseil/</guid><description>&lt;p>There&amp;rsquo;s a &lt;a href="https://abseil.io/fast/hints.html">fantastic performance article&lt;/a>
 by the legendary Jeff Dean, Sanjay Ghemawat that covers the vast span of Performance optimizations that captures a good mental model for performance awareness.&lt;/p></description></item><item><title>always smile</title><link>https://subygan.com/essays/smile/</link><pubDate>Wed, 15 Jul 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/smile/</guid><description>&lt;p>mintlify&amp;rsquo;s cofounder wrote an article about why you should &amp;ldquo;&lt;a href="https://x.com/handotdev/status/2077075378859020690">remember to not smile&lt;/a>
&amp;rdquo;. I&amp;rsquo;m sure han is a fantastically optimistic guy. you can&amp;rsquo;t build a company without infinite optimism. while the gist of his article is directionally correct (do hard things), his punchline just points at a dystopian future where people are just grinding on b2b saas while not smiling. and that is a future that even SF techbros don&amp;rsquo;t want.&lt;/p></description></item><item><title>binaries and postgres</title><link>https://subygan.com/tech/tinkering/postgres/binaries/</link><pubDate>Mon, 18 May 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/postgres/binaries/</guid><description>&lt;p>Postgres is awesome, but can You get away with it being a filesystem or stash space for your application. here are some calculations I did.&lt;/p></description></item><item><title>Cloud intro</title><link>https://subygan.com/tech/tinkering/cloud/</link><pubDate>Tue, 28 Apr 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/cloud/</guid><description>&lt;h2 id="what-is-the-cloud-">What is the cloud ?&lt;/h2>
&lt;p>essentially a bunch of server running in a random datacenter.&lt;/p>
&lt;figure>
 &lt;img src="https://subygan.com/assets/images/cloud-intro/rack.jpeg"
 alt="server rack"
 loading="lazy">
 &lt;figcaption>server rack&lt;/figcaption>
&lt;/figure>
&lt;p>These racks and racks of servers can run cohesively together as one simple computer using the Internet. by communicating to each other.&lt;/p></description></item><item><title>RL, in pictures and videos</title><link>https://subygan.com/tech/ML/rl_in_pictures/</link><pubDate>Sat, 25 Apr 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/rl_in_pictures/</guid><description>&lt;h2 id="drone-trained-by-rl-beat-the-worlds-best-human-pilots-2023">drone trained by RL beat the world&amp;rsquo;s best human pilots (2023)&lt;/h2>
&lt;p>UZH, 2023. Trained in simulation. Onboard camera only. Beat three FPV world champions on a real track.&lt;/p></description></item><item><title>recursions</title><link>https://subygan.com/tech/tinkering/recursions/</link><pubDate>Wed, 04 Mar 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/recursions/</guid><description>&lt;p>Recursion is often taught in Computer Science 101 as an elegant, mathematically pure way to solve problems and used widely in leetcode style problems. However, in production environments using mainstream imperative languages (like Python, JavaScript, Java, or C++), it is heavily discouraged. Recursions are usually a footgun in waiting because of some technical&lt;/p></description></item><item><title>(mostly) successful cases of software rewrites with agents in 2026</title><link>https://subygan.com/essays/agents/</link><pubDate>Thu, 26 Feb 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/agents/</guid><description>&lt;p>In the past few weeks there have been examples of successful agent usage at a shocking scale. some in production no less.&lt;/p></description></item><item><title>when rust ≠ performance. a lesson in devex.</title><link>https://subygan.com/tech/performance/oxen-add/</link><pubDate>Mon, 02 Feb 2026 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/performance/oxen-add/</guid><description>&lt;p>I love working at oxen because we strive to be the fastest data versioning tool in the market. Which is why we often do multi terabyte benchmarks on each &lt;a href="https://docs.oxen.ai/getting-started/command-line/local_development">commands that we support&lt;/a>
, (add, commit, etc.)&lt;/p></description></item><item><title>qmd for hugo</title><link>https://subygan.com/tech/tinkering/qmd/</link><pubDate>Mon, 29 Dec 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/qmd/</guid><description>&lt;p>I really love just taking notes, run code and having it in my blog.&lt;/p>
&lt;p>Quarto is quite cool, I end up committing both the &lt;code>.qmd&lt;/code> and &lt;code>.md&lt;/code> files generated from running &lt;code>quarto render&lt;/code> locally. (haven&amp;rsquo;t gotten to cicd yet.)&lt;/p></description></item><item><title>media processing in the cli</title><link>https://subygan.com/tech/tinkering/image-processing/</link><pubDate>Fri, 12 Dec 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/image-processing/</guid><description>&lt;p>convert &lt;code>RW2&lt;/code> format to &lt;code>jpg&lt;/code> with imagemagick. while maintaining quality.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">for&lt;/span> f in *.RW2; &lt;span style="color:#66d9ef">do&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> magick &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$f&lt;span style="color:#e6db74">&amp;#34;&lt;/span> -quality &lt;span style="color:#ae81ff">85&lt;/span> &lt;span style="color:#e6db74">&amp;#34;GooglePhotosBackup/&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>f%.*&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">.jpg&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> exiftool -tagsFromFile &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$f&lt;span style="color:#e6db74">&amp;#34;&lt;/span> -all:all &lt;span style="color:#e6db74">&amp;#34;GooglePhotosBackup/&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>f%.*&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">.jpg&amp;#34;&lt;/span> -overwrite_original
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">done&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>convert mp4 into good quality video.&lt;/p></description></item><item><title>1d convolution</title><link>https://subygan.com/tech/algos/cuda/06_1d_convolution/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/06_1d_convolution/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;stdio.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">convolution_1d_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> kernel, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> input_size, &lt;span style="color:#66d9ef">int&lt;/span> kernel_size) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> i &lt;span style="color:#f92672">=&lt;/span> blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> output_size &lt;span style="color:#f92672">=&lt;/span> input_size &lt;span style="color:#f92672">-&lt;/span> kernel_size &lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (i &lt;span style="color:#f92672">&amp;lt;&lt;/span> output_size ) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">float&lt;/span> sum &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">0.0f&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> ( &lt;span style="color:#66d9ef">int&lt;/span> j &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>; j&lt;span style="color:#f92672">&amp;lt;&lt;/span>kernel_size; j&lt;span style="color:#f92672">++&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> sum &lt;span style="color:#f92672">+=&lt;/span> input[i&lt;span style="color:#f92672">+&lt;/span>j]&lt;span style="color:#f92672">*&lt;/span>kernel[j];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> output[i] &lt;span style="color:#f92672">=&lt;/span> sum;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, kernel, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> kernel, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> input_size, &lt;span style="color:#66d9ef">int&lt;/span> kernel_size) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> output_size &lt;span style="color:#f92672">=&lt;/span> input_size &lt;span style="color:#f92672">-&lt;/span> kernel_size &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (output_size &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> convolution_1d_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, kernel, output, input_size, kernel_size);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>color inversion</title><link>https://subygan.com/tech/algos/cuda/04_color_inversion/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/04_color_inversion/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">invert_kernel&lt;/span>(&lt;span style="color:#66d9ef">unsigned&lt;/span> &lt;span style="color:#66d9ef">char&lt;/span>&lt;span style="color:#f92672">*&lt;/span> image, &lt;span style="color:#66d9ef">int&lt;/span> width, &lt;span style="color:#66d9ef">int&lt;/span> height) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> i &lt;span style="color:#f92672">=&lt;/span> blockIdx.x &lt;span style="color:#f92672">*&lt;/span> blockDim.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>] &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">255&lt;/span> &lt;span style="color:#f92672">-&lt;/span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>] &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">255&lt;/span> &lt;span style="color:#f92672">-&lt;/span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>] &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">255&lt;/span> &lt;span style="color:#f92672">-&lt;/span> image[i&lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// image_input, image_output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">unsigned&lt;/span> &lt;span style="color:#66d9ef">char&lt;/span>&lt;span style="color:#f92672">*&lt;/span> image, &lt;span style="color:#66d9ef">int&lt;/span> width, &lt;span style="color:#66d9ef">int&lt;/span> height) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (width &lt;span style="color:#f92672">*&lt;/span> height &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> invert_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(image, width, height);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>count 2d array element</title><link>https://subygan.com/tech/algos/cuda/14_count_2d_array/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/14_count_2d_array/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">count_2d_equal_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N, &lt;span style="color:#66d9ef">int&lt;/span> M, &lt;span style="color:#66d9ef">int&lt;/span> K) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> idx &lt;span style="color:#f92672">=&lt;/span> blockDim.x&lt;span style="color:#f92672">*&lt;/span>blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> idy &lt;span style="color:#f92672">=&lt;/span> blockDim.y&lt;span style="color:#f92672">*&lt;/span>blockIdx.y &lt;span style="color:#f92672">+&lt;/span> threadIdx.y;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> ((idx&lt;span style="color:#f92672">&amp;lt;&lt;/span>N &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> idy&lt;span style="color:#f92672">&amp;lt;&lt;/span>M) &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> input[idx&lt;span style="color:#f92672">*&lt;/span>M&lt;span style="color:#f92672">+&lt;/span>idy]&lt;span style="color:#f92672">==&lt;/span>K) atomicAdd(output,&lt;span style="color:#ae81ff">1&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N, &lt;span style="color:#66d9ef">int&lt;/span> M, &lt;span style="color:#66d9ef">int&lt;/span> K) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dim3 &lt;span style="color:#a6e22e">threadsPerBlock&lt;/span>(&lt;span style="color:#ae81ff">16&lt;/span>, &lt;span style="color:#ae81ff">16&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dim3 &lt;span style="color:#a6e22e">blocksPerGrid&lt;/span>((N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock.x &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock.x,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (M &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock.y &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock.y);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> count_2d_equal_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, N, M, K);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>count array element</title><link>https://subygan.com/tech/algos/cuda/13_count_array/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/13_count_array/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">count_equal_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N, &lt;span style="color:#66d9ef">int&lt;/span> K) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id&lt;span style="color:#f92672">=&lt;/span>blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span>(id&lt;span style="color:#f92672">&amp;lt;&lt;/span>N &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> input[id]&lt;span style="color:#f92672">==&lt;/span>K) atomicAdd(output, &lt;span style="color:#ae81ff">1&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N, &lt;span style="color:#66d9ef">int&lt;/span> K) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> count_equal_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, N, K);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>leaky relu</title><link>https://subygan.com/tech/algos/cuda/09_leaky_relu/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/09_leaky_relu/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">leaky_relu_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id &lt;span style="color:#f92672">=&lt;/span> blockDim.x&lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (id&lt;span style="color:#f92672">&amp;lt;&lt;/span>N) output[id] &lt;span style="color:#f92672">=&lt;/span> input[id]&lt;span style="color:#f92672">&amp;gt;&lt;/span>&lt;span style="color:#ae81ff">0&lt;/span>&lt;span style="color:#f92672">?&lt;/span> input[id] &lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#ae81ff">0.01&lt;/span>&lt;span style="color:#f92672">*&lt;/span>input[id];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> leaky_relu_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, N);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>matrix addition</title><link>https://subygan.com/tech/algos/cuda/05_matrix_addition/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/05_matrix_addition/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">matrix_add&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> A, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> B, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> C, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id &lt;span style="color:#f92672">=&lt;/span> blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (id&lt;span style="color:#f92672">&amp;lt;&lt;/span>N) C[id] &lt;span style="color:#f92672">=&lt;/span> A[id]&lt;span style="color:#f92672">+&lt;/span>B[id];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// A, B, C are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> A, &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> B, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> C, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">*&lt;/span> N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> matrix_add&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(A, B, C, N);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>matrix copy</title><link>https://subygan.com/tech/algos/cuda/11_matrix_copy/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/11_matrix_copy/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;stdio.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">copy_matrix_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> A, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> B, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> idx &lt;span style="color:#f92672">=&lt;/span> blockDim.x&lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (idx&lt;span style="color:#f92672">&amp;lt;&lt;/span>N){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> B[idx] &lt;span style="color:#f92672">=&lt;/span> A[idx];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// A, B are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> A, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> B, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> total &lt;span style="color:#f92672">=&lt;/span> N &lt;span style="color:#f92672">*&lt;/span> N;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (total &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> copy_matrix_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(A, B, total);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>matrix multiply</title><link>https://subygan.com/tech/algos/cuda/02_matrix_multipy/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/02_matrix_multipy/</guid><description>&lt;p>The tricky part in this was that, I took some time to intuit that each thread should associate to each value in the output matrix.&lt;/p></description></item><item><title>matrix transpose</title><link>https://subygan.com/tech/algos/cuda/03_matrix_transpose/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/03_matrix_transpose/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;stdio.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">matrix_transpose_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> rows, &lt;span style="color:#66d9ef">int&lt;/span> cols) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> i &lt;span style="color:#f92672">=&lt;/span> blockIdx.x &lt;span style="color:#f92672">*&lt;/span> blockDim.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> j &lt;span style="color:#f92672">=&lt;/span> blockIdx.y &lt;span style="color:#f92672">*&lt;/span> blockDim.y &lt;span style="color:#f92672">+&lt;/span> threadIdx.y;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> printf(&lt;span style="color:#e6db74">&amp;#34;%d&amp;#34;&lt;/span>,i);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (i&lt;span style="color:#f92672">&amp;lt;&lt;/span>rows &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> j&lt;span style="color:#f92672">&amp;lt;&lt;/span>cols){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> output[j&lt;span style="color:#f92672">*&lt;/span>rows&lt;span style="color:#f92672">+&lt;/span>i] &lt;span style="color:#f92672">=&lt;/span> input[i&lt;span style="color:#f92672">*&lt;/span>cols&lt;span style="color:#f92672">+&lt;/span>j];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> rows, &lt;span style="color:#66d9ef">int&lt;/span> cols) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dim3 &lt;span style="color:#a6e22e">threadsPerBlock&lt;/span>(&lt;span style="color:#ae81ff">16&lt;/span>, &lt;span style="color:#ae81ff">16&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dim3 &lt;span style="color:#a6e22e">blocksPerGrid&lt;/span>((cols &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock.x &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock.x,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (rows &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock.y &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock.y);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> matrix_transpose_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, rows, cols);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>relu</title><link>https://subygan.com/tech/algos/cuda/08_ReLu/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/08_ReLu/</guid><description>&lt;p>&lt;code>ReLU(x) = max(0,x)&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">relu_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id &lt;span style="color:#f92672">=&lt;/span> blockDim.x&lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (id&lt;span style="color:#f92672">&amp;lt;&lt;/span>N) output[id] &lt;span style="color:#f92672">=&lt;/span> std&lt;span style="color:#f92672">::&lt;/span>max(&lt;span style="color:#ae81ff">0.0f&lt;/span>,input[id]);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers (i.e. pointers to memory on the GPU)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> relu_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, N);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>reverse array</title><link>https://subygan.com/tech/algos/cuda/07_reverse_array/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/07_reverse_array/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;iostream&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;stdio.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">reverse_array&lt;/span>(&lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> i &lt;span style="color:#f92672">=&lt;/span> blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (i&lt;span style="color:#f92672">&amp;lt;&lt;/span>N&lt;span style="color:#f92672">/&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>) { 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> std&lt;span style="color:#f92672">::&lt;/span>swap(input[i],input[N&lt;span style="color:#f92672">-&lt;/span>i&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>]);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input is device pointer
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> reverse_array&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, N);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>silu</title><link>https://subygan.com/tech/algos/cuda/15_sigmoid_linear_unit/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/15_sigmoid_linear_unit/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cpp" data-lang="cpp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">silu_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id &lt;span style="color:#f92672">=&lt;/span> blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (id&lt;span style="color:#f92672">&amp;lt;&lt;/span>N) output[id] &lt;span style="color:#f92672">=&lt;/span> input[id]&lt;span style="color:#f92672">*&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">/&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">+&lt;/span>std&lt;span style="color:#f92672">::&lt;/span>exp(&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">*&lt;/span>(input[id]))));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (N &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> silu_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, N);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>simple inference</title><link>https://subygan.com/tech/algos/cuda/12_simple_inference/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/12_simple_inference/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> torch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> torch.nn &lt;span style="color:#66d9ef">as&lt;/span> nn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># input, model, and output are on the GPU&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">solve&lt;/span>(input: torch&lt;span style="color:#f92672">.&lt;/span>Tensor, model: nn&lt;span style="color:#f92672">.&lt;/span>Module, output: torch&lt;span style="color:#f92672">.&lt;/span>Tensor):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> model&lt;span style="color:#f92672">.&lt;/span>eval()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">with&lt;/span> torch&lt;span style="color:#f92672">.&lt;/span>no_grad():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> output&lt;span style="color:#f92672">.&lt;/span>copy_(model(input))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>swilu</title><link>https://subygan.com/tech/algos/cuda/16_swish_gated_linear_unit/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/16_swish_gated_linear_unit/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-c++" data-lang="c++">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#include&lt;/span> &lt;span style="color:#75715e">&amp;lt;cuda_runtime.h&amp;gt;&lt;/span>&lt;span style="color:#75715e">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">float&lt;/span> &lt;span style="color:#a6e22e">silu&lt;/span>(&lt;span style="color:#66d9ef">float&lt;/span> x){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> x&lt;span style="color:#f92672">*&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">/&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">+&lt;/span>std&lt;span style="color:#f92672">::&lt;/span>exp(&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">*&lt;/span>(x))));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>__global__ &lt;span style="color:#66d9ef">void&lt;/span> &lt;span style="color:#a6e22e">swiglu_kernel&lt;/span>(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> halfN) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> id &lt;span style="color:#f92672">=&lt;/span> blockDim.x &lt;span style="color:#f92672">*&lt;/span> blockIdx.x &lt;span style="color:#f92672">+&lt;/span> threadIdx.x;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span>(id&lt;span style="color:#f92672">&amp;lt;&lt;/span>halfN) output[id] &lt;span style="color:#f92672">=&lt;/span> input[id&lt;span style="color:#f92672">%&lt;/span>halfN]&lt;span style="color:#f92672">*&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">/&lt;/span>(&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">+&lt;/span>std&lt;span style="color:#f92672">::&lt;/span>exp(&lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">*&lt;/span>(input[id&lt;span style="color:#f92672">%&lt;/span>halfN])))) &lt;span style="color:#f92672">*&lt;/span> input[id&lt;span style="color:#f92672">%&lt;/span>halfN &lt;span style="color:#f92672">+&lt;/span> halfN];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// input, output are device pointers
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">extern&lt;/span> &lt;span style="color:#e6db74">&amp;#34;C&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">void&lt;/span> solve(&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> input, &lt;span style="color:#66d9ef">float&lt;/span>&lt;span style="color:#f92672">*&lt;/span> output, &lt;span style="color:#66d9ef">int&lt;/span> N) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> halfN &lt;span style="color:#f92672">=&lt;/span> N &lt;span style="color:#f92672">/&lt;/span> &lt;span style="color:#ae81ff">2&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> threadsPerBlock &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">256&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> blocksPerGrid &lt;span style="color:#f92672">=&lt;/span> (halfN &lt;span style="color:#f92672">+&lt;/span> threadsPerBlock &lt;span style="color:#f92672">-&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">/&lt;/span> threadsPerBlock;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> swiglu_kernel&lt;span style="color:#f92672">&amp;lt;&amp;lt;&amp;lt;&lt;/span>blocksPerGrid, threadsPerBlock&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>(input, output, halfN);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cudaDeviceSynchronize();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>vector addition</title><link>https://subygan.com/tech/algos/cuda/01_vector_addition/</link><pubDate>Wed, 12 Nov 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/cuda/01_vector_addition/</guid><description>&lt;p>The question was&lt;/p>
&lt;pre tabindex="0">&lt;code>Implement a program that performs element-wise addition of two vectors containing 32-bit floating point numbers on a GPU. The program should take two input vectors of equal length and produce a single output vector containing their sum.

Implementation Requirements
External libraries are not permitted
The solve function signature must remain unchanged
The final result must be stored in vector C
&lt;/code>&lt;/pre>&lt;p>Identifying the thread uniquely is always done like using
&lt;code>blockIdx.x * blockDim.x + threadIdx.x&lt;/code>&lt;/p></description></item><item><title>functional programming.</title><link>https://subygan.com/tech/practice/erlang/functional/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/erlang/functional/</guid><description>&lt;p>functional programming (FP) has always seemed like a curiosity – a realm of mathematical purity with little bearing on the practical realities of building robust, scalable software. However, as the complexity of software grows and the demand for concurrent and parallel processing. This post aims to demystify functional programming for the experienced object-oriented programmer and offer a technical bridge from the familiar landscapes of Rust, Python, and C++.&lt;/p></description></item><item><title>phoenix</title><link>https://subygan.com/tech/practice/erlang/phoenix/</link><pubDate>Sat, 25 Oct 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/erlang/phoenix/</guid><description/></item><item><title>machines of loving grace</title><link>https://subygan.com/books/machines_of_loving_grace/</link><pubDate>Tue, 07 Oct 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/books/machines_of_loving_grace/</guid><description>&lt;ul>
&lt;li>Amodei focusing on AI comes from a belief that these risks are the primary obstacles to an overwhelmingly positive future. because if AI is as promising as it is, then it is our job to be that much more careful about it.&lt;/li>
&lt;li>Most people are underestimating the sheer scale of AI&amp;rsquo;s potential benefits, just as they underestimate the risks. This essay is an attempt to sketch out that positive vision.&lt;/li>
&lt;li>He openly admits that these are &amp;ldquo;educated and useful guesses&amp;rdquo; and that the future is inherently unpredictable. The goal is to create a &amp;ldquo;concrete vision&amp;rdquo; to foster discussion, even if the finer details are wrong. and for reasons unknown to me, I&amp;rsquo;m a sucker for these.&lt;/li>
&lt;li>Amodei provides four reasons why he and Anthropic have historically focused on risks rather than benefits:
&lt;ol>
&lt;li>The development of AI and its benefits are largely inevitable due to market forces. The risks, however, are not predetermined and can be influenced by our actions.&lt;/li>
&lt;li>&lt;strong>Avoid Propaganda:&lt;/strong> AI companies risk sounding like propagandists distracting from the downsides when they &amp;ldquo;talk their book.&amp;rdquo;&lt;/li>
&lt;li>&lt;strong>Avoid Grandiosity:&lt;/strong> He expresses distaste for the &amp;ldquo;prophet-like&amp;rdquo; tone some AI leaders adopt (wink wink samA), viewing it as dangerous to frame technological goals in religious terms.&lt;/li>
&lt;li>&lt;strong>Avoid &amp;ldquo;Sci-fi Baggage&amp;rdquo;:&lt;/strong> He believes the common sci-fi tropes (uploaded minds, cyberpunk aesthetics) make the discussion of AI&amp;rsquo;s upside seem unserious and unrelatable to the general public.&lt;/li>
&lt;/ol>
&lt;/li>
&lt;/ul>
&lt;p>From a strategic communication standpoint this essay was interesting. Amodei builds credibility by acknowledging the risks he is known for, which makes his subsequent turn to optimism more powerful and sincere. His reasoning for avoiding &amp;ldquo;propaganda&amp;rdquo; shows a deep understanding of public perception and the importance of intellectual honesty for a company in a field as hyped as AI.&lt;/p></description></item><item><title>elixir</title><link>https://subygan.com/tech/practice/erlang/elixir/</link><pubDate>Fri, 03 Oct 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/erlang/elixir/</guid><description>&lt;h2 id="tools">tools&lt;/h2>
&lt;h2 id="hex">hex&lt;/h2>
&lt;p>is the package manager. similar to pip.&lt;/p>
&lt;h3 id="mix">mix&lt;/h3>
&lt;p>tooling to build, run, test, and release Erlang applications. kinda like cargo for rust.&lt;/p></description></item><item><title>how and why i taught my toddler to read</title><link>https://subygan.com/books/why_I_taught_my_kid/</link><pubDate>Fri, 03 Oct 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/books/why_I_taught_my_kid/</guid><description>&lt;p>I will start out by saying I&amp;rsquo;m a big fan of ridiculously successful people taking their hobbies/passtimes to extreme ends. Which is why i really like, Linus torvalds building his scuba diving software or Nathan Myhrvold writing a five volume book set about bread. Something about it is just fascinating to me. Here is a person whose attention is extremely in demand and there are a million on other higher priority stuff that they could do. But they chose this, and decided to spend an insane amount of time mastering/fixing this niche little problem with the world.&lt;/p></description></item><item><title>software engineering agents work. but only if you do</title><link>https://subygan.com/general/gpt-code/</link><pubDate>Sat, 13 Sep 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/general/gpt-code/</guid><description>&lt;p>Every week there is a new agent that the twitter micro-cosmos gets fired up about. This week it was agent 3.
Which is apparently miles ahead of the competition and is able to plan and execute for up to 200 minutes.&lt;/p></description></item><item><title>rust `move` keyword</title><link>https://subygan.com/tech/practice/rust/move/</link><pubDate>Tue, 09 Sep 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/rust/move/</guid><description>&lt;h2 id="what-is-move">what is &amp;ldquo;move&amp;rdquo;&lt;/h2>
&lt;p>When you assign a value to a new variable or pass a value to a function, the default behavior for types that don&amp;rsquo;t implement the &lt;code>Copy&lt;/code> trait is to &amp;ldquo;move&amp;rdquo; ownership of that value. This means the original variable can no longer be used after the move. This prevents double-free errors and other memory safety issues by ensuring there&amp;rsquo;s always only one owner of the data at any given time. This forms the base of the ownership model, which can be represented like below.&lt;/p></description></item><item><title>async rust</title><link>https://subygan.com/tech/practice/rust/async-rust/</link><pubDate>Sun, 10 Aug 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/rust/async-rust/</guid><description>&lt;p>Asynchronous programming is a powerful paradigm for building highly concurrent and efficient I/O-bound applications.&lt;/p>
&lt;p>I will dissect the core components of Rust&amp;rsquo;s asynchrony, from the fundamental &lt;code>Future&lt;/code> trait to the complexities of &lt;code>Pin&lt;/code> and memory management. We will then unravel the inner workings of Tokio, the most popular async runtime, exploring its scheduler, I/O handling with &lt;code>mio&lt;/code>, and how it all comes together to execute our asynchronous code.&lt;/p></description></item><item><title>postgres</title><link>https://subygan.com/tech/tinkering/postgres/cmds/</link><pubDate>Sun, 10 Aug 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/postgres/cmds/</guid><description>&lt;p>Often in postgres, there are some unique stuff that is there for postgres which slows stuff down or speeds up the query.&lt;/p></description></item><item><title>rust benchmarking</title><link>https://subygan.com/tech/practice/rust/benchmarking/</link><pubDate>Wed, 25 Jun 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/rust/benchmarking/</guid><description>&lt;h2 id="libraries">libraries&lt;/h2>
&lt;h3 id="criterionrs">&lt;a href="https://github.com/bheisler/criterion.rs">criterion.rs&lt;/a>
&lt;/h3>
&lt;ul>
&lt;li>Has really good defaults and seems to work out of the box.&lt;/li>
&lt;li>The ecosystem around criterion is really good. purely because criterion has been around for so long&lt;/li>
&lt;/ul>
&lt;h3 id="rust-iai">&lt;a href="https://github.com/bheisler/iai">rust iai&lt;/a>
&lt;/h3>
&lt;p>Even though it is supported by a lot of ecosystem tools. It hasn&amp;rsquo;t been in development for the past 4 years. and &lt;a href="https://github.com/bheisler">bheisler&lt;/a>
 is the creator of criterion, so even more reason to use criterion.&lt;/p></description></item><item><title>ai media editor</title><link>https://subygan.com/general/ai-media-editor/</link><pubDate>Sat, 29 Mar 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/general/ai-media-editor/</guid><description>&lt;p>The first animation movie, toy story was made in 1995. At that time this was a break through. It involved a lot of proprietary software (Ray tracing, shaders, motion blur) and decades of research and development.
In 2025, for the first time a movie made in open source software (blender) received the oscar.&lt;/p></description></item><item><title>server setup</title><link>https://subygan.com/tech/tinkering/server/</link><pubDate>Fri, 07 Mar 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/server/</guid><description>&lt;h3 id="oh-my-zsh">oh my zsh&lt;/h3>
&lt;ul>
&lt;li>oh-my-zsh has hands down been a godsend for me.&lt;/li>
&lt;/ul>
&lt;p>for that though we first need to install &lt;code>zsh&lt;/code>&lt;/p></description></item><item><title>mobile dev</title><link>https://subygan.com/tech/tinkering/mobile_dev/</link><pubDate>Fri, 28 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/mobile_dev/</guid><description>&lt;p>Mobile development is probably the most highest abstracted operation possible. because of this there are too many pitfalls that trip up&lt;/p></description></item><item><title>source code</title><link>https://subygan.com/books/source_code/</link><pubDate>Wed, 26 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/books/source_code/</guid><description>&lt;p>Bill Gates starts this story from his roots up until the point he found Microsoft and it became a really serious thing. I like that the book closes right after the founding of Microsoft. Because much has been written about that part of the story&lt;/p></description></item><item><title>react native</title><link>https://subygan.com/tech/tinkering/react-native/</link><pubDate>Sat, 22 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/react-native/</guid><description>&lt;p>I&amp;rsquo;ve worked with React Native before but never professionally.&lt;/p>
&lt;p>Recently I&amp;rsquo;ve been getting into building a complete react-native app&lt;/p>
&lt;p>And, that is when you see the dark underside of things.&lt;/p></description></item><item><title>practical deep learning</title><link>https://subygan.com/tech/ML/practical_deep_learning/</link><pubDate>Sat, 15 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/practical_deep_learning/</guid><description>&lt;p>notes from &lt;a href="https://www.fast.ai/">fast.ai&lt;/a>
 Practical Deep Learning course.&lt;/p></description></item><item><title>vscode</title><link>https://subygan.com/tech/tinkering/vscode/</link><pubDate>Sat, 15 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/vscode/</guid><description>&lt;h2 id="why-switch-from-intellij">why switch from intellij&lt;/h2>
&lt;p>Intellij was my most common IDE but I&amp;rsquo;m so tired of having to be a second citizen for every single plugin. Intellij needs to do a huge platform shift and become more open or be consumed by vscode. The amount of people who start with vscode is insane.&lt;/p></description></item><item><title>karpathy micrograd</title><link>https://subygan.com/til/08-02-2025/</link><pubDate>Sat, 08 Feb 2025 00:00:00 +0000</pubDate><guid>https://subygan.com/til/08-02-2025/</guid><description>&lt;p>Went through karpathy&amp;rsquo;s incredible micrograd tutorial.&lt;/p>
&lt;p>His explanation and the code was incredibly intuitive.&lt;/p>
&lt;p>Autograd libraries build a network graph of a given equation with each operation being a node and then apply chain rule to find the local gradient. This is useful because it enables you to calculate back propagation easily as well as locally.&lt;/p></description></item><item><title>websites that are interesting</title><link>https://subygan.com/tech/websites/</link><pubDate>Tue, 17 Dec 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/websites/</guid><description>&lt;h2 id="tools">tools&lt;/h2>
&lt;p>&lt;a href="https://linkpreview.xyz/">https://linkpreview.xyz/&lt;/a>
&lt;/p>
&lt;h2 id="weirdnesss">weirdnesss&lt;/h2>
&lt;p>&lt;a href="https://cult-escape.com/cult-test/">https://cult-escape.com/cult-test/&lt;/a>

A site to check if you are in a cult&lt;/p>
&lt;p>Site &lt;a href="https://www.languagetransfer.org/">https://www.languagetransfer.org/&lt;/a>
&lt;/p>
&lt;p>&lt;a href="https://www.window-swap.com/">https://www.window-swap.com/&lt;/a>
&lt;/p>
&lt;h3 id="games-in-arcane-places">games in arcane places&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://eieio.games/nonsense/game-11-flappy-bird-finder/">https://eieio.games/nonsense/game-11-flappy-bird-finder/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.coderelay.io/fontemon.html">https://www.coderelay.io/fontemon.html&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://messenger.abeto.co/">https://messenger.abeto.co/&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h3 id="interesting-design-websites">interesting design websites&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://iradesign.io/gallery/illustrations">Really good design stuff&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.framer.com/">https://www.framer.com/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://spline.design/">https://spline.design/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://2019.makemepulse.com/">https://2019.makemepulse.com/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://fffuel.co/">JS Design generation&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.humaaans.com/">Corporate Memphis Humaaans for every situation&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h2 id="programming-weirdness">programming weirdness&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://k8s.af/">https://k8s.af/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://research.wmz.ninja/projects/phd/index.html">https://research.wmz.ninja/projects/phd/index.html&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h2 id="ml">ml&lt;/h2>
&lt;ul>
&lt;li>LLM visualization, &lt;a href="https://bbycroft.net/llm">https://bbycroft.net/llm&lt;/a>
&lt;/li>
&lt;li>Model visualizer, &lt;a href="https://netron.app/">https://netron.app/&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://chat.lmsys.org/">https://chat.lmsys.org/&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h2 id="scholarly-links">scholarly links&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="http://www.wikicfp.com">http://www.wikicfp.com&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>poetry</title><link>https://subygan.com/tech/tinkering/poetry/</link><pubDate>Thu, 14 Nov 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/poetry/</guid><description>&lt;p>Python package management is a nightmare. Poetry somewhat solves it.&lt;/p>
&lt;h2 id="new-project">new project&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>poetry new &amp;lt;project_name&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="new-shell">new shell&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>poetry shell
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="setting-up">setting up&lt;/h2>
&lt;p>pipx first&lt;/p></description></item><item><title>prime number library for rust</title><link>https://subygan.com/tech/algos/prime/</link><pubDate>Wed, 16 Oct 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/prime/</guid><description>&lt;p>&lt;a href="https://docs.rs/primes/latest/primes/">primes&lt;/a>
 does not handle numbers &amp;gt; 1000&lt;/p>
&lt;p>We need a nice cli that is able to take in arbitrary sized numbers and just chug away.&lt;/p></description></item><item><title>photogrammetry/videogrammetry or the dark art of capturing 2d and generating 3d models</title><link>https://subygan.com/tech/ML/photogrammetry/</link><pubDate>Fri, 11 Oct 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/photogrammetry/</guid><description>&lt;h1 id="capturing">capturing&lt;/h1>
&lt;h2 id="questions">questions:&lt;/h2>
&lt;p>Is it possible to go from, photo/video to high fidelity 3d model, with strong support for texture, without losing a lot of details on noise?&lt;/p></description></item><item><title>leaky abstractions, or how we understand the world</title><link>https://subygan.com/essays/leaky_abstractions/</link><pubDate>Wed, 02 Oct 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/leaky_abstractions/</guid><description>&lt;p>Languages are a lossy communication framework. You meant one thing, but your friend understood something else. The same words don&amp;rsquo;t mean the same thing even a few hundred miles apart, etc. It is wildly unfair to try and represent billions of neurons firing together, in sound waves only a few amplitudes higher or lower.&lt;/p></description></item><item><title>llms and unstructured data</title><link>https://subygan.com/tech/tinkering/structure/</link><pubDate>Sat, 31 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/structure/</guid><description>&lt;p>Close on the heels of running a &lt;a href="https://subygan.com/tech/cloud/batch_processing_llm">batch processing job over 1M documents&lt;/a>
, I was thinking about how LLMs are changing the way we process unstructured data.&lt;/p></description></item><item><title>unix</title><link>https://subygan.com/tech/cloud/unix/</link><pubDate>Mon, 19 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/unix/</guid><description>&lt;p>If you are on a unix-like environment, ports &amp;lt; 1024 (like 80) will require superuser privileges.&lt;/p>
&lt;h2 id="disk-mounting-and-unmounting">disk mounting and unmounting&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>sudo mount -o discard,defaults &amp;lt;diskid&amp;gt; &amp;lt;dir&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>you can get the disk id by&lt;/p></description></item><item><title>zsh</title><link>https://subygan.com/tech/tinkering/zshrc/</link><pubDate>Mon, 19 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/zshrc/</guid><description>&lt;h2 id="setting-up-new-zsh-with-oh-my-zsh">setting up new zsh with oh my zsh&lt;/h2>
&lt;p>firs installing zsh involves&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>brew install zsh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>While I don&amp;rsquo;t really trust and run randomly downloaded shell files. This one is quite painless.&lt;/p></description></item><item><title>library of congress information</title><link>https://subygan.com/tech/tinkering/loc/</link><pubDate>Sat, 17 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/loc/</guid><description>&lt;p>Library of Congress is really an incredible repository of content.
Just scrolling through library of congress is a fascinating mental exercise.&lt;/p></description></item><item><title>vim</title><link>https://subygan.com/tech/cloud/vi/</link><pubDate>Thu, 15 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/vi/</guid><description>&lt;p>Vim stuff that I usually use and generally forget&lt;/p>
&lt;p>clear file &lt;code>gg&lt;/code> do go to top of file then, &lt;code>dG&lt;/code> do delete till the end&lt;/p></description></item><item><title>gossip glomers</title><link>https://subygan.com/tech/algos/dist_systems/gg/</link><pubDate>Thu, 08 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/dist_systems/gg/</guid><description>&lt;p>I reused the functions provided at &lt;a href="https://github.com/jepsen-io/maelstrom/tree/main/demo/go">https://github.com/jepsen-io/maelstrom/tree/main/demo/go&lt;/a>

for interfaces.&lt;/p>
&lt;p>repo: &lt;a href="https://github.com/subygan/gg">https://github.com/subygan/gg&lt;/a>
&lt;/p>
&lt;h2 id="1-echo">1. echo&lt;/h2>
&lt;p>This was a gentle intro to maelstrom and it&amp;rsquo;s tools. TBF the message passing using RPC was pretty interesting. Implementing the &lt;code>read()&lt;/code> and &lt;code>write()&lt;/code> functions and then handing it off to the maelstrom Node made it work.&lt;/p></description></item><item><title>ml journal</title><link>https://subygan.com/tech/ML/ML_diary/</link><pubDate>Thu, 08 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/ML_diary/</guid><description>&lt;h1 id="092723">09.27.23&lt;/h1>
&lt;ul>
&lt;li>Tried ML model for face classification with,&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> self&lt;span style="color:#f92672">.&lt;/span>backbone &lt;span style="color:#f92672">=&lt;/span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Sequential(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Conv2d(&lt;span style="color:#ae81ff">3&lt;/span>,&lt;span style="color:#ae81ff">64&lt;/span>,kernel_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">7&lt;/span>,stride&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Conv2d(&lt;span style="color:#ae81ff">64&lt;/span>,&lt;span style="color:#ae81ff">128&lt;/span>, kernel_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>, stride&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Conv2d(&lt;span style="color:#ae81ff">128&lt;/span>,&lt;span style="color:#ae81ff">256&lt;/span>,kernel_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>, stride&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Conv2d(&lt;span style="color:#ae81ff">256&lt;/span>, &lt;span style="color:#ae81ff">512&lt;/span>,kernel_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>, stride&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Conv2d(&lt;span style="color:#ae81ff">512&lt;/span>, &lt;span style="color:#ae81ff">1024&lt;/span>,kernel_size&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>, stride&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span>),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> )
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> self&lt;span style="color:#f92672">.&lt;/span>cls_layer &lt;span style="color:#f92672">=&lt;/span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Sequential(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Flatten(),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> torch&lt;span style="color:#f92672">.&lt;/span>nn&lt;span style="color:#f92672">.&lt;/span>Linear( &lt;span style="color:#ae81ff">4096&lt;/span>,num_classes),
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> )
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This model overfit spectacularly, training accuracy after 20 epochs was 95% validation accuracy was 15%. 🤯&lt;/p></description></item><item><title>terminal</title><link>https://subygan.com/tech/tinkering/terminal/</link><pubDate>Thu, 08 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/terminal/</guid><description>&lt;p>&lt;strong>Raw mode&lt;/strong> in a terminal is receiving the raw bytes from the &lt;code>STDIN&lt;/code> file.
terminal usually gets opened in &lt;strong>canonical mode&lt;/strong> which means input is fed to the program one line at a time, instead of character by character. This can be done by unsetting the &lt;code>ICANON&lt;/code> flag. There are a lot of these &lt;em>bitflags&lt;/em>&lt;/p></description></item><item><title>right to be forgotten</title><link>https://subygan.com/tech/privacy/right_to_forget/</link><pubDate>Tue, 06 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/right_to_forget/</guid><description>&lt;p>This is a (mostly) search engine specific requirement where individuals are protected from the harm of their past actions.&lt;/p>
&lt;h2 id="disparity-in-countries">disparity in countries&lt;/h2>
&lt;p>Similar to any privacy issue, these countries are divided in the way these laws are implemented. Especially between developed countries such as United States and the European Union.&lt;/p></description></item><item><title>word embedding models</title><link>https://subygan.com/tech/ML/word2vec/</link><pubDate>Sun, 04 Aug 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/word2vec/</guid><description>&lt;p>&lt;strong>My aim for this blog was to keep it as not too technical as possible.&lt;/strong>&lt;/p>
&lt;p>Word embeddings is a way to represent words as a vector.
Which lets us do all kinds of trickery like how far a word like &amp;ldquo;King&amp;rdquo; is away from &amp;ldquo;Queen&amp;rdquo; and how they are related to each other with.
Very useful when building applications with semantic understanding.&lt;/p></description></item><item><title>read the docs</title><link>https://subygan.com/tech/tinkering/read_docs/</link><pubDate>Tue, 23 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/read_docs/</guid><description>&lt;p>Failing to read the documentation and understanding the code underneath is the bane of all software bugs and I&amp;rsquo;ve guilty of it on multiple counts&lt;/p></description></item><item><title>shell hacks</title><link>https://subygan.com/tech/tinkering/shell/</link><pubDate>Tue, 23 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/shell/</guid><description>&lt;h2 id="number-of-lines-in-a-file">number of lines in a file&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>wc -l file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="split-file-into-multiple-files">split file into multiple files&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>split -l &lt;span style="color:#ae81ff">1000&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="append-two-files-into-one">append two files into one&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>cat file1.txt file2.txt &amp;gt; file3.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="find-pid-of-port">find pid of port&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>sudo lsof -i :&amp;lt;portnumber&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>privacy problems and attacks in machine learning</title><link>https://subygan.com/tech/privacy/privacy_ml/</link><pubDate>Fri, 19 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/privacy_ml/</guid><description>&lt;h2 id="privacy-problems-and-attacks-in-machine-learning">privacy problems and attacks in machine learning&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Membership inference attacks&lt;/strong>: These aim to determine if a particular data point was used to train a model. Researchers study how to detect and mitigate such attacks to protect individuals&amp;rsquo; privacy.&lt;/li>
&lt;li>&lt;strong>Model inversion attacks&lt;/strong>: These attempt to reconstruct training data from model outputs. Understanding these vulnerabilities helps in developing more robust privacy-preserving techniques.&lt;/li>
&lt;li>&lt;strong>Data reconstruction in federated learning&lt;/strong>: This examines how malicious participants could potentially extract private information from other participants during collaborative training.&lt;/li>
&lt;li>&lt;strong>Model extraction attacks&lt;/strong>: These involve extracting a model&amp;rsquo;s architecture or parameters, which could be used to launch further attacks or to steal intellectual property.&lt;/li>
&lt;li>&lt;strong>Data Poisoning in Edge ML&lt;/strong>: This is a problem where the data that is being used to train the model is poisoned by an attacker. This is a huge problem in edge ML where the data is not curated and is coming from a variety of sources.&lt;/li>
&lt;li>&lt;strong>Differential privacy techniques&lt;/strong>: Researchers explore how to add controlled noise to data or model outputs to preserve privacy while maintaining utility.&lt;/li>
&lt;li>&lt;strong>Secure multi-party computation&lt;/strong>: This involves developing protocols for multiple parties to jointly compute on private data without revealing individual inputs.
Homomorphic encryption: This allows computations on encrypted data, potentially enabling privacy-preserving machine learning on sensitive information.
Privacy-preserving record linkage: Techniques to securely combine datasets from multiple sources without compromising individual privacy.&lt;/li>
&lt;/ul>
&lt;h2 id="papers-and-other-readings">papers and other readings&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://www.cs.cornell.edu/~shmat/shmat_oak18.pdf">Membership Inference Attacks Against Machine Learning Models&lt;/a>
&lt;/p></description></item><item><title>my stack</title><link>https://subygan.com/tech/cloud/my_stack/</link><pubDate>Mon, 15 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/my_stack/</guid><description>&lt;p>I used to deploy everything in an ec2 instance with docker-compose and nginx. Keeps it clean to apply small updates and also take backups. Where I&amp;rsquo;ll run different postgres containers for different containers, with some volume mapping and a backup container that triggers a backup push.&lt;/p></description></item><item><title>batch processing llm inference</title><link>https://subygan.com/tech/cloud/batch_processing_llm/</link><pubDate>Sun, 14 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/batch_processing_llm/</guid><description>&lt;p>I experimented with a lot of models, and as advertised claude3-haiku gave the best results, in terms of quality and cost. At the time of writing 1K input tokens cost $0.00025. Which is mind blowingly cheap, because the next best model was about 8 times costlier not to mention gpt 4o which was about 20 times costlier.&lt;/p></description></item><item><title>git lfs</title><link>https://subygan.com/tech/tinkering/git/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/git/</guid><description>&lt;h2 id="global-gitignore">global gitignore&lt;/h2>
&lt;p>I&amp;rsquo;m surprised I only came to know on 2024 that you can have a global gitignore&lt;/p>
&lt;p>you can just put this inside &lt;code>~/.gitignore&lt;/code>&lt;/p></description></item><item><title>sprites.dev</title><link>https://subygan.com/tech/tinkering/sprites/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/sprites/</guid><description>&lt;p>I like to have a standard work environment that I can have multiple zellij is important, installing it with,&lt;/p>
&lt;p>&lt;code>cargo install zellij&lt;/code>&lt;/p></description></item><item><title>gccissues</title><link>https://subygan.com/tech/bugs/gcc/</link><pubDate>Sun, 07 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/bugs/gcc/</guid><description>&lt;p>A simple way to include all available libraries in cpp in most OSs is to just add &lt;code>#include &amp;lt;bits/stdc++.h&amp;gt;&lt;/code>.
This is generall good practice as it includes all the libraries and increases the compilation time.&lt;/p></description></item><item><title>chapter 1 exercises</title><link>https://subygan.com/tech/algos/problems/cp4/00_ch1_ex/</link><pubDate>Sat, 06 Jul 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/problems/cp4/00_ch1_ex/</guid><description>&lt;h3 id="exercise-111">exercise 1.1.1&lt;/h3>
&lt;p>Counter example: &lt;code>{0,0},{0,-1},{0,-2},{0,4},{0,-4},{4,4}&lt;/code>
Greedy value: 6 + 1 + 4 = 11
Correct value: 4 + 4 + 1 = 9&lt;/p></description></item><item><title>a backend engineer writes frontend</title><link>https://subygan.com/tech/bugs/frontend/</link><pubDate>Mon, 06 May 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/bugs/frontend/</guid><description>&lt;p>My friend Limin and I, were playing around with some LLM agents and realized that these agents could be a very good way to learn a language as they have a much better grip on the language and are able to provide great feedbacks.&lt;/p></description></item><item><title>streaming diarizer</title><link>https://subygan.com/tech/ML/streaming_diarizer/</link><pubDate>Sat, 20 Apr 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/streaming_diarizer/</guid><description>&lt;p>&lt;a href="https://github.com/subygan/SpeechStream">repo&lt;/a>
&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://github.com/NVIDIA/NeMo/blob/main/tutorials/speaker_tasks/Speaker_Diarization_Training.ipynb">Nemo Speaker diarization training&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://github.com/NVIDIA/NeMo/blob/main/tutorials/tools/Multispeaker_Simulator.ipynb">MultiSpeaker Simulation&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h3 id="data-sets">data sets&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://www.openslr.org/12">LibriSpeech&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://github.com/joonson/voxconverse">VoxConverse&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h2 id="resources">resources&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/ufal/whisper_streaming">Whisper Streaming&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://ieeexplore.ieee.org/abstract/document/10446050">Diarist&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>llm code generation notes</title><link>https://subygan.com/tech/ML/code_llm/</link><pubDate>Tue, 19 Mar 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/code_llm/</guid><description>&lt;p>This is going to be binary analysis with LLM type thing
The idea is to see, if LLMs are able to understand the &amp;ldquo;language&amp;rdquo; of binaries and are able to retrieve the underlying vulnerability.&lt;/p></description></item><item><title>wav file shenanigans</title><link>https://subygan.com/tech/bugs/wav_file/</link><pubDate>Tue, 19 Mar 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/bugs/wav_file/</guid><description>&lt;p>Reading input from users is difficult.
I faced this issue with&lt;/p>
&lt;p>Python&amp;rsquo;s default &lt;code>wave&lt;/code> library throws this error on specific wave file.&lt;/p></description></item><item><title>flutter gimmicks</title><link>https://subygan.com/tech/practice/flutter/flutter_gimmicks/</link><pubDate>Fri, 08 Mar 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/flutter/flutter_gimmicks/</guid><description>&lt;p>Flutter comes with super complex build system that ties in all the language runtimes with dart and the native rendering engine. So, naturally there is a tradeoff between having to build all these things and being slow or reusing builds and being fast but occassionally wrong.
Flutter I think, errs on the latter. So, most times when you feel like flutter is not doing something you think it should be doing, it is because the build got messed up.&lt;/p></description></item><item><title>federated learning</title><link>https://subygan.com/tech/ML/federated_learning/</link><pubDate>Sun, 03 Mar 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/federated_learning/</guid><description/></item><item><title>rust cheatsheet</title><link>https://subygan.com/tech/practice/rust/cheatsheet/</link><pubDate>Wed, 28 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/rust/cheatsheet/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> x; &lt;span style="color:#75715e">// declare &amp;#34;x&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>x &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">42&lt;/span>; &lt;span style="color:#75715e">// assign 42 to &amp;#34;x&amp;#34;, type is inferred
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-rust" data-lang="rust">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> x &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">42&lt;/span> &lt;span style="color:#75715e">//assigns variable
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> x: &lt;span style="color:#66d9ef">i32&lt;/span>; &lt;span style="color:#75715e">//declaring variable &amp;#34;x&amp;#34; of 32 bit integer
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>foobar(x); &lt;span style="color:#75715e">//uninitialised variable assignment
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>x &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">52&lt;/span>; &lt;span style="color:#75715e">// assigning 52
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>foobar(x); &lt;span style="color:#75715e">//x will be called
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>x &lt;span style="color:#f92672">=&lt;/span> x &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">12&lt;/span>; &lt;span style="color:#75715e">// x = 64 now
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> _ &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">42&lt;/span>; &lt;span style="color:#75715e">// does nothing, since 42 is a constant and _ is a placeholder
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> _ &lt;span style="color:#f92672">=&lt;/span> get_function(); &lt;span style="color:#75715e">//calls function and throws away the result
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">let&lt;/span> _x &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">42&lt;/span>; &lt;span style="color:#75715e">//compiler wont warn about unused variable
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Just like in all languages elements within objects can be called using a dot.&lt;/p></description></item><item><title>aws</title><link>https://subygan.com/tech/cloud/aws/</link><pubDate>Sun, 25 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/aws/</guid><description>&lt;h3 id="amazon-linux">amazon linux&lt;/h3>
&lt;p>Does not use &lt;code>apt-get&lt;/code> and only uses yum.
replace all &lt;code>apt-get&lt;/code> with yum&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>sudo systemctl enable docker.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo systemctl start docker.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>different types of graphs i come across</title><link>https://subygan.com/tech/ML/plots/</link><pubDate>Sun, 25 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/plots/</guid><description>&lt;h3 id="pandas">pandas&lt;/h3></description></item><item><title>pandas fight</title><link>https://subygan.com/tech/ML/pandas/</link><pubDate>Sat, 24 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/pandas/</guid><description>&lt;p>When a column has NaN it is shown as float value in a column.
need to use &lt;code>.fillna(&amp;quot;&amp;quot;)&lt;/code> to replace the &lt;code>Nan&lt;/code> with empty string.&lt;/p></description></item><item><title>graphs and llms</title><link>https://subygan.com/tech/ML/graph_llm/</link><pubDate>Sun, 11 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/graph_llm/</guid><description>&lt;p>I&amp;rsquo;ll add the ones with the most fun:utilization first&lt;/p>
&lt;h3 id="building-graphs-using-llms">building graphs using llms:&lt;/h3>
&lt;p>This strategy comes clearly under the &lt;strong>by LLMs&lt;/strong> category and the most obvious one as well. Because of their semantic understanding, LLMs can be prompted into providing the triplets of relationship between the entities in a piece of text. Throw a piece of text, and it draws a graph of the relationship between subjects and objects
This is a relatively straightforward utilization of an LLM&amp;rsquo;s ability to find pattern in text.
eg. &lt;a href="https://news.ycombinator.com/item?id=34605772">GraphGPT&lt;/a>
w&lt;/p></description></item><item><title>research papers</title><link>https://subygan.com/tech/ML/papers/</link><pubDate>Fri, 09 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/papers/</guid><description>&lt;ul>
&lt;li>
&lt;p>aiaac, AI incidents database.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://arxiv.org/pdf/2311.17035.pdf">Scalable Extraction of Traning Data from (Production) Language Models&lt;/a>
&lt;/p>
&lt;ul>
&lt;li>Making LLMs repeat the same word over and over again makes them emit the training data 3.5X better&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="//">The pain of Building copilots&lt;/a>
&lt;/p></description></item><item><title>ml guardrails</title><link>https://subygan.com/tech/ML/llm_guardrails/</link><pubDate>Tue, 06 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/llm_guardrails/</guid><description>&lt;p>The base premise is that, aligning the model for the goal that it was created for is a long tail problem and requires multiple guardrails to control it&amp;rsquo;s output. Without this, the model could possibly go off the rails and create a lot of confusion.&lt;/p></description></item><item><title>research ideas</title><link>https://subygan.com/ideas/research/</link><pubDate>Sun, 04 Feb 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/ideas/research/</guid><description>&lt;h3 id="continual-learning">Continual learning&lt;/h3>
&lt;h4 id="ai-guardrail-comparison">ai guardrail comparison&lt;/h4>
&lt;ul>
&lt;li>There are multipel LLM guardrails, evaluating them would be something&lt;/li>
&lt;/ul>
&lt;h4 id="privacy-detector-dataset-and-custom-model">privacy detector dataset and custom model&lt;/h4>
&lt;ul>
&lt;li>There is no dataset to test a model for it&amp;rsquo;s privacy Capabilities&lt;/li>
&lt;li>A custom model implementation that tests this information against an LLM would also be helpful&lt;/li>
&lt;/ul></description></item><item><title>prompt engineering</title><link>https://subygan.com/tech/ML/prompt_engineering/</link><pubDate>Tue, 23 Jan 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/prompt_engineering/</guid><description>&lt;h2 id="in-context-learning">in context learning&lt;/h2>
&lt;h2 id="chain-of-thought">chain-of-thought&lt;/h2>
&lt;p>Broadly three classes of reasoning tasks
&amp;ldquo;let&amp;rsquo;s think step by step&amp;rdquo; seems to be the key phrase&lt;/p></description></item><item><title>cmu square</title><link>https://subygan.com/tech/privacy/cmu_square/</link><pubDate>Thu, 18 Jan 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/cmu_square/</guid><description>&lt;p>SQUARE (Software Quality Requirements Engineering) is SEI&amp;rsquo;s framework for &amp;ldquo;Improving identification, analysis, specification and management (of software)&amp;rdquo;.&lt;/p>
&lt;p>This, Broadly involves 9 steps,&lt;/p></description></item><item><title>data privacy</title><link>https://subygan.com/books/data_privacy/</link><pubDate>Tue, 16 Jan 2024 00:00:00 +0000</pubDate><guid>https://subygan.com/books/data_privacy/</guid><description>&lt;p>These are my notes from Nishant&amp;rsquo;s excellent book, &lt;a href="https://www.oreilly.com/library/view/data-privacy/9781617298998/">Data Privacy: Runbook for Engineers&lt;/a>
&lt;/p>
&lt;h2 id="1-privacy-engineering">1 privacy engineering&lt;/h2>
&lt;ul>
&lt;li>Data Security is usually tightly coupled with privacy. Data security is a base condition to guarantee privacy.&lt;/li>
&lt;li>Data privacy is about how data of users is being accessed and processed.&lt;/li>
&lt;li>There are 4 broad process for data privacy that the author describes,
&lt;ul>
&lt;li>Data classification&lt;/li>
&lt;li>Data inventory&lt;/li>
&lt;li>Data deletion&lt;/li>
&lt;li>Data obfuscation&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h3 id="how-data-flows">how data flows.&lt;/h3>
&lt;ul>
&lt;li>From a Tech leader&amp;rsquo;s standpoint, they need a catalog of data to figure out the tooling to deploy for each case.&lt;/li>
&lt;li>Without the catalog the leader would be flying blind.&lt;/li>
&lt;/ul>
&lt;h3 id="why-privacy">why privacy&lt;/h3>
&lt;ul>
&lt;li>Direct motivators for companies
&lt;ul>
&lt;li>Fines are getting bigger and numerous each year.&lt;/li>
&lt;li>non-investment in the Early stage cases late-stage headaches
&lt;ul>
&lt;li>I liked the Gamebuster example, where IP addresses where being queried by automated scripts and copied in other tables, A clear failure of access control. which led to multiple impacts across the product. My question was, how would a leader be aware of this structure? is getting their hands dirty the only way?&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Investigations are usually long and take a lot of the company&amp;rsquo;s and it&amp;rsquo;s leader&amp;rsquo;s valuable time. eg. Bill Gates and his Distraction.
[personal note,] it was interesting to me that all the Data protection examples are from EU and none from America. Show&amp;rsquo;s the fragmented regulation in the US?&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>There is a lag between engineering and the law, which means engineering has to be prescient about the future laws and it&amp;rsquo;s consequences.&lt;/li>
&lt;li>Regulatory certifications, makes it easier to,
&lt;ul>
&lt;li>Have structure and systems&lt;/li>
&lt;li>Increase trust in the product&lt;/li>
&lt;li>Makes work more efficient, because there are already answers to questions&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;p>Early data tagging makes it easier to maintain privacy in the system. If we continue Facebook&amp;rsquo;s &lt;a href="https://www.vice.com/en/article/akvmke/facebook-doesnt-know-what-it-does-with-your-data-or-where-it-goes#:~:text=%E2%80%9CWe%E2%80%99ve%20built%20systems%20with%20open%20borders">ink metaphor&lt;/a>
, With ink that is tagged, you could at least make the ink immiscible and trace it and separate it back. So early tagging is very important. because tags can then be filtered.&lt;/p></description></item><item><title>purple llama</title><link>https://subygan.com/tech/ML/purple_llama/</link><pubDate>Mon, 11 Dec 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/purple_llama/</guid><description>&lt;p>PurpleLlama is a new framework proposed by Meta to evaluate LLMs for their secure coding ability.&lt;/p>
&lt;h2 id="cyberseceval">cyberseceval&lt;/h2>
&lt;p>This is the core part of the research paper which has created a &lt;a href="https://github.com/facebookresearch/PurpleLlama/tree/main/CybersecurityBenchmarks">benchmark for LLMs&lt;/a>
 to test generated code.&lt;/p></description></item><item><title>membership inference attack</title><link>https://subygan.com/tech/ML/MIA/</link><pubDate>Sat, 09 Dec 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/MIA/</guid><description>&lt;p>Membership inference Attack is a way to retrieve back the probability of the original training inputs.&lt;/p>
&lt;h3 id="notes">notes&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://arxiv.org/pdf/1610.05820.pdf">https://arxiv.org/pdf/1610.05820.pdf&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>42. trapping rain water</title><link>https://subygan.com/tech/algos/problems/leetcode/42_trapping_rain/</link><pubDate>Sun, 26 Nov 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/problems/leetcode/42_trapping_rain/</guid><description>&lt;h2 id="problem-statement">problem statement&lt;/h2>
&lt;p>Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.&lt;/p></description></item><item><title>min in rotated array</title><link>https://subygan.com/tech/algos/problems/leetcode/154_min_in_rotated_arr/</link><pubDate>Sun, 26 Nov 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/problems/leetcode/154_min_in_rotated_arr/</guid><description>&lt;p>Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:&lt;/p></description></item><item><title>longest valid parentheses</title><link>https://subygan.com/tech/algos/problems/leetcode/32_longest_parentheses/</link><pubDate>Fri, 24 Nov 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/problems/leetcode/32_longest_parentheses/</guid><description>&lt;p>problem link: &lt;a href="https://leetcode.com/problems/longest-valid-parentheses/">https://leetcode.com/problems/longest-valid-parentheses/&lt;/a>
&lt;/p>
&lt;p>Typically, in the parentheses problem a stack is the obvious choice. I spent too much time, chasing a phantom solution by thinking about this as a DP problem and filling various arrays.&lt;/p></description></item><item><title>intro to llm</title><link>https://subygan.com/tech/ML/Intro_to_llm/</link><pubDate>Thu, 23 Nov 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/ML/Intro_to_llm/</guid><description>&lt;p>My notes on Karpathy&amp;rsquo;s &lt;a href="https://youtu.be/zjkBMFhNj_g">Intro to LLM talk&lt;/a>
&lt;/p>
&lt;h3 id="llama-2-70b">llama-2-70b&lt;/h3>
&lt;ul>
&lt;li>comes with &lt;code>run.c&lt;/code> ~500 lines of c for it to be a self-contained runnable model.&lt;/li>
&lt;li>LLM are a lossy compression of the internet.&lt;/li>
&lt;li>In the process of trying to predict the next word, The model would have to understand the World that led to the creation of that next word.&lt;/li>
&lt;li>What the model does is closer to a dream, than determinism. The model only knows that something of a certain structure has to come there. It is not going to exactly replicate the world. It is dreaming about it and just like every dream the finer details could be hazy.&lt;/li>
&lt;li>Reversal curse, knowledge that can be accessed from one angle, cannot be accessed when from another angle. And it is hard to understand why, because even though the equations behind the models are well understood. It is hard to reason within the billions of parameters and figure out why the model came to a certain conclusion.&lt;/li>
&lt;/ul>
&lt;h3 id="assistant-training">assistant training&lt;/h3>
&lt;p>After training the Language model on a number of Epochs over the whole corpus of internet text.&lt;/p></description></item><item><title>ai governance and threat modelling</title><link>https://subygan.com/tech/privacy/ml_governance/</link><pubDate>Thu, 09 Nov 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/ml_governance/</guid><description>&lt;h2 id="how-are-ml-systems-measured">how are ml systems measured.&lt;/h2>
&lt;p>While training this is the loss and accuracy of the prediction.&lt;/p>
&lt;p>For LLMs there are benchmarks like,&lt;/p></description></item><item><title>why privacy?</title><link>https://subygan.com/tech/privacy/why_privacy/</link><pubDate>Tue, 03 Oct 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/why_privacy/</guid><description>&lt;p>Fundamental problem has been that, privacy is hard to define.
Privacy stretches and shrinks based on context, culture and time.&lt;/p></description></item><item><title>right around the corner, a story of million possibilities</title><link>https://subygan.com/essays/03_right_around_the_corner/</link><pubDate>Thu, 21 Sep 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/03_right_around_the_corner/</guid><description>&lt;p>The problem is, uncertainty.&lt;/p>
&lt;p>As humans, we&amp;rsquo;ve been fighting with this for a long while. We try to make Everything around predictable. predictability is safe, predictability is iterable, predictability is controllable. This is true for the innovation of fire, as it is, to Settling down at a farm. We wanted to reliably have, fire, food and shelter. This is also the reason why people hate new Changes, &amp;ldquo;new&amp;rdquo; is unknown ergo unpredictable so should be kept away. Because of this, we end up going to the same McDonald&amp;rsquo;s that we go a million times over.&lt;/p></description></item><item><title>browser privacy test</title><link>https://subygan.com/tech/privacy/browser_privacy/</link><pubDate>Tue, 19 Sep 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/browser_privacy/</guid><description>&lt;p>I came across this website which tracks and tests privacy of various browsers. &lt;a href="https://privacytests.org/">https://privacytests.org/&lt;/a>

Takeaway IMO:&lt;/p>
&lt;p>in desktop browsers&lt;/p>
&lt;ul>
&lt;li>
&lt;p>Brave, Mullvad and librewolf seems better because of the built in ad protection. but brave clearly has better User experience.&lt;/p></description></item><item><title>privacy articles</title><link>https://subygan.com/tech/privacy/articles/</link><pubDate>Tue, 19 Sep 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/articles/</guid><description>&lt;h2 id="blogs">blogs&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.ovalerio.net/archives/2615">Privacy best practices&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.scu.edu/ethics/focus-areas/internet-ethics/resources/why-we-care-about-privacy/">Why we care about privacy&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.ietf.org/archive/id/draft-farrell-tenyearsafter-00.html">reflections on snowden revealations&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://martinfowler.com/articles/intro-pet.html">PETs an intro to technologists&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.theprivacywhisperer.com/p/privacy-ux-and-privacy-culture">Privacy UX and privacy culture&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.forbes.com/sites/forbestechcouncil/2022/02/22/whos-good-at-data-privacy/">Who&amp;rsquo;s good at data privacy&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://cacm.acm.org/magazines/2023/3/270204-metrics-for-success/abstract">Metrics for success: How to evaluate Privacy choice in usability&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://pair.withgoogle.com/explorables/federated-learning/">How Federated Learning Protects privacy&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://blog.research.google/2022/02/federated-learning-with-formal.html">Federated learning with formal privacy guarantees&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://ico.org.uk/media/about-the-ico/consultations/4021464/chapter-5-anonymisation-pets.pdf">PETs&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://www.scss.tcd.ie/doug.leith/apple_google.pdf">Mobile Handset Privacy&lt;/a>
&lt;/li>
&lt;li>&lt;a href="https://matrix.org/blog/2022/03/25/interoperability-without-sacrificing-privacy-matrix-and-the-dma/">Interoperability without sacrificing privacy: Matrix and the DMA&lt;/a>
&lt;/li>
&lt;li>&lt;/li>
&lt;/ul>
&lt;h2 id="tools">tools&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://privacytests.org/">Browser Privacy Test&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>a graduate course in applied cryptography</title><link>https://subygan.com/books/applied_crypto/</link><pubDate>Sun, 04 Jun 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/books/applied_crypto/</guid><description>&lt;h2 id="encryption">encryption&lt;/h2>
&lt;p>Shannon cipher assumes a shared secret key that is no smaller than the message being transmitted.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>One time pad&lt;/strong> a Shannon cipher where the keys, messages and ciphertexts are bit strings of the same length&lt;/li>
&lt;/ul>
&lt;h3 id="resources">resources&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://crypto.stanford.edu/~dabo/cryptobook/BonehShoup_0_4.pdf">https://crypto.stanford.edu/~dabo/cryptobook/BonehShoup_0_4.pdf&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>cicumventing ad block</title><link>https://subygan.com/tech/privacy/gtm/</link><pubDate>Sat, 22 Apr 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/privacy/gtm/</guid><description>&lt;p>using a DNS aliasing to circumvent ad blocking tools got me wondering about the feasibility, because theoretically it should be possible.&lt;/p></description></item><item><title>intellij hacks</title><link>https://subygan.com/tech/tinkering/intellij/</link><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/intellij/</guid><description>&lt;p>live templates is very useful to record oft repeated patterns&lt;/p>
&lt;p>&lt;code>control + '&lt;/code> to toggle soft wrap in a file&lt;/p></description></item><item><title>kafka</title><link>https://subygan.com/tech/cloud/kafka/</link><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/cloud/kafka/</guid><description>&lt;h2 id="apache-kafka">apache kafka&lt;/h2>
&lt;p>&lt;strong>event streaming platform&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;em>Events?&lt;/em> - incident of change&lt;/li>
&lt;/ul>
&lt;h3 id="kafka-and-events---keyvalue-pairs">kafka and events - key/value pairs&lt;/h3>
&lt;p>based on &lt;strong>Distributed commit log&lt;/strong>&lt;/p></description></item><item><title>system design</title><link>https://subygan.com/tech/practice/sys_design/</link><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/sys_design/</guid><description>&lt;h2 id="scaling-to-million-users">scaling to million users&lt;/h2>
&lt;ul>
&lt;li>isolate, process and database&lt;/li>
&lt;/ul>
&lt;h3 id="db-scaling">db scaling&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Database replication&lt;/strong> Master(writes,updates), slave(reads) setup for databases helps scale reads in a database
&lt;ul>
&lt;li>When a master node goes down, a slave is selected and promoted to become the master\&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h3 id="process-scaling">process scaling&lt;/h3>
&lt;p>Scaling process nodes horizontally in a fan out fashion with a &lt;strong>load balancer&lt;/strong> in front, so that the requests can be distributed between servers. load balancers are able to keep track of the quality of the services. and make decisions on where to send which requests.&lt;/p></description></item><item><title>web</title><link>https://subygan.com/tech/tinkering/web/</link><pubDate>Mon, 03 Apr 2023 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/web/</guid><description>&lt;h3 id="no-cache-image">no cache image&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>curl -s -I -X GET https://i.countdownmail.com/2212f0.gif
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> HTTP/2 &lt;span style="color:#ae81ff">200&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> date: Sat, &lt;span style="color:#ae81ff">08&lt;/span> Oct &lt;span style="color:#ae81ff">2022&lt;/span> 07:10:40 GMT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> content-type: image/gif
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> vary: Accept-Encoding
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cache-control: no-cache,no-store,must-revalidate,max-age&lt;span style="color:#f92672">=&lt;/span>0,proxy-revalidate,no-transform,private
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> pragma: no-cache
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires: -1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cf-cache-status: BYPASS
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> report-to: &lt;span style="color:#f92672">{&lt;/span>&lt;span style="color:#e6db74">&amp;#34;endpoints&amp;#34;&lt;/span>:&lt;span style="color:#f92672">[{&lt;/span>&lt;span style="color:#e6db74">&amp;#34;url&amp;#34;&lt;/span>:&lt;span style="color:#e6db74">&amp;#34;https:\/\/a.nel.cloudflare.com\/report\/v3?s=ojsVIWtY5FGmXMXpki%2BZhdPypWt9kJuNg1tWhv8q691GSk7n5Y2zuCCtFcFvTP%2FCMdLASEF90CYfW7sTh3rrcdGzwwEHl524UpTYmJrIU9uoFJ%2Br%2FTCOBAiBJeySbcA7UDrt%2Fr3e&amp;#34;&lt;/span>&lt;span style="color:#f92672">}]&lt;/span>,&lt;span style="color:#e6db74">&amp;#34;group&amp;#34;&lt;/span>:&lt;span style="color:#e6db74">&amp;#34;cf-nel&amp;#34;&lt;/span>,&lt;span style="color:#e6db74">&amp;#34;max_age&amp;#34;&lt;/span>:604800&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> nel: &lt;span style="color:#f92672">{&lt;/span>&lt;span style="color:#e6db74">&amp;#34;success_fraction&amp;#34;&lt;/span>:0,&lt;span style="color:#e6db74">&amp;#34;report_to&amp;#34;&lt;/span>:&lt;span style="color:#e6db74">&amp;#34;cf-nel&amp;#34;&lt;/span>,&lt;span style="color:#e6db74">&amp;#34;max_age&amp;#34;&lt;/span>:604800&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> server: cloudflare
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> cf-ray: 756d0edc3bd13c13-BLR
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> alt-svc: h3&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;:443&amp;#34;&lt;/span>; ma&lt;span style="color:#f92672">=&lt;/span>86400, h3-29&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;:443&amp;#34;&lt;/span>; ma&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">86400&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Basically, this is a service that creates timer gifs. based on the URL. the &lt;code>cache-control&lt;/code> part is the most interesting. This is pretty efficient and asks the browser to not cache anything. This ensures that everytime the cache is new&lt;/p></description></item><item><title>hugo notes</title><link>https://subygan.com/tech/tinkering/hugo/</link><pubDate>Mon, 26 Dec 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/hugo/</guid><description>&lt;h3 id="making-a-nested-map">making a nested map&lt;/h3>
&lt;p>&lt;code>$m := dict (slice &amp;quot;n&amp;quot; &amp;quot;m&amp;quot; &amp;quot;new&amp;quot;) &amp;quot;true&amp;quot;&lt;/code> creates a nested map with &lt;code>m.n.m.new&lt;/code> returning &amp;ldquo;true&amp;rdquo;&lt;/p></description></item><item><title>mapreduce</title><link>https://subygan.com/tech/practice/mapreduce/</link><pubDate>Sat, 24 Dec 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/mapreduce/</guid><description>&lt;p>MapReduce is a programming model published in 2004 by google, to process large data in clusters&lt;/p>
&lt;p>in general, it involves 2 events&lt;/p></description></item><item><title>language design</title><link>https://subygan.com/tech/practice/language_design/</link><pubDate>Sat, 10 Dec 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/language_design/</guid><description>&lt;h2 id="rust-and-ownership">rust and ownership&lt;/h2>
&lt;p>Rust has &lt;strong>no garbage collector&lt;/strong>&lt;/p>
&lt;h2 id="garbage-collectors">garbage collectors&lt;/h2>
&lt;h2 id="scala-and-actor-model">scala and actor model&lt;/h2></description></item><item><title>bloom filter</title><link>https://subygan.com/tech/algos/bloom_filter/</link><pubDate>Sat, 12 Nov 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/bloom_filter/</guid><description>&lt;p>Bloom filters have nothing to do with flowers (despite the blog emoji 🥸). It was conceived by Burton howard Bloom. This is a &lt;em>Space-efficient probablistic data structure&lt;/em>. In Bloom filter false positives are very much possible, but false-negatives are not possible (i.e.) a query either returns, &amp;ldquo;possibly in set&amp;rdquo; or &amp;ldquo;definitely not&amp;rdquo;. So, when a bloom filter returns &amp;ldquo;no&amp;rdquo; you can believe it, if it returns &amp;ldquo;maybe&amp;rdquo; you cannot. And it is very very efficient.&lt;/p></description></item><item><title>javascript for impatient programmers</title><link>https://subygan.com/tech/practice/js/js_for_impatient/</link><pubDate>Sun, 06 Nov 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/js/js_for_impatient/</guid><description>&lt;p>These are my notes from following the excellent book, &lt;a href="https://exploringjs.com/impatient-js/index.html">javascript for impatient programmers&lt;/a>
 by axel Rauschmayer&lt;/p>
&lt;h3 id="understanding-let-and-var">understanding let and var&lt;/h3>
&lt;p>The &lt;code>let&lt;/code> keyword creates a new variable locally. it is &lt;strong>not attached to the global object&lt;/strong>&lt;/p></description></item><item><title>regex</title><link>https://subygan.com/tech/practice/regex/</link><pubDate>Sun, 06 Nov 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/regex/</guid><description>&lt;p>?(?!.&lt;em>]).&lt;/em>[^(]) - Select all content between the last &lt;code>?&lt;/code> and the last &lt;code>)&lt;/code> in a line and excludes if &lt;code>]&lt;/code> comes between&lt;/p></description></item><item><title>designing data intensive applications notes</title><link>https://subygan.com/tech/practice/ddia/</link><pubDate>Sun, 23 Oct 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/ddia/</guid><description>&lt;h1 id="ch-1-reliable-scalable-and-maintainable-applications">ch-1: reliable, scalable and maintainable applications&lt;/h1>
&lt;ul>
&lt;li>
&lt;p>reliability, The system should continue to work &lt;strong>correctly&lt;/strong> even in the face of adversity (hw, sw or human).&lt;/p></description></item><item><title>miscelaneous details about golang</title><link>https://subygan.com/tech/practice/golang/misc/</link><pubDate>Mon, 19 Sep 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/misc/</guid><description>&lt;h3 id="go-get-vs-go-install">&lt;code>go get&lt;/code> vs &lt;code>go install&lt;/code>&lt;/h3>
&lt;p>&lt;code>go get&lt;/code>, downloads and adds in GOPATH.
&lt;code>go install&lt;/code>, add&lt;/p>
&lt;h4 id="creating-mutex">creating mutex&lt;/h4>
&lt;p>When embedding a mutex in a struct. any functions associated to the mutex should utilize a pointer receiver.&lt;/p></description></item><item><title>aws ses</title><link>https://subygan.com/tech/cloud/aws_ses/</link><pubDate>Sat, 17 Sep 2022 14:14:11 +0000</pubDate><guid>https://subygan.com/tech/cloud/aws_ses/</guid><description>&lt;p>In Sandbox mode, mail can be sent only to verified emails. We need permission for that specific address.&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://docs.aws.amazon.com/ses/latest/dg/request-production-access.html">https://docs.aws.amazon.com/ses/latest/dg/request-production-access.html&lt;/a>
&lt;/li>
&lt;/ul></description></item><item><title>pocketbase</title><link>https://subygan.com/tech/tinkering/pocketbase/</link><pubDate>Thu, 01 Sep 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/pocketbase/</guid><description>&lt;p>I&amp;rsquo;ve been looking for an alternative to firebase. Because OSS FTW!!&lt;/p>
&lt;p>Pocketbase is an alternative with A bold claim.&lt;/p>
&lt;p>But, it really does 2 things very well, AUTH APIs and CRUD APIs over DBs.&lt;/p></description></item><item><title>dbms - cmu db user group</title><link>https://subygan.com/tech/practice/DB/</link><pubDate>Sat, 30 Jul 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/practice/DB/</guid><description>&lt;h3 id="sources">sources&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://www.youtube.com/watch?v=oeYBdghaIjc&amp;amp;list=PLSE8ODhjZXjbohkNBWQs_otTrBTrjyohi">CMU database group&lt;/a>
&lt;/li>
&lt;/ul>
&lt;h2 id="relational-model">relational model&lt;/h2>
&lt;p>&lt;strong>Relation&lt;/strong> is unordered set of &lt;strong>tuples&lt;/strong>. A &lt;strong>tuple&lt;/strong> is a set of attribute values.&lt;/p></description></item><item><title>product ideas</title><link>https://subygan.com/ideas/product/</link><pubDate>Sat, 16 Jul 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/ideas/product/</guid><description>&lt;p>Inspiration comes from many places. I love jotting them down here.&lt;/p>
&lt;h3 id="small-app-ideas">small app ideas&lt;/h3>
&lt;ul>
&lt;li>Video editor skill&lt;/li>
&lt;li>linkedin post skill&lt;/li>
&lt;li>virtual bookshelf where you can showcase your books.
&lt;ul>
&lt;li>I wonder if this can be self serve. like I can just take a video of a book, convert it into a gaussian cloud and create a virtual library.&lt;/li>
&lt;li>Are Gaussian models there, where I can run them client side.&lt;/li>
&lt;li>the goal is to get stripe press like aesthetics for books.&lt;/li>
&lt;li>I&amp;rsquo;m not sure about the legality.&lt;/li>
&lt;li>It might be easier to have a book shape and attach the front back etc.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>link storage and recording as a telegram bot or email etc with the ability to show case in a website&lt;/li>
&lt;li>Something with Audio models such as &lt;a href="https://fugatto.github.io/">fugatto&lt;/a>

&lt;ul>
&lt;li>Isolate tracks&lt;/li>
&lt;li>humming -&amp;gt; Song&lt;/li>
&lt;li>Unlimited song/rap/metallic generation.&lt;/li>
&lt;li>Introduce a product&lt;/li>
&lt;li>Introduce&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Ideas with &lt;a href="https://www.anthropic.com/news/model-context-protocol">Model Context Protocol&lt;/a>
 enabling LLM Agents with cool tools
&lt;ul>
&lt;li>Object storage for models&lt;/li>
&lt;li>Memory layer for any agent&lt;/li>
&lt;li>Auth layer for agents to authenticate into a page. It is quite obvious how this can even be extended into a secret manager for agents as when these things grow there is a need to manage private and personal data. Maybe credit card information, etc.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Inventory management with Video models. Going from video -&amp;gt; list of inventory. Gemini can do it, tested.&lt;/li>
&lt;li>talk with a youtube video
&lt;ul>
&lt;li>Simple extension to inject a chat window + summarization&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>Talking with a document&lt;/li>
&lt;li>Unstructured data to structured data&lt;/li>
&lt;li>Image or Video cropping with SAM2 or &lt;a href="https://yangchris11.github.io/samurai/">SAMURAI&lt;/a>
 models.&lt;/li>
&lt;li>Video Editing LLM going from a long form video&lt;/li>
&lt;li>LLamacoder for any LL
&lt;ul>
&lt;li>&lt;a href="https://github.com/nutlope/llamacoder">https://github.com/nutlope/llamacoder&lt;/a>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>async prompt processing APIs&lt;/li>
&lt;li>Python library for overarching batch prompts&lt;/li>
&lt;li>Release Youtube chrome Extension&lt;/li>
&lt;li>Browser automation for testing, automatically booking tickets etc.&lt;/li>
&lt;li>native MP3 player, with a remote library&lt;/li>
&lt;/ul>
&lt;h2 id="problems-i-have">problems i have&lt;/h2>
&lt;ul>
&lt;li>
&lt;h3 id="real-time-agent-human-collaborative-vfs-rust-crdt-gatekeeper">&lt;strong>Real-Time Agent-Human Collaborative VFS (Rust CRDT Gatekeeper)&lt;/strong>&lt;/h3>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Rust Gatekeeper Server:&lt;/strong> An Axum+Tokio web server acts as the sole authority over the physical disk, bypassing standard OS file-locking by routing all multi-user connections through WebSocket rooms.&lt;/p></description></item><item><title>visualising performance</title><link>https://subygan.com/tech/tinkering/profiler/</link><pubDate>Wed, 13 Apr 2022 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/profiler/</guid><description>&lt;h3 id="interesting">interesting:&lt;/h3>
&lt;ul>
&lt;li>Flame graphs don&amp;rsquo;t show sequentiality. They are not sorted based on time. They are sorted by alphabets. Which means in the flame graphs, if&lt;/li>
&lt;/ul>
&lt;p>eg.
&lt;figure>
 &lt;img src="https://subygan.com/assets/images/flamegraph.png"
 alt="flamegraph image"
 loading="lazy">
 &lt;figcaption>flamegraph image&lt;/figcaption>
&lt;/figure>
&lt;/p></description></item><item><title>fixing chrome extension issues</title><link>https://subygan.com/tech/bugs/browser_extension/</link><pubDate>Sat, 12 Feb 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/bugs/browser_extension/</guid><description>&lt;p>Bugs in a browser extension are always frustrating because extensions are usually so brittle. There are so many error handling and other challenges.
This is from when I was building one.&lt;/p></description></item><item><title>django issues and quick fixes</title><link>https://subygan.com/tech/tinkering/django/</link><pubDate>Fri, 04 Feb 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/django/</guid><description>&lt;p>CSRF token invalid &lt;code>__URL__&lt;/code> not in trusted origin&lt;/p>
&lt;p>This happens because there is no &lt;code>CSRF_TRUSTED_ORIGINS&lt;/code> in the settings file. Also make sure that the url &lt;strong>does not have an end slash&lt;/strong>&lt;/p></description></item><item><title>building an extension</title><link>https://subygan.com/tech/tinkering/browser_extension/</link><pubDate>Wed, 02 Feb 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/browser_extension/</guid><description>&lt;p>browser extensions have been an area of interest for a while. I tried building an extension that would help me save stuff in my &lt;a href="https://subygan.com/readlog">readlog&lt;/a>
. Sort of simply highlight stuff from within the page.&lt;/p></description></item><item><title>searching for a cross platform framework</title><link>https://subygan.com/tech/tinkering/search_cross_platform/</link><pubDate>Sat, 29 Jan 2022 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/search_cross_platform/</guid><description>&lt;p>This is still a WIP and I&amp;rsquo;ll be updating each one as I discover and play with new stuff.&lt;/p>
&lt;h2 id="why-cross-platform">why cross platform?&lt;/h2>
&lt;p>There are majorly 2 mobile platforms and 3 desktop platforms. Browsers are acting as a cool layer between this, within the realms of which applications are consistently rendered and usability is not spoilt. This is awesome, because now you don&amp;rsquo;t need 5X the development effort to deliver a software experience But only one. Which means velocity can be much faster. But the problem with this, is that &amp;ldquo;websites&amp;rdquo; are not really perceived as serious applicaitons. And there is very little control over the user experience. Native apps are a better way to deliver applications.&lt;/p></description></item><item><title>registering with google and other</title><link>https://subygan.com/tech/tinkering/seo/</link><pubDate>Thu, 23 Dec 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/seo/</guid><description>&lt;p>Without praying at the altar of google, A site doesn&amp;rsquo;t exist in the internet.&lt;/p>
&lt;p>A site can be registered by visiting &lt;a href="https://search.google.com/search-console">search.google.com&lt;/a>

But, before I&amp;rsquo;m handed over the tools for SEO google does a &amp;ldquo;ownership validation&amp;rdquo;. they gave me a secret of sorts. I had to add a TXT Record in my DNS provider. And verify it.&lt;/p></description></item><item><title>installing jekyll for the first time and issues</title><link>https://subygan.com/tech/tinkering/ruby_v_xcode/</link><pubDate>Tue, 21 Dec 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/ruby_v_xcode/</guid><description>&lt;p>I was trying to install jekyll in my local machine and faced this error&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in &lt;span style="color:#e6db74">`&lt;/span>try_do&lt;span style="color:#960050;background-color:#1e0010">&amp;#39;&lt;/span>: The compiler failed to generate an executable file. &lt;span style="color:#f92672">(&lt;/span>RuntimeError&lt;span style="color:#f92672">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>You have to install development tools first.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>this was fixed by running&lt;/p></description></item><item><title>local tunnels with cloudflare</title><link>https://subygan.com/tech/tinkering/local_tunnels/</link><pubDate>Tue, 06 Jul 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/local_tunnels/</guid><description>&lt;h1 id="exposing-local-services-with-cloudflare-tunnels">Exposing Local Services with Cloudflare Tunnels&lt;/h1>
&lt;p>Cloudflare Tunnels let you expose local services to the internet without opening ports or configuring firewalls. Here&amp;rsquo;s how to set it up.&lt;/p></description></item><item><title>ruby hack</title><link>https://subygan.com/tech/tinkering/ruby/</link><pubDate>Tue, 06 Jul 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/ruby/</guid><description>&lt;p>&lt;code>rvm&lt;/code> is a tool to maintain a Ruby environment.
&lt;code>rvm --default&lt;/code> is a shortcut to set the default Ruby environment.
&lt;code>rvm use&lt;/code> is a shortcut to set the current Ruby environment.&lt;/p></description></item><item><title>searching for a self-hosted vpn</title><link>https://subygan.com/tech/tinkering/vpn/</link><pubDate>Tue, 06 Jul 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/vpn/</guid><description>&lt;h2 id="goals">goals:&lt;/h2>
&lt;ul>
&lt;li>Find a VPN solution that would be able to maintain an ACL.&lt;/li>
&lt;li>No licensing solutions&lt;/li>
&lt;/ul>
&lt;p>OpenVPN - Not Truly self-hosted, in the sense that you will have to pay for the software in the range of $7 per user. Even if you self host it&lt;/p></description></item><item><title>ostep-1 virtualisation</title><link>https://subygan.com/tech/practice/ostep/Virtualisation/</link><pubDate>Thu, 01 Apr 2021 22:15:00 +0000</pubDate><guid>https://subygan.com/tech/practice/ostep/Virtualisation/</guid><description>&lt;h1 id="ch4--processes">ch4 : processes&lt;/h1>
&lt;p>&lt;ins>The problem&lt;/ins>: How to create the illusion of many CPUs when, we only have few.&lt;/p>
&lt;p>done by running one process and pausing and running another and so on. This is called &lt;strong>time sharing&lt;/strong>.&lt;/p></description></item><item><title>arm</title><link>https://subygan.com/essays/arm/</link><pubDate>Fri, 25 Sep 2020 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/arm/</guid><description>&lt;p>A history lesson on ARM, The company that is at the epicenter of all tech innovation in the 21st century.&lt;/p></description></item><item><title>the missing innovation</title><link>https://subygan.com/essays/02_missing_innovation/</link><pubDate>Tue, 24 Mar 2020 00:00:00 +0000</pubDate><guid>https://subygan.com/essays/02_missing_innovation/</guid><description>&lt;p>Historically, Most innovation has originated from developed nations and trickled down to developing ones, very much following the &lt;a href="https://en.wikipedia.org/wiki/Trickle-down_effect">Trickle down efffect&lt;/a>
&lt;/p></description></item><item><title>GPT2</title><link>https://subygan.com/tech/tinkering/gpt-2/</link><pubDate>Tue, 16 Jul 2019 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/gpt-2/</guid><description>&lt;p>It is such a great time to be alive! so many new things and so many innovations in all fields. I was reading about the GPT-2 which was released by OpenAI a few months back, in this blog. GPT-2 is a Natural language synthesiser, that is able to synthesise paragraphs naturally based on the raw input given to it.&lt;/p></description></item><item><title>todo</title><link>https://subygan.com/tech/algos/1_todo/</link><pubDate>Fri, 12 Nov 2010 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/algos/1_todo/</guid><description>&lt;ul>
&lt;li>Levenshtein automaton&lt;/li>
&lt;li>paxos algorithm
&lt;ul>
&lt;li>&lt;a href="https://martinfowler.com/articles/patterns-of-distributed-systems/paxos.html">https://martinfowler.com/articles/patterns-of-distributed-systems/paxos.html&lt;/a>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul></description></item><item><title>benchmarking</title><link>https://subygan.com/tech/practice/golang/benchmarking/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/benchmarking/</guid><description>&lt;p>Benchmarking tools are built-in with the &amp;ldquo;testing&amp;rdquo; package&lt;/p>
&lt;p>These can be done by writing test files of the format &amp;ldquo;&lt;x>_test.go&amp;rdquo;&lt;/p></description></item><item><title>custom user agent for testing</title><link>https://subygan.com/tech/tinkering/custom_ua/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/tinkering/custom_ua/</guid><description>&lt;p>A &lt;a href="https://en.wikipedia.org/wiki/User_agent">user-agent&lt;/a>
 is used to recognize the browser and the device the project, &lt;a href="https://developers.whatismybrowser.com/useragents/explore/">whatismybrowser.com&lt;/a>
 have a database of user agents it&amp;rsquo;s just a string that says about your browser and device type that is sent as a cookie in every request. You can find your current user agent by googling &amp;ldquo;&lt;a href="https://www.google.com/search?q=what&amp;#43;is&amp;#43;my&amp;#43;user&amp;#43;agent">what is my user agent&lt;/a>
&amp;rdquo;&lt;/p></description></item><item><title>dart by example</title><link>https://subygan.com/tech/practice/flutter/dart_basics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/flutter/dart_basics/</guid><description>&lt;h2 id="main">main&lt;/h2>
&lt;p>&lt;code>main()&lt;/code> is the entrypoint for application&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;Hello, World&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Also, this works&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main() &lt;span style="color:#f92672">=&amp;gt;&lt;/span> print(&lt;span style="color:#e6db74">&amp;#39;Hello&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="values">values&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print( &lt;span style="color:#e6db74">&amp;#34;1+1=&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#f92672">+&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span> ) &lt;span style="color:#75715e">//prints &amp;#34;1+1=2&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="for">for&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> (&lt;span style="color:#66d9ef">var&lt;/span> i &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>; i&lt;span style="color:#f92672">&amp;lt;&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>; i&lt;span style="color:#f92672">++&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print( i )
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> collection &lt;span style="color:#f92672">=&lt;/span> [&lt;span style="color:#ae81ff">3&lt;/span>,&lt;span style="color:#ae81ff">4&lt;/span>,&lt;span style="color:#ae81ff">5&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> (&lt;span style="color:#66d9ef">var&lt;/span> x &lt;span style="color:#66d9ef">in&lt;/span> collection) { &lt;span style="color:#75715e">//&amp;lt;&amp;lt;-- This works like python
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> print(x)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="conditionals">conditionals&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#ae81ff">7&lt;/span>&lt;span style="color:#f92672">%&lt;/span>&lt;span style="color:#ae81ff">2&lt;/span> &lt;span style="color:#f92672">==&lt;/span> &lt;span style="color:#ae81ff">0&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;7 is even&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ) &lt;span style="color:#66d9ef">else&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;7 is odd&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//ternary operators
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">var&lt;/span> isAlive &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> monday &lt;span style="color:#f92672">=&lt;/span> isAlive&lt;span style="color:#f92672">?&lt;/span>&lt;span style="color:#e6db74">&amp;#39;doctor&amp;#39;&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">null&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#960050;background-color:#1e0010">`&lt;/span>$moday&lt;span style="color:#960050;background-color:#1e0010">`&lt;/span>) &lt;span style="color:#75715e">//prints &amp;#34;doctor&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="null-aware-operators">null aware operators&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> moday &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#39;doctor&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> tuesday;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> next &lt;span style="color:#f92672">=&lt;/span> tuesday &lt;span style="color:#f92672">??&lt;/span> monday; &lt;span style="color:#75715e">//Assign monday if tuesday is null
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> wednesday;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> next &lt;span style="color:#f92672">??=&lt;/span> wednesday; &lt;span style="color:#75715e">// Assign if not null
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">String&lt;/span> thursday;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> length &lt;span style="color:#f92672">=&lt;/span> thursday&lt;span style="color:#f92672">?&lt;/span>.length; &lt;span style="color:#75715e">//Call function if not null
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="switch">switch&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">var&lt;/span> piece &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#39;knight&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">switch&lt;/span>(piece) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">case&lt;/span> &lt;span style="color:#e6db74">&amp;#39;queen&amp;#39;&lt;/span>&lt;span style="color:#f92672">:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">case&lt;/span> &lt;span style="color:#e6db74">&amp;#39;bishop&amp;#39;&lt;/span>&lt;span style="color:#f92672">:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;diagonal&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">case&lt;/span> &lt;span style="color:#e6db74">&amp;#39;knight&amp;#39;&lt;/span>&lt;span style="color:#f92672">:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;L-shape&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>} 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">FoodSpoiledError&lt;/span> &lt;span style="color:#66d9ef">extends&lt;/span> StateError {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> FoodSpoiledError (&lt;span style="color:#66d9ef">String&lt;/span> msg) &lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">super&lt;/span>(msg);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">Potato&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">int&lt;/span> age;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Potato(&lt;span style="color:#66d9ef">this&lt;/span>.age);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">String&lt;/span> peel() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (age&lt;span style="color:#f92672">&amp;gt;&lt;/span>&lt;span style="color:#ae81ff">4&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">throw&lt;/span> &lt;span style="color:#66d9ef">new&lt;/span> FoodSpoiledError(&lt;span style="color:#e6db74">&amp;#39;Potato is spoiled&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#e6db74">&amp;#34;peeled&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> p &lt;span style="color:#f92672">=&lt;/span> Potato(&lt;span style="color:#ae81ff">7&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">try&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> p.peel();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } on FoodSpoiledError &lt;span style="color:#66d9ef">catch&lt;/span>(_) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;no&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">try&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">throw&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;potato&amp;#34;&lt;/span>); &lt;span style="color:#75715e">//Anything can be thrown as an error;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">catch&lt;/span>(_) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;caught potato&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// Exceptions without try catch halt execution
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> p.peel();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="queue">queue&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> q &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">new&lt;/span> Queue.from([&lt;span style="color:#ae81ff">300&lt;/span>, &lt;span style="color:#ae81ff">200&lt;/span>, &lt;span style="color:#ae81ff">100&lt;/span>, &lt;span style="color:#ae81ff">500&lt;/span>]); &lt;span style="color:#75715e">//Optimised for adding items to the head or tail.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//Queues implement Iterable
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> print(q.takewhile(i) &lt;span style="color:#f92672">=&amp;gt;&lt;/span> i &lt;span style="color:#f92672">&amp;gt;&lt;/span> &lt;span style="color:#ae81ff">100&lt;/span>)); &lt;span style="color:#75715e">//prints &amp;#34;{300, 200}&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//Consuming a queue
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">while&lt;/span> (q.first &lt;span style="color:#f92672">&amp;gt;&lt;/span> &lt;span style="color:#ae81ff">100&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> q.removeFirst();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(q); &lt;span style="color:#75715e">//print &amp;#34;{100,500}&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="functions">functions&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>yell(str) &lt;span style="color:#f92672">=&amp;gt;&lt;/span> str.toUpperCase(); &lt;span style="color:#75715e">//Valid function definition
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>List lines(&lt;span style="color:#66d9ef">String&lt;/span> str) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">//^^ Return type
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">return&lt;/span> str.split(&lt;span style="color:#e6db74">&amp;#39;&lt;/span>&lt;span style="color:#ae81ff">\n&lt;/span>&lt;span style="color:#e6db74">&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> poemLines &lt;span style="color:#f92672">=&lt;/span> lines(poem);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(yell(poemLines.first)); &lt;span style="color:#75715e">//POEM
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//Functions are first-class citizens
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">var&lt;/span> whisper &lt;span style="color:#f92672">=&lt;/span> (&lt;span style="color:#66d9ef">String&lt;/span> str) &lt;span style="color:#f92672">=&amp;gt;&lt;/span> str.toLowerCase();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(poemLines.map(whisper).last; &lt;span style="color:#75715e">//poem
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>poem &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#39;poem&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="optional-parameters">optional parameters&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">String&lt;/span> yell(&lt;span style="color:#66d9ef">String&lt;/span> str, [&lt;span style="color:#66d9ef">bool&lt;/span> exclaim &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">false&lt;/span>]) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// ^^^^^^^^^^^ ordered optional parameter 
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">var&lt;/span> result &lt;span style="color:#f92672">=&lt;/span> str.toLowerCase();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (exclaim) result &lt;span style="color:#f92672">=&lt;/span> result &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#e6db74">&amp;#39;!!!&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> result
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">String&lt;/span> whisper (&lt;span style="color:#66d9ef">String&lt;/span> str, {&lt;span style="color:#66d9ef">bool&lt;/span> mysteriously:&lt;span style="color:#66d9ef">false&lt;/span>}) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// ^^^^^^^ named optional parameter
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">var&lt;/span> result &lt;span style="color:#f92672">=&lt;/span> str.toLowerCase();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (mysteriously) result &lt;span style="color:#f92672">=&lt;/span> result &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#e6db74">&amp;#39;....&amp;#39;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> result;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print (yell(&lt;span style="color:#e6db74">&amp;#39;Hello, World&amp;#39;&lt;/span>)); &lt;span style="color:#75715e">// prints &amp;#34;Hello, World&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> print (yell(&lt;span style="color:#e6db74">&amp;#39;Hello, World&amp;#39;&lt;/span>, &lt;span style="color:#66d9ef">true&lt;/span>)); &lt;span style="color:#75715e">// prints &amp;#34;Hello, World!!!&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> print (whisper(&lt;span style="color:#e6db74">&amp;#39;Hello, World&amp;#39;&lt;/span>, mysteriously: &lt;span style="color:#66d9ef">true&lt;/span>));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="lexical-scope">lexical scope&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">//variables declared inside loops will have a new version each time.
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">var&lt;/span> functions &lt;span style="color:#f92672">=&lt;/span> [];
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> (&lt;span style="color:#66d9ef">var&lt;/span> i&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0&lt;/span>; i&lt;span style="color:#f92672">&amp;lt;&lt;/span>&lt;span style="color:#ae81ff">3&lt;/span>; i&lt;span style="color:#f92672">++&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> functions.add(() &lt;span style="color:#f92672">=&amp;gt;&lt;/span> i);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> functions.forEach((fn) &lt;span style="color:#f92672">=&amp;gt;&lt;/span> print(fn())); &lt;span style="color:#75715e">// prints 0\n1\n2\n
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="typedef">typedef&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">typedef&lt;/span> &lt;span style="color:#66d9ef">bool&lt;/span> Validator(&lt;span style="color:#66d9ef">int&lt;/span> n); &lt;span style="color:#75715e">//Definition of a function to be used
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>main(){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Validator validate &lt;span style="color:#f92672">=&lt;/span> (&lt;span style="color:#66d9ef">int&lt;/span> n) &lt;span style="color:#f92672">=&amp;gt;&lt;/span> n&lt;span style="color:#f92672">&amp;gt;&lt;/span>&lt;span style="color:#ae81ff">10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#39;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>both(&lt;span style="color:#ae81ff">5&lt;/span>)&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="unused-variables">unused variables&lt;/h2>
&lt;ul>
&lt;li>use underscore to silence dartanalyzer&lt;/li>
&lt;/ul>
&lt;h2 id="constants">constants&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-dart" data-lang="dart">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">import&lt;/span> &lt;span style="color:#960050;background-color:#1e0010">`&lt;/span>dart&lt;span style="color:#960050;background-color:#1e0010">:&lt;/span>math&lt;span style="color:#960050;background-color:#1e0010">`&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">const&lt;/span> name &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;greg&amp;#34;&lt;/span>; &lt;span style="color:#75715e">//Compile time variable
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">const&lt;/span> Rectangle bounds &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">const&lt;/span> Rectangle (&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#ae81ff">0&lt;/span>,&lt;span style="color:#ae81ff">5&lt;/span>,&lt;span style="color:#ae81ff">5&lt;/span>); &lt;span style="color:#75715e">//Even objects can be declared compile time
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="final">final&lt;/h2>
&lt;p>Final is used when the value is not known at compile time.
The values are immutable&lt;/p></description></item><item><title>docker in action</title><link>https://subygan.com/tech/practice/docker/docker-in-action/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/docker/docker-in-action/</guid><description>&lt;p>Personal notes from &lt;code>Docker in action&lt;/code> book&lt;/p>
&lt;p>Dockers use Linux namespaces and cgroups, which have been part of Linux since 2007. Docker does not provide the container technology but it makes it simpler to use.
The docker containers are isolated with respect to eight aspects.&lt;/p></description></item><item><title>effective go practice</title><link>https://subygan.com/tech/practice/golang/Effective_go/01_intro/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/Effective_go/01_intro/</guid><description>&lt;h2 id="formatting">formatting&lt;/h2>
&lt;p>There is no need to align content or comment &lt;code>go fmt&lt;/code> does that for you.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>go fmt &amp;lt;file_path&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>formats the file that is given&lt;/p></description></item><item><title>learning golang 01 - basics</title><link>https://subygan.com/tech/practice/golang/Go_tour/01_Intro/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/Go_tour/01_Intro/</guid><description>&lt;h2 id="intro">intro&lt;/h2>
&lt;ul>
&lt;li>Every go program is made of packages and &amp;ldquo;main&amp;rdquo; package is run first.&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">package&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#e6db74">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#e6db74">&amp;#34;math/rand&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;My favorite number is&amp;#34;&lt;/span>, &lt;span style="color:#a6e22e">rand&lt;/span>.&lt;span style="color:#a6e22e">Intn&lt;/span>(&lt;span style="color:#ae81ff">10&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In the above program math/rand has a file with the first statement &lt;em>package rand&lt;/em>&lt;/p></description></item><item><title>learning golang 02 - ds and algo</title><link>https://subygan.com/tech/practice/golang/Go_tour/02_Data_structures/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/Go_tour/02_Data_structures/</guid><description>&lt;h1 id="arrays">arrays&lt;/h1>
&lt;p>The type &lt;code>[n]T&lt;/code> creates an array of n values of type T.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">a&lt;/span> [&lt;span style="color:#ae81ff">10&lt;/span>]&lt;span style="color:#66d9ef">int&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">//Creates an array &amp;#39;a&amp;#39; of int type with size 10&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="slices">slices&lt;/h3>
&lt;p>An array has a fixed size. A slice is dynamically-sized
The type &lt;code>[]T&lt;/code> is a slice of elements with type T
Slices require high and low point in the array &lt;code>[low:high]&lt;/code>&lt;/p></description></item><item><title>learning golang 03 - functions</title><link>https://subygan.com/tech/practice/golang/Go_tour/03_Functions_and_pointers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/Go_tour/03_Functions_and_pointers/</guid><description>&lt;h3 id="functions-and-pointers">functions and pointers&lt;/h3>
&lt;p>Functions can receive pointers.
Any change to the pointer would change the value.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go" data-lang="go">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">package&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> &lt;span style="color:#e6db74">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> &lt;span style="color:#a6e22e">change&lt;/span>(&lt;span style="color:#a6e22e">v&lt;/span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#66d9ef">int&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">*&lt;/span>&lt;span style="color:#a6e22e">v&lt;/span> = &lt;span style="color:#ae81ff">10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// ^ required, mentioning that the base value is being changed&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">a&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> &lt;span style="color:#ae81ff">12&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">change&lt;/span>(&lt;span style="color:#f92672">&amp;amp;&lt;/span>&lt;span style="color:#a6e22e">a&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// ^ sending argument as pointer. Throws an error if not.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">a&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="function-closures">function closures&lt;/h3>
&lt;p>A function closure references variable from outside the function. Each closure is left to its own values&lt;/p></description></item><item><title>learning golang 04 - goroutine</title><link>https://subygan.com/tech/practice/golang/Go_tour/04_goroutines/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/Go_tour/04_goroutines/</guid><description>&lt;h2 id="goroutines">goroutines&lt;/h2>
&lt;p>Goroutine is a lightweight thread managed by the Go runtime.
a &amp;ldquo;thread&amp;rdquo; does not mean virtual thread or even multiple thread. it is like async await. meaning there is one main thread and multiple seperate &amp;ldquo;threads&amp;rdquo; spawned which are technically running in the same thread instead of spawning one for every process. Each of these threads are blocked when a blocking process is run. and repicked when it is done.&lt;/p></description></item><item><title>learning golang using go by example</title><link>https://subygan.com/tech/practice/golang/GO_BY_EXAMPLE/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://subygan.com/tech/practice/golang/GO_BY_EXAMPLE/</guid><description>&lt;h1 id="go-by-example">go by example.&lt;/h1>
&lt;p>Following eli bendersky&amp;rsquo;s gobyexample.com tutorial the idea is to capture only things that were not clear in the go tour.&lt;/p></description></item></channel></rss>