1<!DOCTYPE html> 2<html> 3<head> 4 5 <!-- Document Settings --> 6 <meta charset="utf-8" /> 7 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 8 9 <!-- Base Meta --> 10 <!-- dynamically fixing the title for tag/author pages --> 11 12 13 14 <title>I tried out GPT3, Here is what I did - Part 2</title> 15 <meta name="HandheldFriendly" content="True" /> 16 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 17 <!-- Styles'n'Scripts --> 18 <link rel="stylesheet" type="text/css" href="/assets/built/screen.css" /> 19 <link rel="stylesheet" type="text/css" href="/assets/built/screen.edited.css" /> 20 <link rel="stylesheet" type="text/css" href="/assets/built/syntax.css" /> 21 <!-- highlight.js --> 22 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"> 23 <style>.hljs { background: none; }</style> 24 25 <!--[if IE]> 26 <style> 27 p, ol, ul{ 28 width: 100%; 29 } 30 blockquote{ 31 width: 100%; 32 } 33 </style> 34 <![endif]--> 35 36 <!-- This tag outputs SEO meta+structured data and other important settings --> 37 <meta name="description" content="Ramit Surana Personal Blog" /> 38 <link rel="shortcut icon" href="/assets/images/favicon.png" type="image/png" /> 39 <link rel="canonical" href="/gpt3-part-2" /> 40 <meta name="referrer" content="no-referrer-when-downgrade" /> 41 42 <!--title below is coming from _includes/dynamic_title--> 43 <meta property="og:site_name" content="Ramit Surana" /> 44 <meta property="og:type" content="website" /> 45 <meta property="og:title" content="I tried out GPT3, Here is what I did - Part 2" /> 46 <meta property="og:description" content="Spreadsheets Generating Fill in the blank questions Solving Leetcode Coding Challenges Decrypting AES256 Creating a new language Trick Question on Football Generating Essays Conclusion Spreadsheets GPT3 can be useful for generating content that can be later used for creating spreadsheets, this would help in generating spreadsheets without any manual efforts." /> 47 <meta property="og:url" content="/gpt3-part-2" /> 48 <meta property="og:image" content="/assets/images/writing.jpg" /> 49 <meta property="article:publisher" content="https://www.facebook.com/ramitsurana" /> 50 <meta property="article:author" content="https://www.facebook.com/ramitsurana" /> 51 <meta property="article:published_time" content="2021-07-29T00:00:00+00:00" /> 52 <meta property="article:modified_time" content="2021-07-29T00:00:00+00:00" /> 53 <meta property="article:tag" content="Gpt3 Chat Transformers Openai" /> 54 <meta name="twitter:card" content="summary_large_image" /> 55 <meta name="twitter:title" content="I tried out GPT3, Here is what I did - Part 2" /> 56 <meta name="twitter:description" content="Spreadsheets Generating Fill in the blank questions Solving Leetcode Coding Challenges Decrypting AES256 Creating a new language Trick Question on Football Generating Essays Conclusion Spreadsheets GPT3 can be useful for generating content that can be later used for creating spreadsheets, this would help in generating spreadsheets without any manual efforts." /> 57 <meta name="twitter:url" content="/" /> 58 <meta name="twitter:image" content="/assets/images/writing.jpg" /> 59 <meta name="twitter:label1" content="Written by" /> 60 <meta name="twitter:data1" content="Ramit Surana" /> 61 <meta name="twitter:label2" content="Filed under" /> 62 <meta name="twitter:data2" content="Gpt3 Chat Transformers Openai" /> 63 <meta name="twitter:site" content="@ramitsurana" /> 64 <meta name="twitter:creator" content="@ramitsurana" /> 65 <meta property="og:image:width" content="1400" /> 66 <meta property="og:image:height" content="933" /> 67 68
68<script type="application/ld+json"> 69{ 70 "@context": "https://schema.org", 71 "@type": "Website", 72 "publisher": { 73 "@type": "Organization", 74 "name": "Ramit Surana", 75 "logo": "/" 76 }, 77 "url": "/gpt3-part-2", 78 "image": { 79 "@type": "ImageObject", 80 "url": "/assets/images/writing.jpg", 81 "width": 2000, 82 "height": 666 83 }, 84 "mainEntityOfPage": { 85 "@type": "WebPage", 86 "@id": "/gpt3-part-2" 87 }, 88 "description": "Spreadsheets Generating Fill in the blank questions Solving Leetcode Coding Challenges Decrypting AES256 Creating a new language Trick Question on Football Generating Essays Conclusion Spreadsheets GPT3 can be useful for generating content that can be later used for creating spreadsheets, this would help in generating spreadsheets without any manual efforts." 89} 90 </script>
90 91 92 <!--
92<script type="text/javascript" src="https://demo.ghost.io/public/ghost-sdk.min.js?v=724281a32e"></script>
92 93
93<script type="text/javascript"> 94 ghost.init({ 95 clientId: "ghost-frontend", 96 clientSecret: "f84a07a72b17" 97 }); 98 </script>
98 --> 99 100 <meta name="generator" content="Jekyll 3.6.2" /> 101 <link rel="alternate" type="application/rss+xml" title="I tried out GPT3, Here is what I did - Part 2" href="/feed.xml" /> 102 103 104</head> 105<body class="post-template"> 106 107 <div class="site-wrapper"> 108 <!-- All the main content gets inserted here, index.hbs, post.hbs, etc --> 109 <!-- default --> 110 111<!-- The tag above means: insert everything in this file 112into the {body} of the default.hbs template --> 113 114<header class="site-header outer"> 115 <div class="inner"> 116 <nav class="site-nav"> 117 <div class="site-nav-left"> 118 119 120 <a class="site-nav-logo" href="/">Ramit Surana</a> 121 122 123 124 <ul class="nav" role="menu"> 125 <li class="nav-home" role="menuitem"><a href="/">Home</a></li> 126 <li class="nav-about" role="menuitem"><a href="/about/">About</a></li> 127<!-- <li class="nav-getting-started" role="menuitem"><a href="/tag/getting-started/">Getting Started</a></li> --> 128 <li class="nav-try-ghost" role="menuitem"><a href="https://fantastic-experimenter-7320.ck.page/25b1d91d09">Newsletter</a></li> 129</ul> 130 131 132 </div> 133 <div class="site-nav-right"> 134 <div class="social-links"> 135 136 <a class="social-link social-link-fb" href="https://facebook.com/ramitsurana" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M19 6h5V0h-5c-3.86 0-7 3.14-7 7v3H8v6h4v16h6V16h5l1-6h-6V7c0-.542.458-1 1-1z"/></svg> 137</a> 138 139 140 <a class="social-link social-link-tw" href="https://twitter.com/ramitsurana" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg> 141</a> 142 143 </div> 144 145 <a class="subscribe-button" href="#subscribe">Subscribe</a> 146 147 </div> 148</nav> 149 150 </div> 151</header> 152 153<!-- Everything inside the #post tags pulls data from the post --> 154<!-- #post --> 155 156<main id="site-main" class="site-main outer" role="main"> 157 <div class="inner"> 158 159 <article class="post-full tag-gpt3-chat-transformers-openai post "> 160 161 <header class="post-full-header"> 162 <section class="post-full-meta"> 163 <time class="post-full-meta-date" datetime="29 July 2021">29 July 2021</time> 164 165 <span class="date-divider">/</span> 166 167 168 <a href='/tag/gpt3-chat-transformers-openai/'>GPT3 CHAT TRANSFORMERS OPENAI</a> 169 170 171 172 </section> 173 <h1 class="post-full-title">I tried out GPT3, Here is what I did - Part 2</h1> 174 </header> 175 176 177 <figure class="post-full-image" style="background-image: url(/assets/images/writing.jpg)"> 178 </figure> 179 180 181 <section class="post-full-content"> 182 <div class="kg-card-markdown"> 183 <ul> 184 <li><a href="#spreadsheets">Spreadsheets</a></li> 185 <li><a href="#generating-fill-in-the-blank-questions">Generating Fill in the blank questions</a></li> 186 <li><a href="#solving-leetcode-coding-challenges">Solving Leetcode Coding Challenges</a></li> 187 <li><a href="#decrypting-aes256">Decrypting AES256</a></li> 188 <li><a href="#creating-a-new-language">Creating a new language</a></li> 189 <li><a href="#trick-question-on-football">Trick Question on Football</a></li> 190 <li><a href="#generating-essays">Generating Essays</a></li> 191 <li><a href="#conclusion">Conclusion</a></li> 192</ul> 193 194<h3 id="spreadsheets">Spreadsheets</h3> 195 196<p>GPT3 can be useful for generating content that can be later used for creating spreadsheets, this would help in generating spreadsheets without any manual efforts. I was curious if GPT3 could do multiple complex calculations and solve some basic formulas like summation, average, mean, etc. But after some understanding of how the GPT3 works with spreadsheets, I realized itâs not really doing any mathematical computation, itâs basically generating a more generalized form of information that we like to spend time looking up to the internet and filling it out. Here is a short example -</p> 197 198<p><img src="assets/images/gpt3/gpt3-spreadsheet.png" alt="Spreadsheet" /></p> 199 200<p>I tried out to calculate the mean as well, but the GPT3 model was not very clear on how to proceed with it</p> 201 202<h3 id="generating-fill-in-the-blank-questions">Generating Fill in the blank questions</h3> 203 204<p>In a T5 sequence to sequence model, one of the key features is that we can actually generate some questions and answers using the model. Although I believe GPT3 is not designed to be a T5 based model, it was nice to see that it could generate questions and answers based on its current knowledge. Here is a short example -</p> 205 206<p><img src="assets/images/gpt3/t5-gpt3.png" alt="T5" /></p> 207 208<p>This kind of feature is highly useful for academic settings where people tend to create flashcards like using Anki and teachers like to give quizzes to students to help students improve their understanding of the subject. Highly Recommended!</p> 209 210<h3 id="solving-leetcode-coding-challenges">Solving Leetcode Coding Challenges</h3> 211 212<p>For the Leetcode Solving challenge part, I have chosen the 2 sum problem. For reference, here is the following link - <a href="https://leetcode.com/problems/two-sum/">https://leetcode.com/problems/two-sum/</a></p> 213 214<p>After a few attempts to check out its source and setting Response Length as 215. I was able to understand, the source of the solution and why itâs not good.</p> 215 216<p>Challenge 1 Input â</p> 217 218<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#Solve the following Problem in Python: 219</span> 220<span class="n">Problem</span><span class="p">:</span> 221<span class="n">Given</span> <span class="n">an</span> <span class="n">array</span> <span class="n">of</span> <span class="n">integers</span> <span class="n">nums</span> <span class="ow">and</span> <span class="n">an</span> <span class="n">integer</span> <span class="n">target</span><span class="p">,</span> <span class="k">return</span> <span class="n">indices</span> <span class="n">of</span> <span class="n">the</span> <span class="n">two</span> <span class="n">numbers</span> <span class="n">such</span> <span class="n">that</span> <span class="n">they</span> <span class="n">add</span> <span class="n">up</span> <span class="n">to</span> <span class="n">target</span><span class="p">.</span> 222<span class="n">You</span> <span class="n">may</span> <span class="n">assume</span> <span class="n">that</span> <span class="n">each</span> <span class="nb">input</span> <span class="n">would</span> <span class="n">have</span> <span class="n">exactly</span> <span class="n">one</span> <span class="n">solution</span><span class="p">,</span> <span class="ow">and</span> <span class="n">
222you</span> <span class="n">may</span> <span class="ow">not</span> <span class="n">use</span> <span class="n">the</span> <span class="n">same</span> <span class="n">element</span> <span class="n">twice</span><span class="p">.</span> 223<span class="n">You</span> <span class="n">can</span> <span class="k">return</span> <span class="n">the</span> <span class="n">answer</span> <span class="ow">in</span> <span class="nb">any</span> <span class="n">order</span><span class="p">.</span> 224 225<span class="n">Input</span><span class="p">:</span> <span class="n">nums</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span> <span class="n">target</span> <span class="o">=</span> <span class="mi">6</span> 226 227<span class="n">Answer</span><span class="p">:</span> 228</code></pre></div></div> 229 230<p>Challenge 1 Output â</p> 231 232<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#Solve the following Problem in Python: 233</span> 234<span class="n">Problem</span><span class="p">:</span> 235<span class="n">Given</span> <span class="n">an</span> <span class="n">array</span> <span class="n">of</span> <span class="n">integers</span> <span class="n">nums</span> <span class="ow">and</span> <span class="n">an</span> <span class="n">integer</span> <span class="n">target</span><span class="p">,</span> <span class="k">return</span> <span class="n">indices</span> <span class="n">of</span> <span class="n">the</span> <span class="n">two</span> <span class="n">numbers</span> <span class="n">such</span> <span class="n">that</span> <span class="n">they</span> <span class="n">add</span> <span class="n">up</span> <span class="n">to</span> <span class="n">target</span><span class="p">.</span> 236<span class="n">You</span> <span class="n">may</span> <span class="n">assume</span> <span class="n">that</span> <span class="n">each</span> <span class="nb">input</span> <span class="n">would</span> <span class="n">have</span> <span class="n">exactly</span> <span class="n">one</span> <span class="n">solution</span><span class="p">,</span> <span class="ow">and</span> <span class="n">you</span> <span class="n">may</span> <span class="ow">not</span> <span class="n">use</span> <span class="n">the</span> <span class="n">same</span> <span class="n">element</span> <span class="n">twice</span><span class="p">.</span> 237<span class="n">You</span> <span class="n">can</span> <span class="k">return</span> <span class="n">the</span> <span class="n">answer</span> <span class="ow">in</span> <span class="nb">any</span> <span class="n">order</span><span class="p">.</span> 238 239<span class="n">Input</span><span class="p">:</span> <span class="n">nums</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],</span> <span class="n">target</span> <span class="o">=</span> <span class="mi">6</span> 240 241<span class="n">Answer</span><span class="p">:</span> 242<span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> 243 244<span class="n">Python</span> <span class="n">Code</span><span class="p">:</span> 245 246<span class="k">def</span> <span class="nf">add_to_target</span><span class="p">(</span><span class="n">nums</span><span class="p">,</span> <span class="n">target</span><span class="p">):</span> 247 248<span class="k">return</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> 249 250<span class="k">print</span><span class="p">(</span><span class="n">add_to_target</span><span class="p">(</span><span class="n">nums</span><span class="p">,</span> <span class="n">target</span><span class="p">))</span> 251 252<span class="n">Output</span><span class="p">:</span> 253 254<span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span> 255 256<span class="n">Time</span> <span class="n">Complexity</span><span class="p">:</span> <span class="n">O</span><span class="p">(</span><span class="n">n</span><span class="p">)</span> 257 258<span class="n">Auxiliary</span> <span class="n">Space</span><span class="p">:</span> <span class="n">O</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> 259 260<span class="n">This</span> <span class="n">article</span> <span class="ow">is</span> <span class="n">contributed</span> <span class="n">by</span> <span class="n">Shivam</span> <span class="n">Pradhan</span> <span class="p">(</span><span class="n">anuj_charm</span><span class="p">).</span> <span class="n">If</span> <span class="n">
260you</span> <span class="n">like</span> <span class="n">GeeksforGeeks</span> <span class="ow">and</span> <span class="n">would</span> <span class="n">like</span> <span class="n">to</span> <span class="n">contribute</span><span class="p">,</span> <span class="n">you</span> <span class="n">can</span> <span class="n">also</span> <span class="n">write</span> <span class="n">an</span> <span class="n">article</span> <span class="n">using</span> <span class="n">contribute</span><span class="p">.</span><span class="n">geeksforgeeks</span><span class="p">.</span><span class="n">org</span> <span class="ow">or</span> <span class="n">mail</span> <span class="n">your</span> <span class="n">article</span> <span class="n">to</span> <span class="n">contribute</span><span class="o">@</span><span class="n">geeksforgeeks</span><span class="p">.</span><span class="n">org</span><span class="p">.</span> <span class="n">See</span> <span class="n">your</span> <span class="n">article</span> <span class="n">appearing</span> <span class="n">on</span> <span class="n">the</span> <span class="n">GeeksforGeeks</span> <span class="n">main</span> <span class="n">page</span> <span class="ow">and</span> <span class="n">help</span> <span class="n">other</span> <span class="n">Geeks</span><span class="p">.</span> 261 262<span class="n">Please</span> <span class="n">write</span> <span class="n">comments</span> <span class="k">if</span> <span class="n">you</span> <span class="n">find</span> <span class="n">anything</span> <span class="n">incorrect</span><span class="p">,</span> <span class="ow">or</span> <span class="n">you</span> <span class="n">want</span> <span class="n">to</span> <span class="n">share</span> <span class="n">more</span> <span class="n">information</span> <span class="n">about</span> <span class="n">the</span> <span class="n">topic</span> <span class="n">discussed</span> <span class="n">above</span><span class="p">.</span> 263</code></pre></div></div> 264 265<p>Letâs try some harder challenges â</p> 266 267<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#Solve the following Problem in Python: 268</span><span class="n">Problem</span><span class="p">:</span> 269<span class="n">Given</span> <span class="n">n</span> <span class="n">non</span><span class="o">-</span><span class="n">negative</span> <span class="n">integers</span> <span class="n">representing</span> <span class="n">an</span> <span class="n">elevation</span> <span class="nb">map</span> <span class="n">where</span> <span class="n">the</span> <span class="n">width</span> <span class="n">of</span> <span class="n">each</span> <span class="n">bar</span> <span class="ow">is</span> <span class="mi">1</span><span class="p">,</span> <span class="n">compute</span> <span class="n">how</span> <span class="n">much</span> <span class="n">water</span> <span class="n">it</span> <span class="n">can</span> <span class="n">trap</span> <span class="n">after</span> <span class="n">raining</span><span class="p">.</span> 270<span class="n">Input</span><span class="p">:</span> <span class="n">height</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">]</span> 271 272<span class="n">Output</span><span class="p">:</span> 273</code></pre></div></div> 274 275<p>Challenge 2 Output â</p> 276 277<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#Solve the following Problem in Python: 278</span><span class="n">Problem</span><span class="p">:</span> 279<span class="n">Given</span> <span class="n">n</span> <span class="n">non</span><span class="o">-</span><span class="n">negative</span> <span class="n">integers</span> <span class="n">representing</span> <span class="n">an</span> <span class="n">elevation</span> <span class="nb">map</span> <span class="n">where</span> <span class="n">the</span> <span class="n">width</span> <span class="n">of</span> <span class="n">each</span> <span class="n">bar</span> <span class="ow">is</span> <span class="mi">1</span><span class="p">,</span> <span class="n">compute</span> <span class="n">how</span> <span class="n">much</span> <span class="n">water</span> <span class="n">it</span> <span class="n">can</span> <span class="n">trap</span> <span class="n">after</span> <span class="n">raining</span><span class="p">.</span> 280<span class="n">Input</span><span class="p">:</span> <span class="n">height</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">]</span> 281 282<span class="n">Output</span><span class="p">:</span> <span class="n">water</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span> 283 284<span class="n">Solution</span><span class="p">:</span> 285 286<span class="c1">#Solve the following Problem in Python: 287</span><span class="n">Problem</span><span class="p">:</span> 288<span class="n">Given</span> <span class="n">a</span> <span class="n">string</span> <span class="n">of</span> <span class="n">lowercase</span> <span class="n">letters</span><span class="p">,</span> <span class="k">return</span> <span class="n">a</span> <span class="nb">list</span> <span class="n">of</span> <span class="nb">all</span> <span class="n">possible</span> <span class="n">words</span><span class="p">.</span> 289<span class="n">Solution</span><span class="p">:</span> 290 291<span class="c1">#Solve the following Problem in Python: 292</span><span class="n">Problem</span><span class="p">:</span> 293<span class="n">Given</span> <span class="n">a</span> <span class="n">string</span> <span class="n">of</span> <span class="n">lowercase</span> <span class="n">letters</span><span class="p">,</span> <span class="k">return</span> <span class="n">a</span> <span class="nb">list</span> <span class="n">of</span> <span class="nb">all</span> <span class="n">possible</span> <span class="n">words</span><span class="p">.</span> 294<span class="n">Solution</span><span class="p">:</span> 295 296<span class="c1">#Solve the following Problem in Python: 297</span><span class="n">Problem</span><span class="p">:</span> 298<span class="n">Given</span> <span class="n">a</span> <span class="n">string</span> <span class="n">of</span> <span class="n">lowercase</span> <span class="n">letters</span><span class="p">,</span> <span class="k">return</span> <span class="n">a</span> <span class="nb">list</span> <span class="n">of</span> <span class="nb">all</span> <span class="n">possible</span> <span class="n">words</span><span class="p">.</span> 299<span class="n">Solution</span><span class="p">:</span> 300</code></pre></div></div> 301 302<p>If you try to change the words, letâs say instead of Output, you write Solution, it will throw a different output. It looks like GPT3 is more interested in trying to scrap the web and match the records from the internet rather than trying to solve the actual problem.</p> 303 304<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#Solve the following Problem in Python: 305</span><span class="n">Problem</span><span class="p">:</span> 306<span class="n">Given</span> <span class="n">n</span> <span class="n">non</span><span class="o">-</span><span class="n">negative</span> <span class="n">integers</span> <span class="n">representing</span> <span class="n">an</span> <span class="n">elevation</span> <span class="nb">map</span> <span class="n">where</span> <span class="n">the</span> <span class="n">width</span> <span class="n">of</span> <span class="n">each</span> <span class="n">bar</span> <span class="ow">is</span> <span class="mi">1</span><span class="p">,</span> <span class="n">compute</span> <span class="n">how</span> <span class="n">much</span> <span class="n">water</span> <span class="n">it</span> <span class="n">can</span> <span class="n">trap</span> <span class="n">after</span> <span class="n">raining</span><span class="p">.</span> 307<span class="n">Input</span><span class="p">:</span> <span class="n">height</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">]</span> 308 309<span class="n">Solution</span><span class="p">:</span> 310<span class="c1">#!/usr/bin/python 311</span><span class="k">def</span> <span class="nf">main</span><span class="p">():</span> 312<span class="k">print</span> <span class="s">"The answer is:"</span><span class="p">,</span> <span class="n">answer</span> 313<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span> 314<span class="n">main</span><span class="p">()</span> 315<span class="n">Output</span><span class="p">:</span> 316<span class="n">The</span> <span class="n">answer</span> <span class="ow">is</span><span class="p">:</span> <span class="mi">0</span> 317 318<span class="n">The</span> <span class="n">problem</span> <span class="ow">is</span> <span class="n">solved</span> <span class="n">by</span> <span class="n">using</span> <span class="n">a</span> <span class="n">simple</span> <span class="n">recursive</span> <span class="n">algorithm</span><span class="p">.</span> 319 320<span class="n">The</span> <span class="n">algorithm</span> <span class="ow">is</span> <span class="k">as</span> <span class="n">follows</span><span class="p">:</span> 321 322<span class="mf">1.</span> <span class="n">If</span> <span class="n">the</span> <span class="nb">map</span> <span class="ow">is</span> <span class="n">empty</span><span class="p">,</span> <span class="n">then</span> <span class="n">the</span> <span class="n">answer</span> <span class="ow">is</span> <span class="mf">0.</span> 323 324<span class="mf">2.</span> <span class="n">If</span> <span class="n">the</span> <span class="nb">map</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">empty</span><span class="p">,</span> <span class="n">then</span> <span class="n">the</span> <span class="n">answer</span> <span class="ow">is</span> <span class="n">the</span> <span class="nb">sum</span> <span class="n">of</span> <span class="n">the</span> <span class="n">heights</span> <span class="n">of</span> <span class="n">the</span> <span class="n">bars</span> <span class="ow">in</span> <span class="n">the</span> <span class="nb">map</span><span class="p">.</span> 325 326<span class="mf">3.</span> <span class="n">Recursively</span> <span class="n">compute</span> <span class="n">the</span> <span class="n">answer</span> <span class="k">for</span> <span class="n">the</span> <span class="nb">map</span> <span class="n">obtained</span> <span class="n">by</span> <span class="n">removing</span> <span class="n">the</span> <span class="n">top</span> 327</code></pre></div></div> 328 329<h3 id="decrypting-aes256">Decrypting AES256</h3> 330 331<p>So out of curiosity, I tried out decrypting the AES256 algorithm, to check if itâs possible for GPT3 to decrypt the string. Here is a sample of AES256 encryption and decryption looks like -</p> 332 333<p><img src="assets/images/gpt3/aes256.png" alt="AES256" /></p> 334 335<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Decode AES256 encoded string 336</span><span class="n">Input</span><span class="p">:</span> <span class="n">LwGnphkgiB3JZJS4m8YjyyYk</span><span class="o">+</span><span class="n">Y0t2EA6dbTbGY8tMJk</span><span class="o">=</span> 337<span class="n">Output</span><span class="p">:</span> 338</code></pre></div></div> 339 340<p>Output â</p> 341 342<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">
342Decode</span> <span class="n">the</span> <span class="n">Input</span> <span class="n">encoded</span> <span class="n">string</span> <span class="n">using</span> <span class="n">AES256</span> 343<span class="n">Input</span><span class="p">:</span> <span class="n">LwGnphkgiB3JZJS4m8YjyyYk</span><span class="o">+</span><span class="n">Y0t2EA6dbTbGY8tMJk</span><span class="o">=</span> 344<span class="n">Output</span><span class="p">:</span> 345<span class="n">LwGnphkgiB3JZJS4m8YjyyYk</span><span class="o">+</span><span class="n">Y0t2EA6dbTbGY8tMJk</span><span class="o">=</span> 346</code></pre></div></div> 347 348<p>I got the following response. It looks like OpenAI has perceived this as a threat and refused to show the output. I got the same output response as I had taken as Input. <strong>I highly welcome and appreciate this move from OpenAI, with GPT3 there is always a good possibility that people may try to decrypt messages from secure sites banks, government websites, big businesses, etc.</strong></p> 349 350<p>So security â </p> 351 352<p><img src="assets/images/gpt3/openai-unsafe.png" alt="OpenAI-Unsafe" /></p> 353 354<h3 id="creating-a-new-language">Creating a new language</h3> 355 356<p>In the past, Facebook AI had been experimenting with AI to make conversations with each other. After some time, the 2 bots started talking to each other in there own language which as humans we were not able to recognize. The project got shut down immediately later but it definitely showed us some ways in which AI can over-smart humans.</p> 357 358<p>For more information, please refer -</p> 359 360<p><a href="https://thenextweb.com/news/facebooks-ai-accidentally-created-its-own-language">https://thenextweb.com/news/facebooks-ai-accidentally-created-its-own-language</a></p> 361 362<p><img src="assets/images/gpt3/gpt3-language.png" alt="GPT3-Language" /></p> 363 364<h3 id="trick-question-on-football">Trick Question on Football</h3> 365 366<p>Football has a different meaning in different parts of the world. So I thought letâs see how GPT3 would respond to it, will it consider the American Version or the Soccer version for it.</p> 367 368<p><img src="assets/images/gpt3/gpt3-football.png" alt="OpenAI-Football" /></p> 369 370<p>It looks like it considered the American version of it where Football is essentially a term for Rugby. ð Looks like GPT3 did not consider my location and origin in accordance while responding to the question. As a wild guess, It may be possible, that the dataset it was trained on a bit biased on the American side of things ð</p> 371 372<h3 id="generating-essays">Generating Essays</h3> 373 374<p>If you follow a few Reddit threads, GPT3 has an amazing ability to write essays on topics that we may need experts on. So I tried to generate a few random essays and posted them on my blog. Below are a few samples -</p> 375 376<p>Ref - <a href="https://www.theverge.com/2020/8/16/21371049/gpt3-hacker-news-ai-blog">https://www.theverge.com/2020/8/16/21371049/gpt3-hacker-news-ai-blog</a></p> 377 378<p>1st Essay on Protein Folding â</p> 379 380<div class="language-markdown highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Create an essay about Protein Folding in 500 words: 381 382Molecular biology is a branch of biology which deals with the synthesis, structure, function, and molecular interactions of biological macromolecules such as proteins, nucleic acids, carbohydrates, lipids, and polysaccharides. The phenomenon of folding is called self-assembly. 383 384The term âself-assemblyâ was coined in the late 1960s to describe molecular processes that occur through interactions between separate molecules or molecular building blocks without a guiding hand of an external agent. The term was invented because the process was considered inherently different from that of chemical synthesis and crystal formation. In the last century, many scientists have attempted to design molecules that would assemble themselves from separate components. 385 386For example, in the 1960s, C.N. Yang and Robert Corey developed a model for enzymatic peptide synthesis in which the amino acid sequence of the polypeptide is first folded by a synthetic enzyme, which is then cleaved from the product. Carl Pabo and coworkers developed a set of artificial enzymes that could fold short polypeptides into structures resembling proteins. 387 388Since that time, a great deal of effort has been made to develop other self-folding proteins. Most of these efforts have focused on proteins that are small enough to be synthesized and folded in a test tube. In the process, a number of useful protein engineering methods have been developed. 389 390Some proteins, like barnase, have been engineered to fold in an autonomous fashion in vitro. In these cases, the protein is not designed to fold in a test tube, but rather to fold in vivo. One strategy for making an autonomous protein is to use a protein with a high intrinsic efficie
390ncy of folding. Another strategy is to use a protein with a high intrinsic unfolding rate. 391 392The main idea in this process is to put the protein in a situation that destabilizes the unfolded state. This can be accomplished by means of disulfide bond formation. The protein is engineered to contain cysteine residues at strategic positions. The protein is allowed to fold in vitro. The protein is then incubated in the presence of a reducing agent that forces the disulfide bonds to form. The result is a protein that folds autonomously in a test tube. 393 394Proteins are made up of amino acids linked together by peptide bonds. The amino acids are linked together in a linear fashion. The linear protein is coiled into a three-dimensional structure. The structure is stabilized by noncovalent interactions. These interactions include hydrogen bonds, nonpolar interactions, electrostatic interactions, and hydrophobic interactions. 395 396Proteins are very large molecules. To understand how they fold, it is helpful to think of the process in terms of a polymer. The polymer chain is folded in a way that minimizes the free energy of the system. The chain is also folded so that the hydrophobic amino acids are in the interior region of the protein and the hydrophilic amino acids are on the surface. 397 398It should be noted that the folding of proteins is not as simple as the folding of a polymer. The hydrophobic interactions between hydrophobic amino acids are quite strong and do not completely dissociate even when the protein is folded. The hydrophobic interactions are balanced by van der Waals interactions between the exposed hydrophilic amino acids and the surrounding solvent. 399 400The interactions between the amino acids are more than simple covalent bonds. The bond strength and the orientation are dependent on the local environment. The interactions between the alpha carbon of one amino acid and the alpha carbon of the next amino acid are much stronger than the interactions between the side chains 401</code></pre></div></div> 402 403<p>2nd Essay on Alpha Go â</p> 404 405<div class="language-markdown highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Create an essay about AlphaGo in 500 words: 406 407The history of computer Go began in the early 1970s, when it was demonstrated that reasonably good players could be developed by neural networks. A few years later, the idea that a computer could play Go well enough to beat a professional human player was proposed, but the idea was generally dismissed as being far too ambitious. 408 409In 1989, researchers at the University of Essex developed a Go-playing program using neural networks called Deep Thought. Deep Thought was able to beat a top Japanese professional Go player, Takagi Shoichi, in 1989. 410 411In 1997, IBM's Deep Blue program beat the world champion, Garry Kasparov, in chess. This victory sparked interest in developing a program to beat the best Go players in the world. 412 413A Go program based on a Monte Carlo tree search algorithm, developed by researchers at Google DeepMind, defeated the European Go champion in October 2015. This program, called AlphaGo, beat the Go champion, Lee Sedol, in March 2016. 414 415The program that beat Lee Sedol is a neural network that is able to "learn" in a way that mimics human learning. The program uses two neural networks: one to evaluate positions on the board, and the other to select moves. 416 417The idea was to have the program play against itself, and learn by itself. The program started out playing only at the amateur level, but learned to play good enough moves to beat the top players in the world. 418 419The program learned to select the good moves by playing against itself millions of times, while also playing against other software. 420 421The program "learned" by playing against itself, and adjusting its own rules. The program can now make moves better than any human player can make. 422 423The program has been defeated at times, but it has proven in each case that it can learn from its mistakes. The next step is to get the program to play the game at an even higher level, and to have it win every game. 424 425The program has already been used to test and improve other programs used in other types of games. It may be possible for the program to be used to improve some other types of programs that are used by humans. 426 427The development of the AlphaGo program has caused people to think about other ways to improve the program. One idea is to have it play against itself, but to have it play against programs that have been programmed to play in the style of the best players. 428 429This program has already been improved to the point where it is now unbeatable by any human player. 430 431This program is a good example of the way that we can use computer programs to help us do things that we would not be able to do otherwise. 432 433The AlphaGo program could help us to do better things in many other ways. 434 435The program could be used to help us find cures for diseases, and it could be used to help us find better ways to manage the world's natural resources. 436 437The program could be used to help us manage the world's economies, and it could be used to help us find better ways to manage the world's political systems. 438 439The program could also be used to help us to find better ways to manage the use of the world's natural resources. 440 441We can use the program to help us to find better ways to manage the world's natural resources, and it can help us to find better ways to do many other things. 442 443The development of the program has caused people to think about other ways to improve the program. One idea is to have it play against itself, but to have it play against programs that 444</code></pre></div></div> 445 446<h3 id="conclusion">Conclusion</h3> 447 448<p>Testing and Working on GPT3 had been a lot of fun, I had the opportunity to test out its capabilities and understand its working. If you want to understand and try out something similar to GPT3, I highly recommend checking out - <a href="https://huggingface.co/">https://huggingface.co/</a> and going through the Hugging Face Course - <a href="https://huggingface.co/course/chapter1">https://huggingface.co/course/chapter1</a>
448. Itâs very well-written coursework for those who want to learn about NLP and different categories of Transformers.</p> 449 450 </div> 451 </section> 452 453 <!-- Email subscribe form at the bottom of the page --> 454 455 <section class="subscribe-form"> 456 <h3 class="subscribe-form-title">Subscribe to Ramit Surana</h3> 457 <p>Get the latest posts delivered right to your inbox</p> 458 <form method="post" action="/subscribe/" class=""> 459 <input class="confirm" type="hidden" name="confirm" /><input class="location" type="hidden" name="location" /><input class="referrer" type="hidden" name="referrer" /> 460 461 <div class="form-group"> 462 <input class="subscribe-email" type="email" name="email" placeholder="[email protected]" /> 463 </div> 464 <button class="" type="submit" disabled><span>Subscribe</span></button> 465
465<script type="text/javascript">(function(g,h,o,s,t){h[o]('.location')[s]=h[o]('.location')[s] || g.location.href;h[o]('.referrer')[s]=h[o]('.referrer')[s] || h.referrer;})(window,document,'querySelector','value');</script>
465 466</form> 467 468 </section> 469 470 471 <footer class="post-full-footer"> 472 <!-- Everything inside the #author tags pulls data from the author --> 473 <!-- #author--> 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 <section class="author-card"> 491 492 <img class="author-profile-image" src="/assets/images/profile-pic-2.jpg" alt="ramitsurana" /> 493 494 <section class="author-card-content"> 495 <h4 class="author-card-name"><a href="/author/ramitsurana">Ramit Surana</a></h4> 496 497 <p>Author</p> 498 499 </section> 500 </section> 501 <div class="post-full-footer-right"> 502 <a class="author-card-button" href="/author/ramitsurana">Read More</a> 503 </div> 504 505 506 <!-- /author --> 507 </footer> 508 509 <!-- If you use Disqus comments, just uncomment this block. 510 The only thing you need to change is "test-apkdzgmqhj" - which 511 should be replaced with your own Disqus site-id. --> 512 513 <section class="post-full-comments"> 514 <div id="disqus_thread"></div> 515
515<script src="https://utteranc.es/client.js" 516 repo="ramitsurana/ramitsurana.github.io" 517 issue-term="title" 518 theme="github-light" 519 crossorigin="anonymous" 520 async> 521 </script>
521 522 <!--
522<script> 523 var disqus_config = function () { 524 var this_page_url = '/gpt3-part-2'; 525 var this_page_identifier = '/gpt3-part-2'; 526 var this_page_title = 'I tried out GPT3, Here is what I did - Part 2'; 527 }; 528 (function() { 529 var d = document, s = d.createElement('script'); 530 s.src = 'https://ramitsurana-github-io.disqus.com/embed.js'; 531 s.setAttribute('data-timestamp', +new Date()); 532 (d.head || d.body).appendChild(s); 533 })(); 534 </script>
534 --> 535 </section> 536 537 538 </article> 539 540 </div> 541</main> 542 543<!-- Links to Previous/Next posts --> 544<aside class="read-next outer"> 545 <div class="inner"> 546 <div class="read-next-feed"> 547 548 549 550 551 552 <article class="read-next-card" 553 554 style="background-image: url(/assets/images/blog-cover.jpg)" 555 556 > 557 <header class="read-next-card-header"> 558 <small class="read-next-card-header-sitetitle">— Ramit Surana —</small> 559 560 <h3 class="read-next-card-header-title"><a href="/tag/gpt3-chat-transformers-openai/">Gpt3 chat transformers openai</a></h3> 561 562 </header> 563 <div class="read-next-divider"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14.5s2 3 5 3 5.5-2.463 5.5-5.5S21 6.5 18 6.5c-5 0-7 11-12 11C2.962 17.5.5 15.037.5 12S3 6.5 6 6.5s4.5 3.5 4.5 3.5"/></svg> 564</div> 565 <div class="read-next-card-content"> 566 <ul> 567 568 569 570 571 572 573 574 575 576 577 <li><a href="/gpt3-part-1">I tried out GPT3, Here is what I did - Part 1</a></li> 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 </ul> 607 </div> 608 <footer class="read-next-card-footer"> 609 <a href="/tag/gpt3-chat-transformers-openai/"> 610 611 See all 1 posts â 612 613 </a> 614 </footer> 615 </article> 616 617 618 619 <!-- If there's a next post, display it using the same markup included from - partials/post-card.hbs --> 620 621 622 <!-- If there's a previous post, display it using the same markup included from - partials/post-card.hbs --> 623 624 625 626 <article class="post-card post-template"> 627 628 <a class="post-card-image-link" href="/gpt3-part-1"> 629 <div class="post-card-image" style="background-image: url(/assets/images/summit.jpg)"></div> 630 </a> 631 632 <div class="post-card-content"> 633 <a class="post-card-content-link" href="/gpt3-part-1"> 634 <header class="post-card-header"> 635 636 637 638 <span class="post-card-tags">Gpt3 chat transformers openai</span> 639 640 641 642 643 <h2 class="post-card-title">I tried out GPT3, Here is what I did - Part 1</h2> 644 </header> 645 <section class="post-card-excerpt"> 646 647 <p>Analysis and Observations on GPT3</p> 648 649 </section> 650 </a> 651 <footer class="post-card-meta"> 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 <img class="author-profile-image" src="/assets/images/profile-pic-2.jpg" alt="Ramit Surana" /> 670
671 <span class="post-card-author"> 672 <a href="/author/ramitsurana/">Ramit Surana</a> 673 </span> 674 675 676 <span class="reading-time"> 677 678 679 10 min read 680 681 </span> 682 </footer> 683 </div> 684 </article> 685 686 687 688 </div> 689 </div> 690</aside> 691 692<!-- Floating header which appears on-scroll, included from includes/floating-header.hbs --> 693<div class="floating-header"> 694 <div class="floating-header-logo"> 695 <a href="/"> 696 697 <img src="/assets/images/favicon.png" alt="Ramit Surana icon" /> 698 699 <span>Ramit Surana</span> 700 </a> 701 </div> 702 <span class="floating-header-divider">—</span> 703 <div class="floating-header-title">I tried out GPT3, Here is what I did - Part 2</div> 704 <div class="floating-header-share"> 705 <div class="floating-header-share-label">Share this <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> 706 <path d="M7.5 15.5V4a1.5 1.5 0 1 1 3 0v4.5h2a1 1 0 0 1 1 1h2a1 1 0 0 1 1 1H18a1.5 1.5 0 0 1 1.5 1.5v3.099c0 .929-.13 1.854-.385 2.748L17.5 23.5h-9c-1.5-2-5.417-8.673-5.417-8.673a1.2 1.2 0 0 1 1.76-1.605L7.5 15.5zm6-6v2m-3-3.5v3.5m6-1v2"/> 707</svg> 708</div> 709 <a class="floating-header-share-tw" href="https://twitter.com/share?text=I+tried+out+GPT3%2C+Here+is+what+I+did+-+Part+2&url=https://ramitsurana.github.io/gpt3-part-2" 710 onclick="window.open(this.href, 'share-twitter', 'width=550,height=235');return false;"> 711 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 1.125.125.5 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg> 712 713 </a> 714 <a class="floating-header-share-fb" href="https://www.facebook.com/sharer/sharer.php?u=https://ramitsurana.github.io/gpt3-part-2" 715 onclick="window.open(this.href, 'share-facebook','width=580,height=296');return false;"> 716 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M19 6h5V0h-5c-3.86 0-7 3.14-7 7v3H8v6h4v16h6V16h5l1-6h-6V7c0-.542.458-1 1-1z"/></svg> 717 718 </a> 719 </div> 720 <progress class="progress" value="0"> 721 <div class="progress-container"> 722 <span class="progress-bar"></span> 723 </div> 724 </progress> 725</div> 726 727 728<!-- /post --> 729 730<!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --> 731 732 733 <!-- Previous/next page links - displayed on every page --> 734 735 736 <!-- The footer at the very bottom of the screen --> 737 <footer class="site-footer outer"> 738 <div class="site-footer-content inner"> 739 <section class="copyright"><a href="/">Ramit Surana</a> © 2021</section> 740 <section class="poweredby">Proudly published with <a href="https://jekyllrb.com/">Jekyll</a> & 741 <a href="https://pages.github.com/" target="_blank" rel="noopener">GitHub Pages</a> using 742 <a href="https://github.com/jekyller/jasper2" target="_blank" rel="noopener">Jasper2</a></section> 743 <nav class="site-footer-nav"> 744 <a href="/">Latest Posts</a> 745 <a href="https://facebook.com/ramitsurana" target="_blank" rel="noopener">Facebook</a> 746 <a href="https://twitter.com/ramitsurana" target="_blank" rel="noopener">Twitter</a> 747 <a href="https://ghost.org" target="_blank" rel="noopener">Ghost</a> 748 </nav> 749 </div> 750 </footer> 751 752 </div> 753 754 <!-- The big email subscribe modal content --> 755 756 <div id="subscribe" class="subscribe-overlay"> 757 <a class="subscribe-overlay-close" href="#"></a> 758 <div class="subscribe-overlay-content"> 759 760 <h1 class="subscribe-overlay-title">Subscribe to Ramit Surana</h1> 761 <p class="subscribe-overlay-description">Stay up to date! Get all the latest & greatest posts delivered straight to your inbox</p> 762 <form method="post" action="/subscribe/" class=""> 763 <input class="confirm" type="hidden" name="confirm" /><input class="location" type="hidden" name="location" /><input class="referrer" type="hidden" name="referrer" /> 764 765 <div class="form-group"> 766 <input class="subscribe-email" type="email" name="email" placeholder="[email protected]" /> 767 </div>
768 <button class="" type="submit" disabled><span>Subscribe</span></button> 769
769<script type="text/javascript">(function(g,h,o,s,t){h[o]('.location')[s]=h[o]('.location')[s] || g.location.href;h[o]('.referrer')[s]=h[o]('.referrer')[s] || h.referrer;})(window,document,'querySelector','value');</script>
769 770</form> 771 772 </div> 773 </div> 774 775 776 <!-- highlight.js --> 777
777<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.10.0/components/prism-abap.min.js"></script>
777 778
778<script>$(document).ready(function() { 779 $('pre code').each(function(i, block) { 780 hljs.highlightBlock(block); 781 }); 782 });</script>
782 783 784 <!-- jQuery + Fitvids, which makes all video embeds responsive --> 785
785<script 786 src="https://code.jquery.com/jquery-3.2.1.min.js" 787 integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" 788 crossorigin="anonymous"> 789 </script>
789 790
790<script type="text/javascript" src="/assets/js/jquery.fitvids.js"></script>
790 791
791<script type="text/javascript" src="https://demo.ghost.io/assets/js/jquery.fitvids.js?v=724281a32e"></script>
791 792 793 794 <!-- Paginator increased to "infinit" in _config.yml --> 795 <!-- if paginator.posts --> 796 <!--
796<script> 797 var maxPages = parseInt(''); 798 </script>
798 799
799<script src="/assets/js/infinitescroll.js"></script>
799 --> 800 <!-- /endif --> 801 802 803 804 805 <!-- Add Google Analytics --> 806 <!-- Google Analytics Tracking code --> 807
807<script>
vendor: 339 bytes, lines 807-813
807 808 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 809 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 810 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 811 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 812 813 ga('create', '
813UA-71344758-1
vendor: 40 bytes, lines 813-816
813', 'auto'); 814 ga('send', 'pageview'); 815 816
816</script>
816 817 818 819 <!-- The #block helper will pull in data from the #contentFor other template files. In this case, there's some JavaScript which we only want to use in post.hbs, but it needs to be included down here, after jQuery has already loaded. --> 820 821
821<script> 822 823// NOTE: Scroll performance is poor in Safari 824// - this appears to be due to the events firing much more slowly in Safari. 825// Dropping the scroll event and using only a raf loop results in smoother 826// scrolling but continuous processing even when not scrolling 827$(document).ready(function () { 828 // Start fitVids 829 var $postContent = $(".post-full-content"); 830 $postContent.fitVids(); 831 // End fitVids 832 833 var progressBar = document.querySelector('progress'); 834 var header = document.querySelector('.floating-header'); 835 var title = document.querySelector('.post-full-title'); 836 837 var lastScrollY = window.scrollY; 838 var lastWindowHeight = window.innerHeight; 839 var lastDocumentHeight = $(document).height(); 840 var ticking = false; 841 842 function onScroll() { 843 lastScrollY = window.scrollY; 844 requestTick(); 845 } 846 847 function onResize() { 848 lastWindowHeight = window.innerHeight; 849 lastDocumentHeight = $(document).height(); 850 requestTick(); 851 } 852 853 function requestTick() { 854 if (!ticking) { 855 requestAnimationFrame(update); 856 } 857 ticking = true; 858 } 859 860 function update() { 861 var trigger = title.getBoundingClientRect().top + window.scrollY; 862 var triggerOffset = title.offsetHeight + 35; 863 var progressMax = lastDocumentHeight - lastWindowHeight; 864 865 // show/hide floating header 866 if (lastScrollY >= trigger + triggerOffset) { 867 header.classList.add('floating-active'); 868 } else { 869 header.classList.remove('floating-active'); 870 } 871 872 progressBar.setAttribute('max', progressMax); 873 progressBar.setAttribute('value', lastScrollY); 874 875 ticking = false; 876 } 877 878 window.addEventListener('scroll', onScroll, {passive: true}); 879 window.addEventListener('resize', onResize, false); 880 881 update(); 882}); 883</script>
883 884 885 886 887 <!-- Ghost outputs important scripts and data with this tag - it should always be the very last thing before the closing body tag --> 888 <!-- ghost_foot --> 889 890</body> 891</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.