<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bobby Yang on Medium]]></title>
        <description><![CDATA[Stories by Bobby Yang on Medium]]></description>
        <link>https://medium.com/@glyif?source=rss-930e5517152e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x8QgRHJRLJPAgl1imPiHbg@2x.jpeg</url>
            <title>Stories by Bobby Yang on Medium</title>
            <link>https://medium.com/@glyif?source=rss-930e5517152e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:41:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@glyif/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[/proc]]></title>
            <link>https://medium.com/@glyif/proc-20e00458f4a?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/20e00458f4a</guid>
            <category><![CDATA[linux-kernel]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Mon, 18 Jun 2018 05:25:09 GMT</pubDate>
            <atom:updated>2018-06-18T14:39:31.326Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Preface:</strong></p><p>The /proc filesystem is an in-memory file system that is created by the kernel of most unix-like operating systems. This means the “files” are just virtual memory that’s mapped to a folder, usually the /proc directory. When you open and try to read one of these files, because the files aren’t really there, they are created as you open them by the kernel.</p><p>After doing a quick ls /proc and ps aux, you can see that the processes listed in the process list have directories in the /proc folder. You can also see files likecpuinfo and meminfo along with plenty of other important looking files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ylFV1UG_Pe4ngbE13FEhQ.png" /><figcaption>ps aus (left) and ls /proc (right)</figcaption></figure><p>Each of the process directories contains “files” and other “folders” that contain info about the process. In a nut shell, the /proc folder contains basically all the details about everything that’s happening on a unix machine.</p><p>In this blog post, I’m going to be focusing mostly on the /proc/{pid}/maps file and the /proc/{pid}/mem file. With these two files, you can easily find, access, and sometimes even change the heap of currently running programs.</p><p>For this post, I’ll be using a C program that dynamically allocates a string and then prints the string on a loop. And with the maps file and the mem file, be able to modify the dynamically allocated string (in the heap) as it is still running.</p><p>Quick refresher. The stack memory is allocated on compilation so when program runs, all of the variables stored in the stack are already there and just needs to be accessed. The heap, on the other hand, is allocated on runtime and is where all of the dynamically allocated variables are.</p><p>Simple example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*MgZS6H_A6p3vZFQw-4a5xg.png" /><figcaption>stack variables vs heap variables</figcaption></figure><p><strong>/proc/{pid}/maps</strong></p><p>The maps file shows the contents of pid’s memory mapped out the same way it is in the actual process. However, this file can’t just be “opened”, even if looks like you have permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*f-frm3J7vNAiQX5hLbkeVg.png" /><figcaption>maps file and 0 size</figcaption></figure><p>annnndddddddd it’s a 0 size file? Well, once again, due to the nature of virtual files, they don’t have a predefined size and content. It’s generated as you read it, so there can’t be a size.</p><p>But if you try to vim or cat the file, you’ll probably see something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsQ9UUikN_W9GtxBCuG8vQ.png" /><figcaption>maps file</figcaption></figure><p>The screenshot was pretty big so I cut it down to the important part. Like mentioned before, the maps file maps out the memory of the process. So we can tell that the heap is located from memory address 0x00c37000 to 0x00c5800 .</p><p>With this knowledge, we can then go on to actually read the heap of the process and modify it.</p><p><strong>/proc/{pid}/mem</strong></p><p>This file contains the process memory, and with the memory location of the process’s heap, you can read the memory of the process by getting the offset, and read from the start address to the end address (0x00c37000 to 0x00c5800) .</p><p>Here’s a super simple python script example that shows how to do this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*88XKc7ukypaBHpEm-dWhig.png" /></figure><p>Basically, what the program does is take a pid that is passed in as a command line argument and opens the corresponding maps file and mem file. Then goes to read the maps file until it finds the line where the heap memory where tells us the start and end of the heap. Then you seek to that memory address in the mem file and read from the offset the number of end — start bytes.</p><p>You can also modify the heap as well if you want by using write . Just like writing to any other file.</p><p>Quick recap.</p><ol><li>The /proc filesystem isn’t a real, physical file system. It’s just a part of the virtual memory that’s mapped and mounted to psuedo-files in (normally) /proc directory.</li><li>The /proc directory contains many files about the kernel itself along with information about processes that are running.</li><li>The maps file is a file that maps the memory locations that a process is using. (you can use that file to directly read parts of memory the process is using by starting from the offset and reading to the end of that part of memory)</li><li>The mem file is a file that contains the process memory. You can use the memory address locations in the maps file to read what’s stored there in this file.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20e00458f4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Age old tech interview question, “what happens when you type …..”]]></title>
            <link>https://medium.com/@glyif/age-old-tech-interview-question-what-happens-when-you-type-45be5df30469?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/45be5df30469</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Tue, 08 Aug 2017 17:21:59 GMT</pubDate>
            <atom:updated>2017-08-08T17:21:59.770Z</atom:updated>
            <content:encoded><![CDATA[<p>I remember my first official tech interview at a design firm, the Tech Lead asked me, “What happens when you type google.com?”</p><p>My answer…. was well….. inadequate to say the least. Now, nearly 3 years later, I can answer the question a little better :)</p><p>In my example, instead of using google.com, i’ll use holbertonschool.com</p><p>Quick sales pitch lol, Holberton School is a 2-year college replacement program to learn software engineering. Unlike a bootcamp, Holberton goes very deep into CS fundamentals.</p><p>Back to the topic at hand.</p><p>To make this topic easier to understand, I’m breaking it down to two parts.</p><h3>One: How does the browser know where to requests a site from</h3><p>This is quite a fundamental question. A server, is basically a number. An IP address. So when holbertonschool.com is requested, the browser can’t just look for a server named holbertonschool.com, it needs to know the IP address of the server.</p><p>Step 1:</p><p>The browser checks to see if the domain is stored in the browser’s cache.</p><p>Possible Step 2:</p><p>If not in the browser’s cache, the resolver checks the hosts file to see if there is any mention.</p><p>Possible Step 3:</p><p>If the resolver does not find it in the hosts file, the resolver then goes on a journey to find the IP.</p><p>Resolver’s Journey</p><ul><li>Resolver asks the nearest root server, if the root does not have it in cache, it gives the resolver the TLD server</li><li>Resolver asks the TLD server</li><li>If the TLD server does not know the IP, it gives the resolver the name servers</li><li>Resolver asks the domain registrar to validate the name servers</li><li>Name Server gives the IP of the server</li><li>Finally, the resolver gives the IP to the browser</li><li>The browser caches the IP with the domain name</li></ul><h3>Two: Requesting, retrieving, displaying the site</h3><p><strong>HTTP/HTTPS request</strong></p><p>Now that the browser knows where to request information from, the browser sends either a HTTP or HTTPS request to the IP.</p><p>If the browser sends an HTTPS request, an encryption process is done, where the browser initiates a TCP handshake and requests the SSL certificate from the server. The server accepts the handshake and responds with the certificate. The browser checks the certificate to see if it’s issued from a known issuer. If so the browser and the server negotiate a encryption key. If successful, all data going between the browser through TCP/IP is now encrypted.</p><p><strong>Load Balancer</strong></p><p>Normally, a site will have a load balancer, and the servers is setup so that they can only be accessed through the load balancer and not individually.</p><p>This way if a server goes down, there’s a backup. But to further combat the Single Point of Failure, sometimes there are multiple load balancers that communicate with each other. So if one load balancer goes down, the others can take more of the load.</p><p>For additional security, most times the load balancers themselves will have a firewall that can filter out flagged or malicious traffic so bad requests don’t even make it to the actual servers that are running the web services.</p><p><strong>Web Server</strong></p><p>Now that the load balancer has selected a server to use for the request, the web server on the physical server/container/vm/cloud/etc takes the HTTP/HTTPS request.</p><p>Depending on what kind of information is requested, the web server can either serve static html content or dynamic content through the application server</p><p><strong>Application Server</strong></p><p>The application server is a used for dynamic content and is where backend logic comes in with languages like Python, Golang, Ruby, Javascript, etc. The Application server, if needed, the application server send queries to the database.</p><p>The content is then served through TCP/IP either encrypted (HTTPS) or unencrypted (HTTP) to the browser.</p><p>That’s the high level overview of what happens when you type in a URL in your browser.</p><p>This all happens within milliseconds. Pretty neat huh?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45be5df30469" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[no more twix bars]]></title>
            <link>https://medium.com/@glyif/no-more-twix-bars-3c198ddf8b14?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c198ddf8b14</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[idp]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Thu, 15 Jun 2017 21:05:26 GMT</pubDate>
            <atom:updated>2017-06-15T21:05:26.904Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*wES2wqgC7K-1BTodF75qQQ.png" /><figcaption>do your homework</figcaption></figure><p>There are 32768 twix bars.</p><p>You eat 32768 twix bars.</p><p>You’re left with 0 twix bars.</p><p>You can’t do anything with 0 twix bars.</p><h3>PIDs</h3><p>PID is the process identification number of a process running on a linux based operating system, like Ubuntu.</p><p>Every process that that runs gets assigned a PID from the linux operating system. You can see them in the /proc folder of your linux system.</p><p>All of the numerically named directories correspond with an actual process ID. You can do a simple search the the ps command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fOX2mpZHGOucVAvO8qHGJw.png" /><figcaption>ps of PID 1 (init)</figcaption></figure><p>In a linux system the default max number of PIDs is 32768. You can see what it is on your system by reading/proc/sys/kernel/pid_max . This is a number that you can change.</p><p>If you want to try it you can edit the maximum PID limit to up to 4 million.</p><p>This number is an arbitrary number that can be found in the Linux source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*At0cU4p3WrkYPYBxJn_GJg.png" /></figure><p>Also in the Linux you can see how PIDs are assigned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*zbc4zZXOa58zwpexyPaHyQ.png" /></figure><p>And RESERVED_PIDS is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*p3mpzytve_S6psgtb7BioQ.png" /></figure><p>So PIDs are assigned incrementally by 1 then if the value of the PID is greater than or equal to the max pid, it then resets to 300.</p><p>So what happens if all of your PIDs are simultaneously being used? We’ll that’s what a fork bomb does.</p><h3>:(){ :|:&amp; };:</h3><pre>:<strong>()</strong>      <em># define a function called &#39;:&#39;</em><br><strong>{</strong>        <em># declaring the function called &#39;:&#39;</em><br>    :    <em># a recursive call on itself</em><br>    <strong>|</strong>    <em># pipe the output into</em><br>    :    <em># another recursive call on itself</em><br>         <em># when called, 2 more of itself is created</em><br>    <strong>&amp;</strong>    <em># disown or put the process in the background</em><br><strong>}</strong>        <em># end of the function called &#39;:&#39;</em><br>;        <em># semicolon to end</em><br>:        <em># call the function &#39;:&#39; which will recursively call itself and create 2 more of itself</em></pre><p>A fork bomb creates a large number of processes exponentially fast to fill up all of the available PIDs. If all of the PIDs are being used and not killed because of the &amp; in the forkbomb, no new programs and processes can start.</p><p>Not only does a fork bomb use up PIDs, all of the child processes also use more processor time and memory. So at the end of the day, the fork bomb leaves your computer unable to start new programs and makes your programs that are already running unbearably slow to use.</p><p>There are 32768 PIDs.</p><p>A fork bomb uses up 32768 PIDs.</p><p>There are 0 PIDs left.</p><p>You can’t do anything because you have 0 PIDs left.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c198ddf8b14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: the thing good Objects come in]]></title>
            <link>https://medium.com/@glyif/python-the-thing-good-objects-come-in-a59d37402928?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a59d37402928</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[twix-bars]]></category>
            <category><![CDATA[holberton-school]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Thu, 25 May 2017 02:15:15 GMT</pubDate>
            <atom:updated>2017-05-25T04:46:11.518Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9mgywBZkt86Zm10zgL-Zkg.png" /><figcaption>twix bar class with two instances</figcaption></figure><p>Object-Oriented programming is a programming paradigm that revolves round these things called “Objects” which are just data blocks that contain, twix bars. I mean data. For sure data.</p><h3>Python….</h3><p>Python is at it’s core, an object-oriented programming language. There are different implementations of Python, but I’ll be referencing the popular C implementation, <a href="https://github.com/python/cpython">CPython</a>. More specifically, v3.4.</p><p>In Python, all object types inherit from one master object, declared as PyObject . This master object has all of the information Python needs to process a pointer to an object as an actual object.</p><h3><strong>PyObject</strong></h3><p>Let’s take a look at the CPython implementation of the PyObject struct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*euX4cP5btUhllUCYWuMzLg.png" /><figcaption>PyObject declaration</figcaption></figure><p><strong>Breakdown:</strong></p><pre><strong>_PyObject_HEAD_EXTRA :</strong><br>    - This is a macro for a doubly linked list pointing to a next<br>      _object and a _prev object<br>    - According to the documentation, these two field are only<br>      present when the macro Py_TRACE_REFS is defined</pre><pre><strong>Py__ssize_t ob_refcnt :<br>    </strong>- references count of the object, initialized to 1</pre><pre><strong>struct _typeobject *ob_typeob_type :<br>    </strong>- The type&#39;s type. Or as the python documentation put&#39;s it, a<br>      metatype.</pre><h3>ob_refcnt, id(), and type()</h3><p>To get the reference count of an object, we can use the built in id() function which returns the memory address of the value. Then we can use the ctype library to get the ob_refcnt value of an object.</p><p>The id() function gets the memory address of the value, but as seen it is not the memory address in hex form but a Python Long object. That’s what the PyLong_FromVoidPtr() does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8P7AzuwDGDXfduXFnNBkVA.png" /></figure><p>Here’s an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*Eo4XTBhtlybJxvPedzKixA.png" /></figure><p><strong>Breakdown</strong></p><pre>import ctypes :<br>    - this import is to be able to to use the c_long.from_address<br>      function which retrieves a number from an address</pre><pre>twix_count :<br>    - a variable set to entice Julien</pre><pre>twix_address :<br>    - a variable to store the id of the enticing twix_count var</pre><pre>hex(twix_address) :<br>    - when converted to hex, you can see the address of the object</pre><pre>ob_refcnt = ctypes.c_long.from_address(twix_address)<br>    - this uses the function mentioned above</pre><p>The return value, as you can see, is one. Because as mentioned previously, the ob_refcnt is initialized to 1.</p><p>Let’s now reference another variable to twix_count .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*auuRuUUj_OujQBOcFBbpbw.png" /></figure><p>As you can see, after assigning another variable to twix_count the ob_refcnt of the object incremented to 2.</p><p>Note:</p><p>The type() function. Like id() types is a built in function that checks the ob_type of a PyObject struct to determine the type of an object.</p><blockquote>This brings up a very interesting question with variable assignment.</blockquote><h3>Referencing</h3><p>When I first started my twix_count demo, I used a smaller number. The number 10 to be precise. But there was some “odd behavior” with retrieving the ob_refcnt .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*UFRuKGxYAXQN5pkrKHizHA.png" /></figure><p>Why would the ob_refcnt count be 15? I restarted the python3 interpreter and restarted my computer but still, the number was 15.</p><p>After doing some research on the interwebs, I found that python3 keeps an array of integer objects in the range of and including -5 to 256 . So when you assign a variable to any number in that range, you are actually just referencing the existing object.</p><h3>Immutable Data Types</h3><p>An immutable data type is an object that cannot be manipulated, such as an int , float , string , tuple , just to name a few. You can see a full list of immutable data types at this <a href="https://docs.python.org/3.4/reference/datamodel.html">link</a>.</p><p>If you pass an <em>immutable</em> object to a function or method, you are not able to mutate the object. Furthermore, you are also not allowed to rebind the outside reference.</p><p>There’s an example</p><pre>def twix_ownership_change(person):<br>    person = &#39;Ju&#39;<br>    print(&#39;{:s} tries to take the twix&#39;.format(person))</pre><pre>twix_owner = &quot;Bobby&quot;</pre><pre>print(&quot;Currently: This twix belongs to {:s}&quot;.format(twix_owner))<br>twix_ownership_change(twix_owner)<br>print(&#39;Now, This twix still belongs to {:s}&#39;.format(twix_owner))</pre><p>The output should be:</p><pre>Currently: This twix belongs to Bobby<br>Ju tries to take the twix<br>Now, This twix still belongs to Bobby</pre><p>Because a string is an immutable object, although the string was change within the scope of the function twix_ownership_change() , it was not affected on the outside.</p><h3><strong>Mutable Data Types</strong></h3><p>A mutable data types is an object that can be manipulated, such as a list , dictionary, set , just to name a few. Once again, you can see a full list of immutable data types at the same <a href="https://docs.python.org/3.4/reference/datamodel.html">link</a> above.</p><p>If you pass a <em>mutable</em> object into a function or method, because of the way arguments are passed in, the function receives a reference to the same object . Because of the function is referencing the same object, you are able to mutate the same object within the function. However, if you reassign or rebind the reference inside of your function, the outside reference will still be pointing at the original reference.</p><p>Here’s an example:</p><pre>def twix_ownership_change(ownership_list):<br>    ownership_list.append(&#39;Bobby&#39;)<br>    print(ownership_list)</pre><pre>outside_ownership_list = [&quot;The&quot;, &quot;twix&quot;, &quot;belongs&quot;, &quot;to&quot;]</pre><pre>print(outside_ownership_list)<br>twix_ownership_change(outside_ownership_list)<br>print(outside_ownership_list)</pre><p>The output should be:</p><pre>[&#39;The&#39;, &#39;twix&#39;, &#39;belongs&#39;, &#39;to&#39;]<br>[&#39;The&#39;, &#39;twix&#39;, &#39;belongs&#39;, &#39;to&#39;, &#39;Bobby&#39;]<br>[&#39;The&#39;, &#39;twix&#39;, &#39;belongs&#39;, &#39;to&#39;, &#39;Bobby&#39;]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a59d37402928" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Libraries in C]]></title>
            <link>https://medium.com/@glyif/libraries-in-c-1759273ab000?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1759273ab000</guid>
            <category><![CDATA[c-program]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Mon, 15 May 2017 01:31:28 GMT</pubDate>
            <atom:updated>2017-05-15T16:12:20.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*99C9Q9tr1g8GvbK8ju_MCA.jpeg" /><figcaption>twix library</figcaption></figure><p>To put it simply, a C library is a set of defined functions like printf().</p><p>printf is defined in the library &lt;stdio.h&gt; which is the standard C library with many useful functions.</p><p>There are two types of C libraries:</p><p><strong>Static Libraries</strong></p><p><em>Static Libraries</em> have been implemented since the being of C. It’s basically an archive of of object files with an index of all the contents.</p><p>Functions in a static library are combined in a program by a static linker during compilation time to make an executable program. This program includes all of the object code in the library so the program is completely self-sufficient.</p><p>Here are some key points about static libraries.</p><ol><li>The actual code used in the library is copied during the compilation process and added into the actual code.</li><li>Because the code is copied during compilation, there are no dependencies during run time, therefore the executable is self sufficient.</li><li>With static libraries, you don’t have to worry about library versioning on across platforms. So it’s more portable and easier to distribute.</li></ol><p>An advantage of Static libraries is it’s speed over dynamic libraries. During runtime, there will be no need for dynamic querying of symbols.</p><p><strong>Dynamic/Shared Libraries</strong></p><p>Similar to static libraries, the dynamic library is also just a collection functions with and index. The difference is, instead of being combined with the program at build time or compilation, they aren’t accessed until run time.</p><p>Like mentioned above, dynamic libraries are accessed during run time. When a program using a dynamic library runs, the run time linker goes through and finds all of the referenced libraries and the address of the functions inside the libraries.</p><p>Here are some key points about dynamic libraries:</p><ol><li>Dynamic linking does not copy code from the library.</li><li>The linking happens in runtime.</li></ol><p><strong>Creating Static Libraries (Linux)</strong></p><p>Because a static library is just basically an archive of function object files, that’s what were going to create.</p><p>Let’s say we have a C file that has all of the functions we want want the library.</p><p>Let’s called it twix_bar.c .</p><p>First we need to compile the c file into object files.</p><pre>gcc <a href="http://www.adp-gmbh.ch/cpp/gcc/gcc_options.html#opt_c">-c</a> twix_bar.c <a href="http://www.adp-gmbh.ch/cpp/gcc/gcc_options.html#opt_o">-o</a> twix_bar.o</pre><p>The -c flag tells gcc not to link anything and the -o specifies the name of the output file.</p><p>After that, we just need to “archive it”. We can use the program ar .</p><pre><a href="http://www.adp-gmbh.ch/cpp/gcc/ar.html">ar</a> rcs julien.a twix_bar.o</pre><p>This creates a static library called julien.a from a object file called twix_bar.o . Keep in mind, static library files need to end with a .a</p><p><strong>Creating Dynamic Libraries (Linux)</strong></p><p>Creating a Dynamic library is similar to creating a static library, but with a few extra steps.</p><p>We start the same with compiling the library into an object file, but we give gcc the -fpic flag.</p><p>This flag tells gcc to create position independent code which is needed for dynamic libraries.</p><pre>gcc <a href="http://www.adp-gmbh.ch/cpp/gcc/gcc_options.html#opt_c">-c</a> <a href="http://www.adp-gmbh.ch/cpp/gcc/gcc_options.html#opt_f_cap_pic">-fPIC</a> twix_bar.c -o twix_bar.o</pre><p>Now we’ll need to create the library from the object file.</p><pre>gcc -shared -o julien.so twix_bar.o</pre><p>Now to link the library, we’ll need to add an extra flag when we compile the main program</p><pre>gcc -Wall -o test main.c -ljulien</pre><p>At this point, if you try to run your code now, linux should give you an error like:</p><pre>error while loading shared libraries: julien.so: cannot open shared object file: No such file or directory</pre><p>We’ll need to make the library available during runtime.</p><p>To do this we need to add it to the LD_LIBRARY_PATH .</p><p>Now we’ll need to export the env variable.</p><pre>export LD_LIBRARY_PATH=/home/glyif/twix_bar_project:$LD_LIBRARY_PATH</pre><p>The path is the path to the folder that contains the dynamic library file.</p><p>There you have it, a dynamic library.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1759273ab000" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ramen — “to die for”]]></title>
            <link>https://medium.com/@glyif/theres-no-better-way-to-end-a-weekend-than-eating-a-good-bowl-of-ramen-9b2a01e68d4e?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b2a01e68d4e</guid>
            <category><![CDATA[ramen]]></category>
            <category><![CDATA[friendship]]></category>
            <category><![CDATA[japan]]></category>
            <category><![CDATA[food]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Mon, 06 Mar 2017 04:41:53 GMT</pubDate>
            <atom:updated>2017-03-06T04:42:37.092Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s no better way to end a weekend than eating a good bowl of ramen. With my ramen attempt failing on Saturday because of the rain, I was determined to accomplish my mission. I set my eyes on Mensho Ramen.</p><p><strong>Nothing will get into my way. NOTHING!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqCJDzI86UZeCkWQfOLwPg@2x.jpeg" /></figure><p>Except for a huge ass line.</p><p>Here I am, standing alone in my t-shirt and shorts in 47 degree San Francisco weather, waiting in line while my “friends” are in the warm and welcoming car.</p><p>So what do I do?</p><p>I do what any young, lonely techie does. I whip out my phone.</p><p>To my “plethora” of apps….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*_4l-dh7P5L8ZVGpxcbPvzw@2x.png" /></figure><p>So let’s analyze the situation again. Let’s do a pros and cons chart.</p><p><strong><em>Cons</em></strong></p><p>47 degrees.</p><p>T shirt and shorts</p><p>Long ass line</p><p>No real entertainment</p><p>Lame ass friends</p><p><strong><em>Pros</em></strong></p><p>The promise of a bowl of flavorful and steaming hot ramen with two pieces of perfectly braised pork belly</p><p>A preschooler could do the math that the cons outweigh the pros.</p><p>However, I’m stubborn and stupid. So I stayed. With my friends basically begging me to leave, I WANTED THAT FUCKING BOWL OF RAMEN.</p><p>To pass the time I wrote this Medium article, because I had nothing else better to do. Here I am, 30 min later.</p><p>Another State of the Ramen pic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4hvgeho8QpUuTDItL-P4Q@2x.jpeg" /></figure><p><strong>So close!!!!</strong></p><p>I can do it!</p><p>It’s all worth it!!!</p><p><strong>10 more min! 10 MORE!!!</strong></p><p>I’m not sure if I can make it. I’m starting to feel weak. Starting to be a drama queen.</p><p>I’m here. The front of the line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXIGBt6CI4mSoqpVzn9FwQ@2x.jpeg" /></figure><p>My friends still in the car.</p><p>Should I tell them I’m at the front of the line? Or should I just go in myself and eat and just screw them…..</p><p>As I’m thinking that, one friend calls me.</p><p>The conversation goes like this.</p><p><em>Me</em>: I’m at the front of the line.</p><p><em>Friend</em>: Order for us</p><p><em>Me</em>: Nope you guys did nothing to deserve that.</p><p><em>Friend</em>: Ok, we coming.</p><p>Another State of the Ramen picture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-e8_Ez8E9ixfHMsnmQqs8Q@2x.jpeg" /></figure><p>Line behind me. I’d like the think it’s longer than before.</p><p>47 min waiting in the cold by myself and here we are. In the front of the line. Ready to get my bowl of noodles, when the waitress comes out and announces they ran out of broth….</p><p>PSYCH!</p><p>We got in fine. And soon we will be enjoying our noodles</p><p>Anticlimactic, I know…. But again. This is just a distraction from the cold.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b2a01e68d4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nightmare of Operations]]></title>
            <link>https://medium.com/hackernoon/nightmare-of-operations-708dd0a67dc6?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/708dd0a67dc6</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Sun, 05 Mar 2017 20:45:03 GMT</pubDate>
            <atom:updated>2019-05-25T07:21:54.414Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*x5tXU8XusmO2DRrsUTF5gw.jpeg" /><figcaption>Choose wisely or you’ll have an extra blog post assignment</figcaption></figure><p>I open my eyes. It’s <a href="https://hackernoon.com/tagged/pitch-black">pitch black</a>. Panic sets as I prepare for the worst. I scream out for help but mid-scream a <a href="https://hackernoon.com/tagged/spotlight">spotlight</a> shines in to my eyes, temporarily blinding me. Instinctively, I raise my arm up to my face to block the light. As my eyes start to adjust to the light, I see the silhouette of a doll.</p><p>A few seconds go by, and the doll turns it’s head towards me and said in a french accent:</p><blockquote><em>“ I want to play ze game... Iz i = i++ ze same aaaz i++? ”</em></blockquote><p>Being a 1 month old software engineering student, I think back to all of my experience to try to answer the question.</p><p>That’s it, I lost.</p><p>I jolt up from my bed, with my phone alarm ringing in my ears. I swipe right turn off my alarm. Fully awake, I look up at the ceiling and recuperate my thoughts about my dream.</p><p>Does i = i++ increment i then assigns the value to i ?</p><p>Something about the problem intrigued to dive deeper. So I leaped out of bed to my computer to get to the bottom of this enigma.</p><p>I put on some <a href="https://www.youtube.com/watch?v=9DwzBICPhdM">KPOP</a> and started to write a simple test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*_klLEF6-V_uU_SlxXRBZaA.png" /><figcaption>pretty self explanatory</figcaption></figure><p>My heart jumped a beat when the program ran.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/26/1*xxruBOTY4A0-VaPZ_uE1fQ.png" /><figcaption>i done messed up</figcaption></figure><p>Shit, you done messed up A-aron.</p><p>I had some time before I had to leave to go to school, so I decided to actually go even deeper and take a look at what exactly is going on in Assembly.</p><p>I opened up the test program executable with gdb and set a breakpoint at main so the program would run until main returns then stop.</p><p>(gdb) break main</p><p>Then I ran the program with this new breakpoint.</p><p>(gdb) run</p><p>Finally, I wanted to see the assembly instructions for the current function (main) so I used the disassemble command.</p><p>(gdb) disassemble</p><p>That gave me this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*8PI4n8R7bNQ0oSOsM3nERA.png" /><figcaption>assembly for test program</figcaption></figure><p>Quick Assembly lesson.</p><p>Immediate values are constants and prefixed by a $ . Like $0xa is the decimal 10 in hexadecimal. Register names are prefixed a % .</p><p>Registers are small memory spaces in the processor of a computer that hold a single value. There are two types of registers: general registers and special registers. In our code sample, %eax , %edx , %esi and %edi are general registers, while %rbp and %rsp are special registers.</p><p>The first two lines are called the function preamble. This pushes the old base pointer onto the stack to save for later. Then it copies the value of the stack pointer to the base pointer. So after first two lines, %rbp will point to the base of main’s stack frame.</p><p>Skipping down a few lines, we can see that the value $0xa which is 10 in hexadecimal gets copied into -0x4(%rbp)using the movl instruction. movl is the same as the mov command but the l signifies that the operands will be a long. -0x4(%rbp) is the same as %rbp + -0x4 and because the stack grows downwards, subtracting 4 from the base of the current stack frame actually accesses the current frame itself. Thats were the local variable i is stored. So $0xa is being copied into the local variable i .</p><p>The next line is where it gets interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*yt4MqHTXjwvbdLmSjLirNg.png" /></figure><p>The lea instruction is sort of like the mov instruction. mov , using syntax like mov &lt;destination&gt;, &lt;source&gt; , moves the contents from the source to the destination.</p><p>lea , however, moves the address of the source to the destination. It calculates the address specified by its second operand as if it were going to load or store data from it, but instead it stores the calculated address into the register specified by its first operand.</p><p>So the above instruction means %edx = %rax + 1 .</p><p>Then on the next line we see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*TrMwsXaDFjm00NGx39lrqg.png" /></figure><p>This moves the contents of -0x4(%rbp) which is the local variable i that has the value $0xa into %edx . So this operation is stored in a another temporary register, not the original register. So the increment was done, just in another temporary register.</p><p>Then I compared that to the second test of i++ .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*lpmHxyXdXCvRfHKK56Os1Q.png" /></figure><p>This added $0x1 to i .</p><p>This explains why i = i++ returns i instead of i + 1 .</p><p>So the crux of the problem is a problem of evaluation order.</p><p>So when i = i++ is compiled:</p><ol><li>the value of i gets copied to a temporary location</li><li>The temporary value is incremented and saved as a new value (not overwriting)</li><li>The new value is stored in i</li><li>Then ireturns the temporary value, which is the same as the original value</li></ol><p>Having found the answer, I packed my things and got ready to go to school.</p><p>I arrived at school just in time for our Peer Learning Day.</p><p>I listened and participated as my peers started going over assignments from the previous week. Then out of nowhere I heard the question with the same french accent:</p><h3>Iz i = i++ ze same aaaz i++?</h3><figure><a href="http://bit.ly/HackernoonFB"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hqOaABQ7XGPT-OYNgiUBg.png" /></a></figure><figure><a href="https://goo.gl/k7XYbx"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vgw1jkA6hgnvwzTsfMlnpg.png" /></a></figure><figure><a href="https://goo.gl/4ofytp"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gKBpq1ruUi0FVK2UM_I4tQ.png" /></a></figure><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a> family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp; sponsorship</a> opportunities.</blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*35tCjoPcvq6LbB3I6Wegqw.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708dd0a67dc6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/nightmare-of-operations-708dd0a67dc6">Nightmare of Operations</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[gcc]]></title>
            <link>https://medium.com/@glyif/gcc-41acb1e690af?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/41acb1e690af</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Thu, 09 Feb 2017 02:19:34 GMT</pubDate>
            <atom:updated>2017-02-09T02:19:34.885Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*J-1MC3QGbIuwq4tb-yr-iA.png" /></figure><p>gcc is short for GNU Compiler Collection. It’s called a collection because it’s literally a collection different compilers for C, C++, Objective-C, Fortran, Java, and Ada.</p><p>What we don’t see when we just run gcc is that it actually goes through 4 steps.</p><h3><strong>Step 1:</strong></h3><p><strong>Preprocessing</strong></p><p>Here the preprocessor:</p><ul><li>Takes all of the /*comments*/ and removes them</li><li>Takes any files that you #include -ed and concatenates it to the program</li><li>#define s all of the macros</li></ul><p>gcc has an option that only preprocesses a C program without doing the other steps.</p><p>The command looks something like this:</p><p>gcc -E -o [output_file] [input_file]</p><p>Done right, the output_file should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*7sQGVN12eECNHksmsKNdKQ.png" /><figcaption>first part of the preprocessed code.</figcaption></figure><p>Now this code is ready to be compiled.</p><h3><strong>Step 2:</strong></h3><p><strong>Compiling</strong></p><p>This step is the preprocessed code gets compiled into Assembly code.</p><p>You to view what your c code looks like in Assembly, you can run the following:</p><p>gcc -S main.c</p><p>This spits out a file called main.s that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpNv2psaWX3KkNV1u5MY5w.png" /></figure><h3><strong>Step 3:</strong></h3><p><strong>Assembling</strong></p><p>Because currently computer’s don’t understand anything but 1s and 0s, the Assembly code will need to be made into code the computer will understand</p><p>You can see what your c code looks like after you run it through the assembler by using the following command:</p><p>gcc -c main.c</p><p>The result should be illegible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaeiIfY3v4fFaLoS-qSK7g.png" /></figure><h3><strong>Step 4:</strong></h3><p><strong>Linking</strong></p><p>This is the final step of compiling a c program. This step takes all of the machine code and libraries you used and puts it through a linker that makes a single executable file that you can run.</p><p>gcc has made it very simple for us to compile our c code into an executable but because every step is separate and modular, we’re able to use gcc to see what our code looks like in the different steps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41acb1e690af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linking]]></title>
            <link>https://medium.com/@glyif/linking-7ac9ca3c279?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ac9ca3c279</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Tue, 07 Feb 2017 03:21:59 GMT</pubDate>
            <atom:updated>2017-02-07T03:21:59.064Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s a bit of confusion sometimes around the difference between a hard link and a symbolic link. This post is to clear some of that confusion up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*0B1b6BVrfu2HmvNgZd_r0Q.jpeg" /></figure><p>Let’s start with some definitions…</p><p>A symbolic link is a link to another name on the file system.</p><p>A hard link is a directory entry that associates a name with a file on a file system.</p><p>You see the difference?</p><p>I don’t…</p><p>Let’s rephrase it a bit.</p><p>Every file is linked to an inode.</p><p>A hard link creates a file that points to the same inode as the original file.</p><p>A symbolic link creates a file that is basically an alias of the original file.</p><p>So if you have a hard link and you remove the original file, your link will still be pointing to the inode which means if you open the link, you still see the contents of the file. However, if you remove the original file a symbolic link is linked to, the symbolic link will no longer be functional.</p><p>Let’s see it in action.</p><p>First, let’s make a couple of files. I made a file named food with the word“pizza” in it and a file named nonfood with the word “computer” in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*ZM38WnlKcOevQgmK2THLSw.png" /><figcaption>two things in the world, food items and nonfood items</figcaption></figure><p>Then, let’s make a hard link for food and a symbolic link for nonfood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*uXGBaWGVTitQLjNSpx_pzw.png" /><figcaption>hard link</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*725WLeVK-AkMw5wwXnY3hQ.png" /><figcaption>soft link</figcaption></figure><p>Now, lets to a ls -l to see what our directory looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IA5zSnQvWv5lPA4M5i1Paw.png" /><figcaption>ls -l</figcaption></figure><p>Just to be sure, lets just peek at the contents of the hard link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*zKyzidhWL6eo5V2vohbpWA.png" /></figure><p>Then let’s mess with the hard link by removed the original file: food.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*mnPyiU65Z5L1q9eon7p3yA.png" /></figure><p>As you can see, the file created by the hard link still has the same content as before, because it’s not pointing to the file but the actual inode that the file is referencing.</p><p>Now let’s move onto the symbolic link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*W3BxpgV70KTy7xUVn9CRrg.png" /></figure><p>As you see, if we remove the file the symbolic link is referencing the link becomes invalid.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ac9ca3c279" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lsing]]></title>
            <link>https://medium.com/@glyif/lsing-36c24b4ccfd3?source=rss-930e5517152e------2</link>
            <guid isPermaLink="false">https://medium.com/p/36c24b4ccfd3</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[holberton-school]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[command-line]]></category>
            <dc:creator><![CDATA[Bobby Yang]]></dc:creator>
            <pubDate>Mon, 06 Feb 2017 23:10:17 GMT</pubDate>
            <atom:updated>2017-02-06T23:11:26.597Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*YbAmYKWldNVu4GcD1_cUyg.png" /></figure><p>ls pronounced el-ess is one of the most commonly used unix commands.</p><p>A lot of the time I use ls as a filler command when my fingers are moving faster than my brain.</p><p>Oh, what was that one command again… uhhhhhh let me think…. *types ls while thinking*</p><p>Of course, that’s not how ls is supposed to be used.</p><p>ls in simple terms lists the directory contents.</p><p>However, ls have a long list of optional arguments you can include. So like most man pages, the ls manual page is daunting to read.</p><p>In the post, I’m going to talk more specifically for using ls to find specific files, specifically file extensions.</p><h3>ls *.c</h3><p>This is the command I’ll be referencing a lot.</p><p>Running ls without any arguments just lists the files and directories in the current directory one after another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBVpZerY9Tim8ZpVuC2wkw.png" /><figcaption>simple ls</figcaption></figure><p><strong>What’s the ‘*’ for?</strong></p><p>The star character acts like a wild card for filename expansion. All this means is the bash is matching a patterns.</p><p>The star by itself matches with every filename in the directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*vuTT8BZYwaNodv8yTab5_w.png" /><figcaption>wildcard</figcaption></figure><p>So after just the * by itself doesn’t do too much.</p><p>The cool part is you can search for patterns in the file name with * as well.</p><p>You can run something like ls m*which lists everything that starts with an “m”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*ZXuSCs5e4ge0f00r9QSDgA.png" /><figcaption>m files</figcaption></figure><p>Or in our case, you can put the star at the beginning to list items ending in .c.</p><p>So that command will look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*qJhPeBTdAT09Z35uQr8iRA.png" /><figcaption>ending with .c</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36c24b4ccfd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>