<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: H. Tuğkan Kibar</title>
    <description>The latest articles on DEV Community by H. Tuğkan Kibar (@tugkankibar).</description>
    <link>https://dev.to/tugkankibar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F125670%2Ffc34f6ff-67c1-43b7-825d-167e30241dc5.png</url>
      <title>DEV Community: H. Tuğkan Kibar</title>
      <link>https://dev.to/tugkankibar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tugkankibar"/>
    <language>en</language>
    <item>
      <title>Using Cypress behind a corporate proxy / VPN - oh no!</title>
      <dc:creator>H. Tuğkan Kibar</dc:creator>
      <pubDate>Wed, 26 May 2021 13:01:25 +0000</pubDate>
      <link>https://dev.to/tugkankibar/using-cypress-behind-a-corporate-proxy-vpn-oh-no-39f4</link>
      <guid>https://dev.to/tugkankibar/using-cypress-behind-a-corporate-proxy-vpn-oh-no-39f4</guid>
      <description>&lt;p&gt;Working behind a corporate VPN / proxy is a situation most of us (especially when working in large corporations) have to face day to day. If so, and if you are using a tool such as ZScaler, you might end up getting a dreaded "Error: unable to get local issuer certificate" error when trying to install Cypress for the first time.&lt;/p&gt;

&lt;p&gt;Surely you could disable the VPN, and all would be well - mainly due to Cypress caching the version it downloads.&lt;/p&gt;

&lt;p&gt;However - to fix this issue you could also go for the following route of including the binary into your repo (or a mirror of course).&lt;/p&gt;

&lt;p&gt;To do so - here is what I've done;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the binary from Cypress - most likely your CLI will already show the URL for the failed download step.&lt;/li&gt;
&lt;li&gt;(Skip this step if you will mirror Cypress) Create a folder for your binaries, I've went with making a binaries folder, at the project root and creating a cypress folder there which includes the downloaded file as version.zip, in this case "6.9.1.zip". (You can use a different folder / naming obviously).&lt;/li&gt;
&lt;li&gt;Create / edit the .npmrc file at the project root level.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Depending on your situation add one of the following lines;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you will include the binary in your own repo like I've noted: &lt;code&gt;CYPRESS_INSTALL_BINARY=../../binaries/cypress/6.9.1.zip&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If you will mirror the cypress and keep the same layout: &lt;code&gt;CYPRESS_DOWNLOAD_MIRROR=https://example.com/&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if it works by running &lt;code&gt;yarn&lt;/code&gt; or &lt;code&gt;npm install&lt;/code&gt;. Remember - if it worked even once; you might have stuff still in cache. To make sure that is not the case, you can run &lt;code&gt;rm -rf $(npx cypress cache path)&lt;/code&gt; which will clear out your cache location.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hope it helps - happy hacking!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cypress</category>
      <category>howto</category>
    </item>
    <item>
      <title>Blockchain: What the hell is a Merkle Tree?</title>
      <dc:creator>H. Tuğkan Kibar</dc:creator>
      <pubDate>Fri, 02 Aug 2019 12:30:38 +0000</pubDate>
      <link>https://dev.to/tugkankibar/blockchain-what-the-hell-is-a-merkle-tree-3hi0</link>
      <guid>https://dev.to/tugkankibar/blockchain-what-the-hell-is-a-merkle-tree-3hi0</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U7kHSeYD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/562/0%2AU7rXX5AlwZISW-vO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U7kHSeYD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/562/0%2AU7rXX5AlwZISW-vO.png" alt=""&gt;&lt;/a&gt;&lt;em&gt;No you can’t find this kind of a tree in the forest. (source: &lt;/em&gt;&lt;a href="https://xkcd.com/835/"&gt;&lt;em&gt;xkcd&lt;/em&gt;&lt;/a&gt;&lt;em&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;While it might not get you invited to parties, it is important to know what a tree is to jump into the Merkle Tree. In computer science, a tree is a data structure. What it means is;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It is composed out of &lt;strong&gt;nodes&lt;/strong&gt; : a fancy way of saying something that contains data and can link to other fellow nodes.&lt;/li&gt;
&lt;li&gt;It is also composed out of &lt;strong&gt;edges&lt;/strong&gt; : which is the links we were talking about in the previous point. Duh.&lt;/li&gt;
&lt;li&gt;It is a type of &lt;strong&gt;graph&lt;/strong&gt; : if you only have the previous two points and no other limitations imposed on it; you would have a graph. However, since trees are special types of graphs;&lt;/li&gt;
&lt;li&gt;It starts with a &lt;strong&gt;root node&lt;/strong&gt; : You must have one node that is the beginning of your tree, where it all began. Your very own patient zero. (Someone remind me to make a zombie joke here please.)&lt;/li&gt;
&lt;li&gt;Nodes only link by &lt;strong&gt;branching off&lt;/strong&gt; of the parent nodes. As such, you can’t just link your nodes however you want.&lt;/li&gt;
&lt;li&gt;A node without children is called a &lt;strong&gt;leaf&lt;/strong&gt; or &lt;strong&gt;terminal&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you follow these six rules; you end up with something like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TIthwN2J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AjXcmEi7osIYAJinj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TIthwN2J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AjXcmEi7osIYAJinj.png" alt=""&gt;&lt;/a&gt;A tree in the wild. Let’s not spook it. (source: &lt;a href="https://en.wikipedia.org/wiki/Tree_(data_structure)"&gt;wikipedia&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I can almost hear everyone screaming at their screens and chanting “so what?”. In my opinion it is best to give a relevant example such as an organisation’s hierarchy. You see, even though we defined a computer science term with nodes, leafs and such… it is actually not something we have never seen. Any time we think of a hierarchy, and strictly the hierarchy, we think of a tree.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi6y7eCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/770/1%2A-2kXivF6vFxyiqpReqg1_A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fi6y7eCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/770/1%2A-2kXivF6vFxyiqpReqg1_A.png" alt=""&gt;&lt;/a&gt;An example of a organisational hierarchy. See how they are the same? (source: me)&lt;/p&gt;

&lt;p&gt;As it turns out, this type of a data structure that we knew even before computer science, has many different use cases. Particularly speaking it is commonly used for representing hierarchical data, since it has a certain structure storing data for efficient searches and more.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;merkle tree&lt;/strong&gt; is just a special type of tree. And also another use case for this data structure with additional limitations. You see, in a &lt;strong&gt;merkle tree&lt;/strong&gt; , which is also known as a &lt;strong&gt;hash tree&lt;/strong&gt; , every &lt;strong&gt;leaf&lt;/strong&gt; contains…&lt;/p&gt;

&lt;p&gt;Wait we are going too fast, what is a  &lt;strong&gt;hash&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When a man and a woman loves each other very much…&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sorry that was not the topic we are on. A &lt;strong&gt;hash&lt;/strong&gt; is basically a signature of any kind of arbitrary data. In a bit more formal way, it is a function that takes an arbitrary size data and returns a fixed size one. However, since it is a “signature” of the data it has to be;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic&lt;/strong&gt; : This basically means that we want to get the same hash for the same data. Forever. As such, you can’t have anything random here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uniform&lt;/strong&gt; : If we had a function, that yelled “A” for any input, it would so far work right? However in order to have this as a good, unique signature we want the chance of getting any output (of the fixed size) roughly the same. If this doesn’t happen we have more of what is called a &lt;strong&gt;collision&lt;/strong&gt; : meaning that we have more and more data with the same signature. With large enough “fixed-size” output (signature’s size) and uniformity, this stops being a problem, especially for data that has any meaning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Defined range&lt;/strong&gt; : This is the “fixed-size” part that we are talking about. Since our goal is taking any data and producing a common signature, it has to have a defined range. This is usually talked as the amount of bits, so a very popular hash function SHA-512 for example has 512-bit as its defined range.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-invertible&lt;/strong&gt; : We expect these signatures to be a one way street, meaning you shouldn’t be able to get the original content using the hash. While this is not always a requirement, especially for cryptographic hashes, it is definitely very important. (Meaning for example instead of storing your password, facebook could store the “signature” of the password and not get into trouble previously)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Since now we have an idea of what a hash is; back to the Merkle Tree. As we were saying, each &lt;strong&gt;leaf&lt;/strong&gt; in this tree has some data block in it. Any other &lt;strong&gt;node&lt;/strong&gt; contains the &lt;strong&gt;cryptographic hash (the one-way signature)&lt;/strong&gt; of its children. This turns out to be a very interesting way of storing some data; particularly because it allows you to verify any kind of data. It is also very good in making sure this is a fast process, since we only check for the signatures of the data and nothing else.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iNdkK83f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AZaOQfeY7SLiWj8Ub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iNdkK83f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AZaOQfeY7SLiWj8Ub.png" alt=""&gt;&lt;/a&gt;A lovely little Merkle Tree. Say hi! (source: &lt;a href="https://en.wikipedia.org/wiki/Merkle_tree"&gt;wikipedia&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;But why? Couldn’t we just check the normal hash of the data instead of putting it into pieces and creating a whole tree?&lt;/p&gt;

&lt;p&gt;We could. However, if you are developing a distributed / peer-to-peer (where machines are talking to each other and you don’t know whom you can trust) systems, this type of a verification becomes extremely important. Even though the same data is in multiple places, there is no way of knowing if;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The node you get the data from is honest.&lt;/li&gt;
&lt;li&gt;The data you get is correct (and the node before you wasn’t fooled).&lt;/li&gt;
&lt;li&gt;The data was not corrupted on the road.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ensuring these questions are answered reliably while also making the verifications fast is why we use Merkle Trees. There are many examples of this in the wild, particularly the source control system Git and the pseudo-anonymous cryptocurrency Bitcoin are the most notable ones known. As such, it is also a prerequisite to understanding what a blockchain is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for your time 🎉&lt;/strong&gt; Since this is my first original content, I’d love to hear back from you with any comments, improvements or ideas.&lt;/p&gt;

&lt;p&gt;Please make sure to &lt;strong&gt;reach out&lt;/strong&gt; to me via the following channels;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://twitter.com/tugkankibar"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//mailto:htkibar@gmail.com"&gt;Good old fashioned Email&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Just leave a comment down below&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hopefully, this will be a part of a larger series about what blockchain is and how to develop one from scratch in any programming language you want. Stay tuned!&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>blockchain</category>
      <category>merkletree</category>
      <category>merkle</category>
    </item>
  </channel>
</rss>
