<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[newsletter.param.codes]]></title><description><![CDATA[Essays about engineering, security, books and anything else that catches my eye for a second.]]></description><link>https://newsletter.param.codes</link><image><url>https://substackcdn.com/image/fetch/$s_!9RKw!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F573f6d73-56f8-49c9-9be2-f4afef76672b_500x500.png</url><title>newsletter.param.codes</title><link>https://newsletter.param.codes</link></image><generator>Substack</generator><lastBuildDate>Tue, 21 Apr 2026 07:50:50 GMT</lastBuildDate><atom:link href="https://newsletter.param.codes/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Param Singh]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[me@param.codes]]></webMaster><itunes:owner><itunes:email><![CDATA[me@param.codes]]></itunes:email><itunes:name><![CDATA[Param Singh]]></itunes:name></itunes:owner><itunes:author><![CDATA[Param Singh]]></itunes:author><googleplay:owner><![CDATA[me@param.codes]]></googleplay:owner><googleplay:email><![CDATA[me@param.codes]]></googleplay:email><googleplay:author><![CDATA[Param Singh]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[great by choice]]></title><description><![CDATA[what makes 10x companies different?]]></description><link>https://newsletter.param.codes/p/great-by-choice</link><guid isPermaLink="false">https://newsletter.param.codes/p/great-by-choice</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 13 Jan 2025 12:49:30 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ff4Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>&#8220;great by choice&#8221; by jim collins analyzes companies that have performed vastly better in comparison to their competitors and tries to find common patterns of behaviour among these companies.</p><h2>the key stuff they do different</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ff4Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ff4Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ff4Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg" width="1100" height="649" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:649,&quot;width&quot;:1100,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36000,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ff4Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ff4Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b60488c-538e-480e-9fce-1ca647989fd8_1100x649.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>fanatic discipline</h3><p>this one resonates with me personally because i see it play out in my own life. it's about ruthless consistency rather than sporadic bursts of effort. my running journey illustrates this perfectly: strava's fitness score shows how i've been stuck at 36 for years, cycling through intense periods followed by inactivity. the lesson is clear - consistent, moderate effort would have yielded far better results than my pattern of sporadic intensity.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QkfE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QkfE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 424w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 848w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 1272w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QkfE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png" width="1456" height="644" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:644,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:285912,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QkfE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 424w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 848w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 1272w, https://substackcdn.com/image/fetch/$s_!QkfE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b9c98c-9589-4cde-92eb-5bc7a003642b_2474x1094.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>empirical creativity</h3><p>innovation matters, but the best companies ground their creative decisions in data. take the story of the everest climbing team who faced a critical decision about whether to continue their summit attempt. instead of pushing forward on determination alone, they analyzed the weather data and made the difficult but correct choice to turn back - likely saving their lives in the process.</p><h3>productive paranoia</h3><p>according to the book, bill gates exemplified this quality during microsoft's peak years. even as the company dominated the software industry, he remained intensely focused on potential threats. his persistent concern about the internet's impact led microsoft to pivot at a crucial moment, preventing the company from becoming irrelevant as technology evolved.</p><p>these companies also share an interesting approach to innovation called "firing bullets before cannonballs." rather than making massive bets on untested ideas, they start with small experiments to validate their thinking. only after proving a concept do they commit significant resources. this is also a result of being paranoid but in a good way.</p><h3>level 5 ambition</h3><p>perhaps the most counterintuitive quality: the leaders of these exceptional companies rarely seemed driven by personal wealth or recognition. instead, they possessed a deeper sense of purpose that transcended individual success - a refreshing contrast to today's personality-driven business culture.</p><h2>beyond business</h2><p>what makes these principles particularly valuable is their applicability beyond the corporate world. my running experience isn't just a personal anecdote - it's a perfect illustration of how consistency outperforms sporadic intensity in any endeavor. whether you're building a company, developing a skill, or pursuing a personal goal, the formula remains surprisingly similar: maintain discipline, use data to guide decisions, stay vigilantly aware of risks, and connect your efforts to a larger purpose.</p><p>the real insight isn't that these companies do anything revolutionary. instead, they excel by executing fundamental principles with exceptional consistency and purpose. it's a reminder that sustainable success often comes from doing the basics extraordinarily well rather than chasing the next breakthrough innovation.</p>]]></content:encoded></item><item><title><![CDATA[simple key value server in go]]></title><description><![CDATA[Distributed Systems #2]]></description><link>https://newsletter.param.codes/p/simple-key-value-server-in-go</link><guid isPermaLink="false">https://newsletter.param.codes/p/simple-key-value-server-in-go</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sat, 13 Jul 2024 10:23:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e35cf5ed-26ab-48f9-bbc5-6b850341cf10_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In a <a href="https://newsletter.param.codes/p/mapreduce-from-scratch-in-go">previous post</a>, I went through Lab 1 of the <a href="https://pdos.csail.mit.edu/6.824/index.html">MIT Distributed Systems course</a> implementing MapReduce in Go. In this post, I&#8217;ll quickly go through <a href="https://pdos.csail.mit.edu/6.824/labs/lab-kvsrv.html">lab 2</a>, which had a much simpler assignment: implementing a simple key-value server in go. This was simple enough that I was thinking whether it&#8217;s even worthy of a post or not, but I decided to do a small one anyways.</p><h1>Problem</h1><p>The task is to implement a key/value server with the following specifications:</p><ol><li><p>The server runs on a single machine and maintains an in-memory map of key/value pairs.</p></li><li><p>It should support three types of operations:</p><ul><li><p><strong>Put(key, value)</strong>: Installs or replaces the value for a given key</p></li><li><p><strong>Append(key, arg)</strong>: Appends arg to the existing value of the key and returns the old value</p></li><li><p><strong>Get(key)</strong>: Retrieves the current value for the key</p></li></ul></li><li><p>We should also build a client that can be used to calls the server to execute these operations.</p></li><li><p>Each operation should be executed exactly once, even in the presence of network failures.</p></li><li><p>Edge cases:</p><ul><li><p>Get on a non-existent key should return an empty string.</p></li><li><p>Append to a non-existent key should treat the initial value as an empty string.</p></li></ul></li></ol><h1>Solution</h1><p>Building a first version of this without caring too much about client retries and exactly once execution is pretty simple. We keep a map in memory and make changes to the map as needed.</p><pre><code>type KVServer struct {
&#9;mu            sync.Mutex
&#9;Entries       map[string]string
}

func (kv *KVServer) Get(args *GetArgs, reply *GetReply) {
&#9;kv.mu.Lock()
&#9;defer kv.mu.Unlock()

&#9;if val, exists := kv.Entries[args.Key]; exists {
&#9;&#9;reply.Value = val
&#9;&#9;return
&#9;}
&#9;reply.Value = ""
}

func (kv *KVServer) Put(args *PutAppendArgs, reply *PutAppendReply) {
&#9;kv.mu.Lock()
&#9;defer kv.mu.Unlock()

&#9;kv.Entries[args.Key] = args.Value
&#9;reply.Value = args.Value
}

func (kv *KVServer) Append(args *PutAppendArgs, reply *PutAppendReply) {
&#9;kv.mu.Lock()
&#9;defer kv.mu.Unlock()

&#9;oldValue, exists := kv.Entries[args.Key]
&#9;if exists {
&#9;&#9;kv.Entries[args.Key] = oldValue + args.Value
&#9;&#9;reply.Value = oldValue
&#9;} else {
&#9;&#9;kv.Entries[args.Key] = args.Value
&#9;&#9;reply.Value = ""
&#9;}
}

func MakeKVServer() *KVServer {
&#9;return &amp;KVServer{
&#9;&#9;Entries: make(map[string]string),
&#9;}
}</code></pre><p>The client then makes RPC calls to the server. The lab provides helpers that handle running the server and provide methods for making RPC calls, so this task is also relatively easy.</p><pre><code>func MakeClerk(server *labrpc.ClientEnd) *Clerk {
&#9;ck := new(Clerk)
&#9;ck.server = server
&#9;return ck
}

// fetch the current value for a key.
// returns "" if the key does not exist.
// keeps trying forever in the face of all other errors.
//
// you can send an RPC with code like this:
// ok := ck.server.Call("KVServer.Get", &amp;args, &amp;reply)
//
// the types of args and reply (including whether they are pointers)
// must match the declared types of the RPC handler function's
// arguments. and reply must be passed as a pointer.
func (ck *Clerk) Get(key string) string {
&#9;args := GetArgs{Key: key}

&#9;reply := GetReply{}
&#9;ok := ck.server.Call("KVServer.Get", &amp;args, &amp;reply)
&#9;if ok {
&#9;&#9;return reply.Value
&#9;}
        return ""

}

// shared by Put and Append.
//
// you can send an RPC with code like this:
// ok := ck.server.Call("KVServer."+op, &amp;args, &amp;reply)
//
// the types of args and reply (including whether they are pointers)
// must match the declared types of the RPC handler function's
// arguments. and reply must be passed as a pointer.
func (ck *Clerk) PutAppend(key string, value string, op string) string {
&#9;rpcName := "KVServer." + op

&#9;args := PutAppendArgs{Key: key, Value: value}

&#9;reply := PutAppendReply{}
&#9;ok := ck.server.Call(rpcName, &amp;args, &amp;reply)
&#9;if ok {
&#9;&#9;return reply.Value
&#9;}
        return ""

}

func (ck *Clerk) Put(key string, value string) {
&#9;ck.PutAppend(key, value, "Put")
}

// Append value to key's value and return that value
func (ck *Clerk) Append(key string, value string) string {
&#9;return ck.PutAppend(key, value, "Append")
}</code></pre><p>The only thing that remains is to add some retries and make the server not execute the same request twice. To do this, we start sending a Client ID and a Request ID to the server with each request. For the purposes of the lab, whenever we initialize a new client, we give it a random number as the client ID. For each client, request IDs start with zero and go up by one on each request made.</p><p>Here&#8217;s what the Get and PutAppend methods looks like after we add retries (with sleeps of 100ms between each retry).</p><pre><code>func (ck *Clerk) Get(key string) string {
&#9;args := GetArgs{Key: key, ClientId: ck.clientId, RequestId: ck.requestId}
&#9;ck.requestId++

&#9;for {
&#9;&#9;reply := GetReply{}
&#9;&#9;ok := ck.server.Call("KVServer.Get", &amp;args, &amp;reply)
&#9;&#9;if ok {
&#9;&#9;&#9;return reply.Value
&#9;&#9;}

&#9;&#9;time.Sleep(100 * time.Millisecond)
&#9;}
}

func (ck *Clerk) PutAppend(key string, value string, op string) string {
&#9;rpcName := "KVServer." + op

&#9;args := PutAppendArgs{Key: key, Value: value, ClientId: ck.clientId, RequestId: ck.requestId}
&#9;ck.requestId++

&#9;for {
&#9;&#9;reply := PutAppendReply{}
&#9;&#9;ok := ck.server.Call(rpcName, &amp;args, &amp;reply)
&#9;&#9;if ok {
&#9;&#9;&#9;return reply.Value
&#9;&#9;}

&#9;&#9;time.Sleep(100 * time.Millisecond)
&#9;}

}</code></pre><p>After this, all that remains is making sure the server tracks these request and client IDs and does not execute something multiple times while replying to same request (if the client multiple requests). To track this, we add two maps to the server:</p><pre><code>type KVServer struct {
&#9;mu            sync.Mutex
&#9;Entries       map[string]string
&#9;lastRequestId map[int64]int64  // key: clientId, value: lastRequestId
&#9;appendReplies map[int64]string // key: clientId, value: last reply for Append
}</code></pre><p>The lastRequestId map tracks the last request that the server successfully replied to for each client. Then if we get a request that has an ID lesser than the lastRequestId, we know that we&#8217;ve already executed that request and return data instead of executing the request again.</p><pre><code>func (kv *KVServer) requestAlreadyDone(clientId int64, requestId int64) bool {
&#9;lastRequestId, exists := kv.lastRequestId[clientId]
&#9;if !exists {
&#9;&#9;return false
&#9;}
&#9;return requestId &lt;= lastRequestId
}

func (kv *KVServer) Put(args *PutAppendArgs, reply *PutAppendReply) {
&#9;kv.mu.Lock()
&#9;defer kv.mu.Unlock()

&#9;if kv.requestAlreadyDone(args.ClientId, args.RequestId) {
&#9;&#9;reply.Value = kv.Entries[args.Key]
&#9;&#9;return
&#9;}

&#9;kv.Entries[args.Key] = args.Value
&#9;reply.Value = args.Value
&#9;kv.lastRequestId[args.ClientId] = args.RequestId
}</code></pre><p>We ned the appendReplies map for one specific reason. The Append operation returns the value of the key BEFORE the new value is appended to it. We need to use appendReplies to track this, because this old data will not be available in the Entries map after we&#8217;ve executed the request.</p><pre><code>func (kv *KVServer) Append(args *PutAppendArgs, reply *PutAppendReply) {
&#9;kv.mu.Lock()
&#9;defer kv.mu.Unlock()

&#9;if kv.requestAlreadyDone(args.ClientId, args.RequestId) {
&#9;&#9;reply.Value = kv.appendReplies[args.ClientId]
&#9;&#9;return
&#9;}

&#9;oldValue, exists := kv.Entries[args.Key]
&#9;if exists {
&#9;&#9;kv.Entries[args.Key] = oldValue + args.Value
&#9;&#9;reply.Value = oldValue
&#9;} else {
&#9;&#9;kv.Entries[args.Key] = args.Value
&#9;&#9;reply.Value = ""
&#9;}

&#9;kv.lastRequestId[args.ClientId] = args.RequestId
&#9;kv.appendReplies[args.ClientId] = reply.Value
}</code></pre><p>That&#8217;s it! I ran the provided tests using <code>`go test`</code> to make sure the code does what it&#8217;s supposed to.</p><h2>Fin</h2><p>If you read until here, thank you. This was not the most complicated assignment, but I figured I shouldn&#8217;t skip any assignment. Next up is <a href="https://pdos.csail.mit.edu/6.824/labs/lab-raft.html">Lab 3</a>, which involves implementing <a href="https://pdos.csail.mit.edu/6.824/papers/raft-extended.pdf">Raft</a>, which should require much more depth. See you then!</p><p>As always, if you liked this post and would like to see more, please let me know by leaving a comment. You can also support me by supporting my personal project, <a href="https://www.buymeacoffee.com/blunderfest">blunderfest</a>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/simple-key-value-server-in-go?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/simple-key-value-server-in-go?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share&quot;,&quot;text&quot;:&quot;Share newsletter.param.codes&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share"><span>Share newsletter.param.codes</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[mapreduce from scratch in go]]></title><description><![CDATA[Distributed Systems #1]]></description><link>https://newsletter.param.codes/p/mapreduce-from-scratch-in-go</link><guid isPermaLink="false">https://newsletter.param.codes/p/mapreduce-from-scratch-in-go</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 07 Jul 2024 14:22:17 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cce0bf69-a429-4b26-8827-dca778d35a00_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Now that I&#8217;m working on infrastructure for day job, I figured it would be a good idea for me to learn distributed systems basics. So I&#8217;m going to go through the lectures for <a href="https://www.youtube.com/@6.824">MIT 6.824 Distributed Systems</a> and do the <a href="https://pdos.csail.mit.edu/6.824/index.html">labs</a> for the course. </p><p>In this post, I&#8217;ll go through <a href="https://pdos.csail.mit.edu/6.824/labs/lab-mr.html">the first lab</a>, where the assignment was to implement MapReduce in Go. </p><h1>What is MapReduce?</h1><p>MapReduce is a very popular way to run parallel jobs for processing large datasets easily. The <a href="https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf">original paper</a> by Jeff Dean and Sanjay Ghemawat is worth a read, but I&#8217;ll quickly go through the details and then discuss my implementation.</p><p>Let&#8217;s understand the programming model using the example from the paper: word counts. Our task is to count the occurrences of each unique word across a large collection of text files. To do this, we define a map function and a reduce function that we&#8217;ll pass to the MapReduce framework.</p><h2>Map function</h2><pre><code>type KeyValue struct {
&#9;Key   string
&#9;Value string
}


func Map(filename string, contents string) []KeyValue {
&#9;// function to detect word separators.
&#9;ff := func(r rune) bool { return !unicode.IsLetter(r) }

&#9;// split contents into an array of words.
&#9;words := strings.FieldsFunc(contents, ff)

&#9;kva := []mr.KeyValue{}
&#9;for _, w := range words {
&#9;&#9;kv := mr.KeyValue{w, "1"}
&#9;&#9;kva = append(kva, kv)
&#9;}
&#9;return kva
}</code></pre><p>The Map function is called once for each file of input. The first argument is the name of the input file and the second is the file&#8217;s contents. The return value is a slice of key-value pairs, with the word as the key and &#8220;1&#8221; as the value.</p><h2>Reduce function</h2><pre><code>
func Reduce(key string, values []string) string {
&#9;// return the number of occurrences of this word.
&#9;return strconv.Itoa(len(values))
}
</code></pre><p>The Reduce function is called once for each key generated by the map tasks, meaning that it&#8217;s called once for each unique word. The second parameter to the Reduce function is a slice of ALL the values that the map function generated for the key. So to count the number of times the word occured in all our text files, we can just return the length of the slice passed as the second parameter.</p><h2>How MapReduce uses these functions</h2><p>We provide these functions to the MapReduce framework. Then, the framework has two types of processes: a co-ordinator and a worker. Tasks are completed like this:</p><ol><li><p>The co-ordinator breaks the input into M splits.</p></li><li><p>It then passes each split to a worker that calls map on the split. The intermediate key-value pairs returned by the map function call are written to disk in R splits (R is the number of reduce workers). <strong>This was the Map phase.</strong></p></li><li><p>Once all the map tasks are done, the co-ordinator starts assigning reduce tasks. When a worker is assigned a reduce task by the co-ordinator, it reads all the intermediate data required for the task, sorts it by the intermediate keys so that all occurrences of the same key are grouped together. </p></li><li><p>After sorting, the reduce worker iterates over the sorted intermediate data and for each unique key, calls the reduce function with the key and all the values that the key has. The output is then written to disk. <strong>This was the Reduce phase.</strong></p></li><li><p>When all map and reduce tasks are done, the workers are stopped and the user program can be told that the task has been completed.</p></li></ol><p></p><p>A diagram can explain the flow a little better.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3Z1p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3Z1p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 424w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 848w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 1272w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3Z1p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png" width="518" height="1102.173076923077" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:3098,&quot;width&quot;:1456,&quot;resizeWidth&quot;:518,&quot;bytes&quot;:333925,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3Z1p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 424w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 848w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 1272w, https://substackcdn.com/image/fetch/$s_!3Z1p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d85491c-a094-4c9d-951c-2563ce8086de_1805x3840.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>Implementation</h1><p><em>(Disclaimer: this isn&#8217;t the cleanest code and there is lots of room for improvement, but for a first cut I&#8217;ve tried to keep it understandable.)</em></p><p>The code for all this can be found in `<a href="https://github.com/paramsingh/distributed-systems/blob/master/src/mr/coordinator.go">coordinator.go</a>` and `<a href="https://github.com/paramsingh/distributed-systems/blob/master/src/mr/worker.go">worker.go</a>`. For now, since it&#8217;s only for educational purposes, we assume that both the coordinator and the workers run on the same machine.</p><h2>Coordinator</h2><p>First we define a <code>Task</code> and a <code>Coordinator</code>.</p><pre><code>type TaskStatus int

const (
&#9;NotStarted TaskStatus = iota
&#9;Assigned
&#9;Completed
)

type Task struct {
&#9;taskStatus TaskStatus
&#9;assignedAt time.Time
}

type Coordinator struct {
&#9;mu          sync.Mutex
&#9;Files       []string
&#9;MapTasks    []Task
&#9;ReduceTasks []Task
&#9;done        chan struct{}
}</code></pre><p>A task tracks its current status and when it was assigned to a worker. The assignedAt field is used by the coordinator to see if some worker has not done the task in a while and re-assign to some other worker if needed.</p><p>The coordinator has the following fields:</p><ol><li><p><code>mu</code>: Mutex to ensure thread-safe access to shared data like the MapTasks and ReduceTasks slices</p></li><li><p><code>Files</code>: The input files we&#8217;ll process.</p></li><li><p><code>MapTasks</code>: A slice to track all the Map tasks we need to do</p></li><li><p><code>ReduceTasks</code>: A slice to track all the Reduce tasks </p></li><li><p><code>done</code>: Channel to signal when all tasks are completed </p></li></ol><p>The coordinator has a <code>server()</code> method to start a server that listens for RPC calls from the workers.</p><pre><code>func (c *Coordinator) server() {
&#9;rpc.Register(c)
&#9;rpc.HandleHTTP()
&#9;sockname := coordinatorSock()
&#9;os.Remove(sockname)
&#9;l, e := net.Listen("unix", sockname)
&#9;if e != nil {
&#9;&#9;log.Fatal("listen error:", e)
&#9;}
&#9;go http.Serve(l, nil)
}</code></pre><p>We create a <code>MakeCoordinator</code> method that takes a list of input files and the number of reduce tasks we want to run, starts a coordinator server and returns the coordinator.</p><pre><code>func MakeCoordinator(files []string, nReduce int) *Coordinator {
&#9;c := Coordinator{
&#9;&#9;Files:       files,
&#9;&#9;MapTasks:    make([]Task, len(files)),
&#9;&#9;ReduceTasks: make([]Task, nReduce),
&#9;&#9;done:        make(chan struct{}),
&#9;}
&#9;fmt.Printf("Coordinator: MakeCoordinator\n")
&#9;fmt.Printf("Coordinator: files %v\n", files)
&#9;fmt.Printf("Coordinator: map tasks %v\n", c.MapTasks)
&#9;fmt.Printf("Coordinator: reduce tasks %v\n", c.ReduceTasks)

&#9;c.startPeriodicChecks()
&#9;c.server()
&#9;return &amp;c
}</code></pre><p>(The <code>startPeriodicChecks</code> call checks for tasks that have timed out. We&#8217;ll go into those details later, let&#8217;s first explore the happy path.)</p><h3>GetTask</h3><p>The workers can request the coordinator for a new task using a RPC call to `<code>GetTask</code>`. The interface for this RPC is simple. You ask for a task (no params needed) and get a reply with an input file name, the operation you need to perform (map or reduce) and some metadata like operation number etc.  </p><pre><code>type GetTaskArgs struct {}

type GetTaskReply struct {
&#9;InputFileName   string
&#9;Operation       string
&#9;OperationNumber int
&#9;NMap            int
&#9;NReduce         int
&#9;WaitForTask     bool
}</code></pre><p>The implementation of the GetTask method is also pretty straightforward. </p><ul><li><p>Look for map tasks, if you find any, assign and return.</p></li><li><p>If we didn&#8217;t find a map task to assign but all map tasks have not been completed by workers yet, tell the worker to wait for a while. Important note: we cannot assign a reduce task in this case, because we need all map tasks to have finished before we can move on to the reduce phase.</p></li><li><p>If all map tasks have been completed, try to find a reduce task. If found, assign and return.</p></li><li><p>Again, all reduce tasks are assigned, but not all of them have finished, tell the worker to wait. This is important because a worker who&#8217;s assigned a task might fail and the task would have to be reassigned to another worker.</p></li><li><p>If all reduce tasks have finished, all the work is done! </p></li></ul><p>Another important note: we need to use the mutex to acquire a lock before making changes to our <code>MapTasks</code> and <code>ReduceTasks</code> slices, otherwise different workers asking for tasks at the same time might cause race conditions.</p><pre><code>var ErrAllTasksCompleted = fmt.Errorf("all tasks completed")

func (c *Coordinator) GetTask(args *GetTaskArgs, reply *GetTaskReply) error {
&#9;c.mu.Lock()
&#9;defer c.mu.Unlock()

&#9;if i, task := c.findAvailableTask(c.MapTasks); task != nil {
&#9;&#9;c.assignTask("map", i, task, reply)
&#9;&#9;return nil
&#9;}

&#9;if !c.allTasksCompleted(c.MapTasks) {
&#9;&#9;reply.WaitForTask = true
&#9;&#9;fmt.Println("No map tasks available, worker should wait")
&#9;&#9;return nil
&#9;}

&#9;fmt.Println("All map tasks completed, looking for reduce tasks")

&#9;if i, task := c.findAvailableTask(c.ReduceTasks); task != nil {
&#9;&#9;c.assignTask("reduce", i, task, reply)
&#9;&#9;return nil
&#9;}

&#9;if c.allTasksCompleted(c.ReduceTasks) {
&#9;&#9;return ErrAllTasksCompleted
&#9;}

&#9;reply.WaitForTask = true
&#9;fmt.Println("No reduce tasks available, worker should wait")
&#9;return nil
}

func (c *Coordinator) findAvailableTask(tasks []Task) (int, *Task) {
&#9;for i, task := range tasks {
&#9;&#9;if task.taskStatus == NotStarted {
&#9;&#9;&#9;return i, &amp;tasks[i]
&#9;&#9;}
&#9;}
&#9;return 0, nil
}

func (c *Coordinator) assignTask(operation string, index int, task *Task, reply *GetTaskReply) {
&#9;reply.Operation = operation
&#9;reply.OperationNumber = index
&#9;reply.NMap = len(c.MapTasks)
&#9;reply.NReduce = len(c.ReduceTasks)
&#9;reply.WaitForTask = false
&#9;task.taskStatus = Assigned
&#9;task.assignedAt = time.Now()

&#9;if operation == "map" {
&#9;&#9;reply.InputFileName = c.Files[index]
&#9;}
}
</code></pre><h3>MarkTaskCompleted</h3><p>The coordinator exposes a <code>MarkTaskCompleted</code> RPC, which the workers call as soon as they finish a task they were assigned.</p><pre><code>type MarkTaskCompletedArgs struct {
&#9;Operation       string
&#9;OperationNumber int
}

type MarkTaskCompletedReply struct{}

func (c *Coordinator) MarkTaskCompleted(args *MarkTaskCompletedArgs, reply *MarkTaskCompletedReply) error {
&#9;c.mu.Lock()
&#9;defer c.mu.Unlock()
&#9;if args.Operation == "map" {
&#9;&#9;c.MapTasks[args.OperationNumber].taskStatus = Completed
&#9;&#9;return nil
&#9;} else if args.Operation == "reduce" {
&#9;&#9;c.ReduceTasks[args.OperationNumber].taskStatus = Completed
&#9;&#9;return nil
&#9;}
&#9;return fmt.Errorf("invalid operation")
}</code></pre><h2>Worker </h2><p>Now that we have an understanding of the coordinator, let&#8217;s go through the worker. A worker spins up and starts requesting tasks. Once it gets assigned a task, it performs the task and tells the coordinator that the task was done. Then it asks for another task. It does this until it hears from the coordinator that there are no more tasks to do.</p><pre><code>func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string) {
&#9;for {
&#9;&#9;task, taskExists := GetTask()
&#9;&#9;if !taskExists {
&#9;&#9;&#9;break
&#9;&#9;}
&#9;&#9;if task.WaitForTask {
&#9;&#9;&#9;// sleep  before trying to get a new task
&#9;&#9;&#9;time.Sleep(500 * time.Millisecond)
&#9;&#9;&#9;continue
&#9;&#9;}
&#9;&#9;if task.Operation == "map" {
&#9;&#9;&#9;handleMapTask(task, mapf)
&#9;&#9;} else if task.Operation == "reduce" {
&#9;&#9;&#9;handleReduceTask(task, reducef)
&#9;&#9;} else {
&#9;&#9;&#9;log.Fatalf("unknown operation: %v", task.Operation)
&#9;&#9;&#9;panic(fmt.Errorf("unknown operation: %v", task.Operation))
&#9;&#9;}

&#9;&#9;MarkTaskCompleted(task.Operation, task.OperationNumber)
&#9;}
}</code></pre><p>A few things to note:</p><ol><li><p>The map and reduce functions are functions that the user provides. This is the point of the framework. </p></li><li><p>If the worker is told to wait for a while, it sleeps and then tries again.</p></li></ol><p>Both the <code>GetTask</code> and <code>MarkTaskCompleted</code> functions make RPC calls to the coordinator.</p><pre><code>// send an RPC request to the coordinator, wait for the response.
// usually returns true.
// returns false if something goes wrong.
func call(rpcname string, args interface{}, reply interface{}) bool {
&#9;sockname := coordinatorSock()
&#9;c, err := rpc.DialHTTP("unix", sockname)
&#9;if err != nil {
&#9;&#9;log.Fatal("dialing:", err)
&#9;}
&#9;defer c.Close()

&#9;err = c.Call(rpcname, args, reply)
&#9;if err == nil {
&#9;&#9;return true
&#9;}

&#9;fmt.Println(err)
&#9;return false
}

func MarkTaskCompleted(operation string, operationNumber int) {
&#9;args := MarkTaskCompletedArgs{
&#9;&#9;Operation:       operation,
&#9;&#9;OperationNumber: operationNumber,
&#9;}
&#9;reply := MarkTaskCompletedReply{}
&#9;ok := call("Coordinator.MarkTaskCompleted", &amp;args, &amp;reply)
&#9;if !ok {
&#9;&#9;fmt.Printf("call failed!\n")
&#9;}
}

func GetTask() (*GetTaskReply, bool) {
&#9;args := GetTaskArgs{}
&#9;reply := GetTaskReply{}
&#9;ok := call("Coordinator.GetTask", &amp;args, &amp;reply)
&#9;if ok {
&#9;&#9;return &amp;reply, true
&#9;} else {
&#9;&#9;fmt.Printf("call failed!\n")
&#9;&#9;return nil, false
&#9;}
}</code></pre><p>The other two important parts of the worker are <code>handleMapTask</code> and <code>handleReduceTask</code>. As the names signify, these handle map and reduce tasks respectively.</p><h3>Map operation handler</h3><p>The handleMapTask takes the input file, calls the map function on it. Here the key is the filename and the value is the entire content of the file. This gives us back a slice of intermediate keys and values. For each intermediate key, we write the key-value pair to a particular file based on what reduce task should handle that key. </p><pre><code>func handleMapTask(task *GetTaskReply, mapf func(string, string) []KeyValue) {
&#9;fmt.Printf("Map task received...\n")
&#9;fmt.Printf("filename: %v\n", task.InputFileName)
&#9;fileName := task.InputFileName
&#9;contents, err := os.ReadFile(fileName)
&#9;if err != nil {
&#9;&#9;log.Fatalf("cannot read %v", fileName)
&#9;&#9;panic(err)
&#9;}

&#9;kva := mapf(fileName, string(contents))

&#9;filecontentsmap := make(map[string]string)
&#9;for _, kv := range kva {
                reduceTaskNumberForKey := ihash(kv.Key) % task.NReduce
&#9;&#9;outputFileName := fmt.Sprintf("mr-%d-%d", task.OperationNumber, reduceTaskNumberForKey)
&#9;&#9;output := filecontentsmap[outputFileName]
&#9;&#9;filecontentsmap[outputFileName] = fmt.Sprintf("%s%s %s\n", output, kv.Key, kv.Value)
&#9;}

&#9;// ... write to output files ...

&#9;fmt.Printf("Map task completed: %v\n", task.InputFileName)
}</code></pre><p>The important parts of this code are:</p><pre><code>kva := mapf(fileName, string(contents))</code></pre><p>This calls the map function for the input file.</p><pre><code>filecontentsmap := make(map[string]string)
for _, kv := range kva {
&#9;outputFileName := fmt.Sprintf("mr-%d-%d", task.OperationNumber, ihash(kv.Key)%task.NReduce)
&#9;output := filecontentsmap[outputFileName]
&#9;filecontentsmap[outputFileName] = fmt.Sprintf("%s%s %s\n", output, kv.Key, kv.Value)
}</code></pre><p>This code creates a map that contains the content for each intermediate output file. These intermediate output files are inputs for the reduce tasks. </p><p>This is the part that assigns each key to a reduce task based on the total number of reduce tasks we have. </p><pre><code>reduceTaskNumberForKey := ihash(kv.Key) % task.NReduce</code></pre><h3>Reduce operation handler</h3><p>The Reduce task handler reads ALL The input files created for it to create a list of intermediate keys.</p><pre><code>intermediate := []KeyValue{}

for i := 0; i &lt; task.NMap; i++ {
        filename := fmt.Sprintf("mr-%d-%d", i, task.OperationNumber)
&#9;kva := parseKeyValuePairsFromFile(filename)
&#9;fmt.Printf("reduce task %v: got intermediate keys from %v\n", task.OperationNumber, filename)
&#9;intermediate = append(intermediate, kva...)
}
</code></pre><p>This gives us all the key value pairs that the reduce task works on. This list is then sorted, based on the key.</p><pre><code>sort.Sort(ByKey(intermediate))</code></pre><p>Now, for each key, a list of all values is created and reduce is called with the key and these values.</p><pre><code>for i := 0; i &lt; len(intermediate); {
        j := i + 1
&#9;for j &lt; len(intermediate) &amp;&amp; intermediate[j].Key == intermediate[i].Key {
&#9;&#9;j++
&#9;}

&#9;values := []string{}
&#9;for k := i; k &lt; j; k++ {
&#9;&#9;values = append(values, intermediate[k].Value)
&#9;}

&#9;output := reducef(intermediate[i].Key, values)
        // ... write output and move on to next key
}</code></pre><p>Now we have all the parts to get a basic word count running.</p><h3>Worker failure</h3><p>The coordinator also has a thread running that checks for tasks that have been assigned for a long time but not finished. After a timeout, it assumes that the worker that was assigned the task has failed and marks the task as ready for re-assignment.</p><p>We use a ticker to do this. </p><pre><code>func (c *Coordinator) startPeriodicChecks() {
&#9;ticker := time.NewTicker(10 * time.Second)
&#9;go func() {
&#9;&#9;for {
&#9;&#9;&#9;select {
&#9;&#9;&#9;case &lt;-ticker.C:
&#9;&#9;&#9;&#9;c.checkTimeoutsAndReassignTasks()
&#9;&#9;&#9;case &lt;-c.done:
&#9;&#9;&#9;&#9;ticker.Stop()
&#9;&#9;&#9;&#9;return
&#9;&#9;&#9;}
&#9;&#9;}
&#9;}()
}</code></pre><p>The checkTimeoutAndReassignTasks is simple to implement as we track when the task was assigned for each task.</p><pre><code>func (c *Coordinator) checkTimeoutsAndReassignTasks() {
&#9;c.mu.Lock()
&#9;defer c.mu.Unlock()

&#9;for i, task := range c.MapTasks {
&#9;&#9;if task.taskStatus == Assigned &amp;&amp; time.Since(task.assignedAt) &gt; 10*time.Second {
&#9;&#9;&#9;c.MapTasks[i] = Task{}
&#9;&#9;}
&#9;}

&#9;for i, task := range c.ReduceTasks {
&#9;&#9;if task.taskStatus == Assigned &amp;&amp; time.Since(task.assignedAt) &gt; 10*time.Second {
&#9;&#9;&#9;c.ReduceTasks[i] = Task{}
&#9;&#9;}
&#9;}
}</code></pre><p>That&#8217;s it! We made it through implementing MapReduce in Go!</p><h1>Epilogue</h1><p>There&#8217;s some things to improve in the code. A good exercise for the future for me is to get this code to run on multiple machines with some shared storage, as that&#8217;s how this would run in a real scenario. </p><p>If you liked this post and would like to see more, please let me know by leaving a comment. You can also support me by supporting my personal project, <a href="https://www.buymeacoffee.com/blunderfest">blunderfest</a>.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption"> Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Robert Oppenheimer: A Life Inside the Center]]></title><description><![CDATA[Excerpts from a great biography.]]></description><link>https://newsletter.param.codes/p/robert-oppenheimer-a-life-inside</link><guid isPermaLink="false">https://newsletter.param.codes/p/robert-oppenheimer-a-life-inside</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 05 Jun 2023 00:01:10 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!rWNt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rWNt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rWNt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rWNt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1909967,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rWNt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!rWNt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0bf4f58-005c-4338-addc-1318ac378cde_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I finished reading a great biography of Robert Oppenheimer, the father of the atomic bomb. Oppenheimer was the director of the Los Alamos laboratory that designed the first atomic bombs dropped on Hiroshima and Nagasaki, ending the second world war.</p><p>The book contains a large number of amazing tidbits, especially because Oppenheimer&#8217;s personality is so interesting. It goes through his disturbingly weird behaviour as a college student, his success as the director of Los Alamos and his embarrassing loss of security clearance when the US Government suspected him of being a communist spy.</p><p>I&#8217;ve been sharing a few of the most interesting highlights on <a href="https://twitter.com/iliekcomputers">Twitter</a>, but I thought I&#8217;ll share a few of them here too.</p><div><hr></div><h3>Initial craziness</h3><p>Early in his career, Oppenheimer tried to poison his Ph.D. advisor out of jealousy. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aWOr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aWOr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 424w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 848w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 1272w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aWOr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png" width="1154" height="490" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:490,&quot;width&quot;:1154,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:208869,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aWOr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 424w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 848w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 1272w, https://substackcdn.com/image/fetch/$s_!aWOr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd04ebd0d-6539-4fe5-850d-dbc2b0c9f197_1154x490.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>He also tried to strangle his best friend out of jealousy, and had done multiple things that should put anyone in prison for a long time.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hPUE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hPUE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 424w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 848w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 1272w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hPUE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png" width="1222" height="972" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/aa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:972,&quot;width&quot;:1222,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:352115,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hPUE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 424w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 848w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 1272w, https://substackcdn.com/image/fetch/$s_!hPUE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faa3e90dd-e048-4e81-9c7a-602d0133f7fb_1222x972.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For some people, he was not very fun to work.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5snm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5snm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 424w, https://substackcdn.com/image/fetch/$s_!5snm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 848w, https://substackcdn.com/image/fetch/$s_!5snm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 1272w, https://substackcdn.com/image/fetch/$s_!5snm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5snm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png" width="1176" height="644" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:644,&quot;width&quot;:1176,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:258379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5snm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 424w, https://substackcdn.com/image/fetch/$s_!5snm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 848w, https://substackcdn.com/image/fetch/$s_!5snm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 1272w, https://substackcdn.com/image/fetch/$s_!5snm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1291009c-3740-45bd-83cb-c98a8d722c20_1176x644.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>The bomb</h2><p>There was debate about whether any publication of nuclear chain reactions should be stopped for safety. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q7Xq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q7Xq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 424w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 848w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 1272w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q7Xq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png" width="1196" height="774" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:774,&quot;width&quot;:1196,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:321582,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q7Xq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 424w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 848w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 1272w, https://substackcdn.com/image/fetch/$s_!q7Xq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff42696cd-15d2-4e01-ae8f-85e530f51ee1_1196x774.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Information about the atomic bomb was declassified was that a trucker reverse engineered the bomb in 2004.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MnZ7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MnZ7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 424w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 848w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 1272w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MnZ7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png" width="1210" height="442" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:442,&quot;width&quot;:1210,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:174558,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MnZ7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 424w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 848w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 1272w, https://substackcdn.com/image/fetch/$s_!MnZ7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e2fc111-d48c-43a7-8c15-05347759443e_1210x442.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>The book has a lot more interesting stuff, these examples only scratch the surface. If you read it, let me know what you think!<br></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/robert-oppenheimer-a-life-inside?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/robert-oppenheimer-a-life-inside?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Continuing simulations.]]></title><description><![CDATA[Dev log for my implementation of generative simulacra.]]></description><link>https://newsletter.param.codes/p/continuing-simulations</link><guid isPermaLink="false">https://newsletter.param.codes/p/continuing-simulations</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 21 May 2023 18:30:59 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!OgsH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OgsH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OgsH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OgsH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1585406,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OgsH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!OgsH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bb5f6d8-175a-4fe0-b59c-7149ae255fe4_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Last week, I mentioned that I was working through and <a href="https://github.com/paramsingh/simulacra">implementing</a> the paper <a href="https://arxiv.org/abs/2304.03442">&#8220;Generative Agents: Interactive Simulacra of Human Behavior.&#8221;</a> I&#8217;ve made some progress that I thought I would log here.</p><h2>Background</h2><p>The paper implements &#8220;generative agents&#8221;, realistic simulations of humans living in a town called Smallville. These agents act like autonomous entities with the ability to perform human-like activities, such as brushing their teeth, going to work, or grabbing lunch. </p><p>The paper describes the architecture of these agents as containing three major components:</p><ol><li><p>Memory</p></li><li><p>Reflection</p></li><li><p>Planning</p></li></ol><p></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OejQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OejQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 424w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 848w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 1272w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OejQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png" width="597" height="215" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:215,&quot;width&quot;:597,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52979,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OejQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 424w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 848w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 1272w, https://substackcdn.com/image/fetch/$s_!OejQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6fa25a92-fedb-47d1-a7ae-7668c6a0123f_597x215.png 1456w" sizes="100vw"></picture><div></div></div></a><figcaption class="image-caption">The architecture of the agents.</figcaption></figure></div><h3>Memory</h3><p>Each agent has a memory stream, which is a list of things that the agent has experienced. These memories are stored as a list, and a retrieval function is implemented which takes a particular situation and returns a subset of the agent&#8217;s memories that LLM should use to decide the agent&#8217;s reaction to that situation.</p><p>The retrieval method uses three factors to decide if a particular memory should be sent to the language model. </p><ol><li><p>Recency: How old the memory is. </p></li><li><p>Relevance: How relevant a particular memory is to the situation. The paper uses OpenAI embeddings to calculate this.</p></li><li><p>Importance: For each memory, the paper asks the LLM to rate it between 1-10 in terms of the importance of the memory. 1 is purely mundane (e.g., brushing teeth, making bed) and 10 is extremely poignant (e.g., a break up, college acceptance).</p></li></ol><p>Then we add up these three factors to get a score for each memory.</p><p>The code for this is in <a href="https://github.com/paramsingh/simulacra/blob/main/memory.py">memory.py</a>.</p><h3>Reflection</h3><p>The agents also have the ability to reflect on their experiences. These reflections are also saved in the memory stream, and they help the agents make more realistic choices in the long term as they get time to &#8220;think&#8221; about their experiences.</p><p>The paper makes the agents reflect on their recent experiences if the sum of the importances of the memories gets higher than a particular threshold.</p><p>The code for this is in <a href="https://github.com/paramsingh/simulacra/blob/main/agent.py">agent.py</a>.</p><h3>Planning</h3><p>The paper uses the LLM to get the agents to make plans for their future actions. These plans can be as detailed as needed. I&#8217;ve currently only added a high-level broad strokes planning component but I intend to improve this as things go on.</p><h2>So, how does it work?</h2><p>Not that good so far. I tried simulating a single agent, &#8220;Robinson Crusoe&#8221;, a castaway on a remote island. There are some issues where the agent keeps doing the same thing over and over for me. </p><h2>Next steps</h2><p>I&#8217;m going to continue improving the prompts and see if there are some obvious bugs I need to fix. After that, I want to start a small graphical interface so that the agents can move around and interact with their environment. This is done using <a href="https://github.com/photonstorm/phaser">Phaser</a> in the paper.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Thinking about simulations.]]></title><description><![CDATA[Thoughts on simulations and their impact in the near/far future.]]></description><link>https://newsletter.param.codes/p/thinking-about-simulations</link><guid isPermaLink="false">https://newsletter.param.codes/p/thinking-about-simulations</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 14 May 2023 18:31:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mQq1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mQq1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mQq1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1472024,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!mQq1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!mQq1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc80334d-fa90-4a0d-b2b6-7f124e9248fa_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;m fascinated by the paper <a href="https://arxiv.org/abs/2304.03442">&#8220;</a><strong><a href="https://arxiv.org/abs/2304.03442">Generative Agents: Interactive Simulacra of Human Behavior.&#8221;</a> </strong>It&#8217;s been on my radar to read in depth for a while, but I only got a chance to do it this week. </p><p>Let&#8217;s go through what the paper does, on a high level. In the paper, the authors create a small digital town populated by twenty-five 'agents&#8217;, each having their own digital life. They're not just static figures, but autonomous entities with the ability to perform human-like activities, such as brushing their teeth, going to work, or grabbing lunch.</p><p>Each agent possesses a 'memory' - a record of their experiences, decisions, and interactions. This memory is not just a passive data bank; it informs the agent's actions and choices. They also have a mechanism for 'reflection,' which means they can use their past experiences to influence their future actions.</p><p>So, what's the result? The agents can plan and decide what they want to do next based on their 'lived' experiences. They can react to each other, learn from what happens around them, and even plan events like a Valentine's Day party or an election campaign. It's like watching a digital community live out their lives, all within the bounds of a computer program.</p><p>This gave me very strong <a href="https://en.wikipedia.org/wiki/The_Truman_Show">&#8220;The Truman Show&#8221;</a> vibes. Watching realistic simulations of people living their lives would be straight out of a science fiction movie or book. Sadly, the authors do not really provide code that I&#8217;m able to run, so my current side-project is implementing this myself. </p><p>Every time I see something like this, it makes me think that consumer media is going to change forever very soon. If these simulations get more and more convincing, there is nothing stopping me from creating a character in the Game of Thrones universe who has an action-packed life and watching them 24/7. There is no need to wait ten years for George R.R. Martin to write 1000 pages.</p><p>Of course, there&#8217;s a huge caveat here that no AI is as good as George at crafting a good story right now. Still, it&#8217;s a future to look forward to.</p><p>But beyond revolutionizing entertainment, these simulations raise existential questions, reminding me of <a href="https://www.simulation-argument.com/simulation.pdf">Nick Bostrom&#8217;s simulation theory</a>.</p><p>The entire paper thinking about simulations is interesting to read, but I&#8217;ll just quote the conclusion here:</p><blockquote><p>A technologically mature &#8220;posthuman&#8221; civilization would have enormous computing power. Based on this empirical fact, the simulation argument shows that <em>at least one</em> of the following propositions is true: (1) The fraction of human-level civilizations that reach a posthuman stage is very close to zero; (2) The fraction of posthuman civilizations that are interested in running ancestor-simulations is very close to zero; (3) The fraction of all people with our kind of experiences that are living in a simulation is very close to one.</p><p>If (1) is true, then we will almost certainly go extinct before reaching posthumanity. If (2) is true, then there must be a strong convergence among the courses of advanced civilizations so that virtually none contains any relatively wealthy individuals who desire to run ancestor-simulations and are free to do so. If (3) is true, then we almost certainly live in a simulation. In the dark forest of our current ignorance, it seems sensible to apportion one&#8217;s credence roughly evenly between (1), (2), and (3).</p><p>Unless we are now living in a simulation, our descendants will almost certainly never run an ancestor-simulation. </p></blockquote><p>Thinking about each of these propositions is important.</p><ul><li><p>If (1) is true, we&#8217;re facing a grim future, never making it past our current limitations. My personal optimism makes it hard for me to accept this as our fate.</p></li><li><p>(2) is a little counterintuitive because it implies that civilizations will just not be interested in performing these simulations, when we can see in our real world, there is huge amounts of interest.</p></li><li><p>But if (1) and (2) are not true, (3) implies that there is a huge probability that we&#8217;re living in a simulation, run by an advanced civilization.</p></li></ul><p>So what if we do live in a simulation?</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Embeddings and latent factors]]></title><description><![CDATA[Magical vectors that blow my mind.]]></description><link>https://newsletter.param.codes/p/embeddings-and-latent-factors</link><guid isPermaLink="false">https://newsletter.param.codes/p/embeddings-and-latent-factors</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 30 Apr 2023 18:30:12 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!YFjy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YFjy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YFjy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YFjy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1078552,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YFjy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!YFjy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b9df7-3881-4e50-8b19-1925aaee71c4_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s talk about embeddings because they&#8217;re cool. The first time I came across embeddings was when I was building <a href="https://newsletter.param.codes/p/askyc">AskYC</a>. To build AskYC, I converted the text from the transcriptions of the YC YouTube channel videos into vectors called embeddings using OpenAI&#8217;s API. </p><p>The magical thing here is that the distance between these vectors is equivalent to semantic difference between the sentences. This is quite amazing. At that point, I didn&#8217;t really understand how any of this worked. However, now I think I have some intuition for how they work, thanks to this <a href="https://github.com/fastai/fastbook/blob/master/08_collab.ipynb">chapter</a> of <a href="https://www.amazon.com/Deep-Learning-Coders-fastai-PyTorch/dp/1492045527">Deep Learning for Coders</a>. </p><p>An embedding is a mapping of a discrete variable to a point in a vector space. Let&#8217;s think about this in the context of collaborative filtering. Collaborative filtering is a technique used to create recommender systems. On a high level, here&#8217;s how it works:</p><ol><li><p>We have a dataset that contains users and their ratings for particular items (for the sake of this post, we&#8217;ll assume items are movies).</p></li><li><p>From this dataset, we try to learn which users are similar to each other and then use that to recommend new items to users.</p></li></ol><p>In this case, we create vectors for each user and each item. We get to choose how many parameters we want in these vectors. The process of creating these vectors (or training) is simple gradient descent. </p><ol><li><p>Initialize vectors with random values.</p></li><li><p>Calculate predictions of ratings for each user and item.</p></li><li><p>Use these predictions and the actual values to calculate a loss.</p></li><li><p>Use this loss to improve your vectors.</p></li></ol><p>Each value in these vectors will eventually represent a particular latent factor. For example, the second value in each movie vector might be directly proportional to how much action there is in the movie. These latent factors are picked up by our model during the training process, which is amazing. At this point, we can calculate the distance between two movie vectors and it&#8217;s a good estimate of how similar the two movies are.</p><p>So on a high level, this is how embeddings work. As a software engineer who&#8217;s mostly experienced with concrete problems and solutions, it is a little hard for me to internalise that we know the process with which how we create these embeddings, but the latent factors just emerge automatically. </p><div><hr></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/embeddings-and-latent-factors?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/embeddings-and-latent-factors?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/embeddings-and-latent-factors/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/embeddings-and-latent-factors/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Decision trees and random forests]]></title><description><![CDATA[Introduction to some pretty simple and intuitive classification algorithms]]></description><link>https://newsletter.param.codes/p/decision-trees-and-random-forests</link><guid isPermaLink="false">https://newsletter.param.codes/p/decision-trees-and-random-forests</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 23 Apr 2023 18:30:18 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AGZd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AGZd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AGZd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1331620,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AGZd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!AGZd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa886bd4a-45ed-4d49-8fa4-92238b303c1d_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Decision Trees</h3><p>Decision trees are pretty intuitive. </p><p>Suppose we have tabular data (rows and columns) that we&#8217;d like to put into categories. We start by taking a binary split of your data on the most important column. For example: if we&#8217;re categorising cars into luxury vs non-luxury, maybe we should start with the price?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kuXr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kuXr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 424w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 848w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 1272w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kuXr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png" width="504" height="391.0344827586207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:495,&quot;width&quot;:638,&quot;resizeWidth&quot;:504,&quot;bytes&quot;:41425,&quot;alt&quot;:&quot;Decision tree with 2 leaf nodes&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Decision tree with 2 leaf nodes" title="Decision tree with 2 leaf nodes" srcset="https://substackcdn.com/image/fetch/$s_!kuXr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 424w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 848w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 1272w, https://substackcdn.com/image/fetch/$s_!kuXr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac3cdcaa-1bc5-48ae-b8f2-9376ae3af42f_638x495.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This model will probably work really well for good values of X.</figcaption></figure></div><p>This is the simplest decision tree. We can keep splitting down the nodes based on different columns to make the tree consider more columns. For example, perhaps there are expensive cars being sold by a manufacturer that&#8217;s not considered legacy. We could add a few nodes for that.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c2bn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c2bn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 424w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 848w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 1272w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c2bn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png" width="524" height="526.5375302663439" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:830,&quot;width&quot;:826,&quot;resizeWidth&quot;:524,&quot;bytes&quot;:239445,&quot;alt&quot;:&quot;A larger decision tree&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A larger decision tree" title="A larger decision tree" srcset="https://substackcdn.com/image/fetch/$s_!c2bn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 424w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 848w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 1272w, https://substackcdn.com/image/fetch/$s_!c2bn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F71d4d68a-482b-46ee-8dd6-7a16987ea22a_826x830.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A larger decision tree.</figcaption></figure></div><p>The key thing here is choosing the columns and values to split by correctly. In order to choose a good split, we should create a score metric and then just find the split that has the best score. There are a <a href="https://en.wikipedia.org/wiki/Decision_tree_learning#Metrics">number of metrics</a> that can be used.</p><p>scikit-learn has a decision tree class that does all this for us in a few lines of code. Creating a decision tree is as simple as:</p><pre><code>from sklearn.tree import DecisionTreeClassifier
m = DecisionTreeClassifier(min_samples_leaf=25).fit(trn_xs, trn_ys)</code></pre><div><hr></div><h3>Random Forests</h3><p>Random forests are groups of decision trees. In most cases, it&#8217;s hard to create good decision trees without overfitting on the training data. However, we can create a large number of decision trees and take their average. This is known as <a href="https://en.wikipedia.org/wiki/Bootstrap_aggregating">bagging</a>.</p><p>Each tree is trained on a random subset of the original training data. The high-level idea is that if we take the average of a large number of predictions from unrelated models, the errors will average out to zero and the prediction will be closer to the true value.</p><p>It&#8217;s very easy to create random forests using scikit-learn.</p><pre><code>from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(100, min_samples_leaf=5)
rf.fit(trn_xs, trn_y);</code></pre><div><hr></div><p>Both these models are relatively simple but still lead to good results many times. Another thing that decision trees or random forests can be helpful for is exploring our data. We can understand which features are more important and which less from the decision trees we create.</p><div><hr></div><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/decision-trees-and-random-forests?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/decision-trees-and-random-forests?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Infinite adventures with AI]]></title><description><![CDATA[I&#8217;ve been building adventures.param.codes for the last few weeks.]]></description><link>https://newsletter.param.codes/p/infinite-adventures-with-ai</link><guid isPermaLink="false">https://newsletter.param.codes/p/infinite-adventures-with-ai</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 16 Apr 2023 16:37:12 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LjJA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LjJA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LjJA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LjJA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:779960,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LjJA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!LjJA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd01121c0-f079-4efe-b619-e0a0486f845a_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I&#8217;ve been building <a href="https://adventures.param.codes">adventures.param.codes</a> for the last few weeks. I only realized today that I hadn&#8217;t shared it on this newsletter. So this week&#8217;s post is a quick introduction to what it is, what I like about it and what things I&#8217;m excited to add to it!</p><p>Adventures is a website to play GPT-3 directed text based adventure games (ala Zork). Each day, GPT-4 generates a new starting prompt. This prompt is shared by everyone throughout the day. But from there, things can go anywhere. You make choices and then GPT-3 writes the story from there. </p><p>All this is accompanied by Dall-E 2 generated images, to make things more easily imaginable.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nrFJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nrFJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nrFJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg" width="994" height="467" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:467,&quot;width&quot;:994,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77553,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nrFJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nrFJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa56aa990-8929-48a3-b96e-44f4968ad65d_994x467.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nqkM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nqkM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nqkM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg" width="952" height="368" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:368,&quot;width&quot;:952,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53095,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nqkM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nqkM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1880be4f-f5fc-4b95-8679-a1897a280f84_952x368.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Currently, I&#8217;m working on making it easy to share the stories that get created. Here&#8217;s a sneak peek of a video created from one of the stories I played through:</p><div id="youtube2-fGgWFbd16f4" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;fGgWFbd16f4&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/fGgWFbd16f4?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>There are lots of things to improve here, but I&#8217;m quite excited by the fact that AI has enabled me to create such media. Hope you like it too, let me know what you think!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/infinite-adventures-with-ai?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/infinite-adventures-with-ai?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[The Making of Prince of Persia]]></title><description><![CDATA[Jordan Mechner's journal is the best thing I've read this year (so far).]]></description><link>https://newsletter.param.codes/p/the-making-of-prince-of-persia</link><guid isPermaLink="false">https://newsletter.param.codes/p/the-making-of-prince-of-persia</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 10 Apr 2023 00:01:12 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4mJG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4mJG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4mJG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4mJG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:823588,&quot;alt&quot;:&quot;a programmer developing a game on his apple ii, blue background, pixel art &quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="a programmer developing a game on his apple ii, blue background, pixel art " title="a programmer developing a game on his apple ii, blue background, pixel art " srcset="https://substackcdn.com/image/fetch/$s_!4mJG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!4mJG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d01df5c-2d97-40c3-88b0-3e0e030587a7_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>(<strong>Programming note upfront</strong>: I missed last week&#8217;s post because life came in the way. I also haven&#8217;t been able to put as much effort into this week&#8217;s post as I&#8217;d like to, but I still think it&#8217;s a nice read. Hope you like it!)</p><p>Over the past two weeks, I finished reading <a href="https://www.goodreads.com/book/show/52824295-the-making-of-prince-of-persia">The Making of Prince of Persia</a> by Jordan Mechner. The book contains Jordan&#8217;s journals from the years that he was working on the first Prince of Persia game. There are lots of motivating and interesting things in the journal, so I thought I&#8217;d share a few of them with readers here.</p><h3>Obsession to the point of dreaming about your work.</h3><p>I found this quite interesting. I&#8217;ve had this happen to me a few times, but not for large projects. Perhaps I haven&#8217;t found something that&#8217;s made me obsessed enough yet.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LrGy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LrGy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 424w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 848w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 1272w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LrGy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png" width="1009" height="199" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:199,&quot;width&quot;:1009,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35520,&quot;alt&quot;:&quot;Then a strange thing happened. I started getting images in my head of the characters: The Sultan. The Princess. The Boy. I saw the scenes in my mind as if it were a Disney movie. So I wrote up a scenario &#8212; churned it out in an hour. It came out pretty well, I think.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Then a strange thing happened. I started getting images in my head of the characters: The Sultan. The Princess. The Boy. I saw the scenes in my mind as if it were a Disney movie. So I wrote up a scenario &#8212; churned it out in an hour. It came out pretty well, I think." title="Then a strange thing happened. I started getting images in my head of the characters: The Sultan. The Princess. The Boy. I saw the scenes in my mind as if it were a Disney movie. So I wrote up a scenario &#8212; churned it out in an hour. It came out pretty well, I think." srcset="https://substackcdn.com/image/fetch/$s_!LrGy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 424w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 848w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 1272w, https://substackcdn.com/image/fetch/$s_!LrGy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b90bcc0-2cf8-4a74-8b4d-ef5aa9a018d6_1009x199.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G8Sv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G8Sv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 424w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 848w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 1272w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G8Sv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png" width="1010" height="171" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66914871-63cb-44b0-8cee-47391443024c_1010x171.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:171,&quot;width&quot;:1010,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22819,&quot;alt&quot;:&quot;Drove to Broderbund early in the morning, let myself into the building and worked for ten hours straight. Like in the old days. I&#8217;m starting to see code patterns floating in my brain as I drift off to sleep at night&#8230; and, disturbingly, when I wake up in the morning.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Drove to Broderbund early in the morning, let myself into the building and worked for ten hours straight. Like in the old days. I&#8217;m starting to see code patterns floating in my brain as I drift off to sleep at night&#8230; and, disturbingly, when I wake up in the morning." title="Drove to Broderbund early in the morning, let myself into the building and worked for ten hours straight. Like in the old days. I&#8217;m starting to see code patterns floating in my brain as I drift off to sleep at night&#8230; and, disturbingly, when I wake up in the morning." srcset="https://substackcdn.com/image/fetch/$s_!G8Sv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 424w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 848w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 1272w, https://substackcdn.com/image/fetch/$s_!G8Sv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66914871-63cb-44b0-8cee-47391443024c_1010x171.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><div><hr></div><h3>You should feel good about what you&#8217;re building.</h3><p>Another consistent theme throughout the journal was that Mechner was convinced that the game was going to be good. He wasn&#8217;t sure how successful it would be, but he was always sure that it&#8217;d be a <em>high quality </em>game. That&#8217;s one thing I&#8217;m trying to do as well. I should try to <em>build the best thing I can build</em>, because otherwise what even is the point?</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7wrx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7wrx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 424w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 848w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 1272w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7wrx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png" width="1006" height="209" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b59acff7-36eb-4753-9a07-10707aa64870_1006x209.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:209,&quot;width&quot;:1006,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36304,&quot;alt&quot;:&quot;The amount of painstaking work still ahead of me is too huge to contemplate, but it&#8217;s paying off more dramatically than anything I&#8217;ve done in months. This is going to be a good game.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The amount of painstaking work still ahead of me is too huge to contemplate, but it&#8217;s paying off more dramatically than anything I&#8217;ve done in months. This is going to be a good game." title="The amount of painstaking work still ahead of me is too huge to contemplate, but it&#8217;s paying off more dramatically than anything I&#8217;ve done in months. This is going to be a good game." srcset="https://substackcdn.com/image/fetch/$s_!7wrx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 424w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 848w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 1272w, https://substackcdn.com/image/fetch/$s_!7wrx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb59acff7-36eb-4753-9a07-10707aa64870_1006x209.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xutT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xutT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 424w, https://substackcdn.com/image/fetch/$s_!xutT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 848w, https://substackcdn.com/image/fetch/$s_!xutT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 1272w, https://substackcdn.com/image/fetch/$s_!xutT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xutT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png" width="1017" height="110" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:110,&quot;width&quot;:1017,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16076,&quot;alt&quot;:&quot;It&#8217;ll all be worth it. This is going to be the greatest game of all time.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="It&#8217;ll all be worth it. This is going to be the greatest game of all time." title="It&#8217;ll all be worth it. This is going to be the greatest game of all time." srcset="https://substackcdn.com/image/fetch/$s_!xutT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 424w, https://substackcdn.com/image/fetch/$s_!xutT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 848w, https://substackcdn.com/image/fetch/$s_!xutT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 1272w, https://substackcdn.com/image/fetch/$s_!xutT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9795e2-6540-4db9-acbf-ab178060fa13_1017x110.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fifX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fifX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 424w, https://substackcdn.com/image/fetch/$s_!fifX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 848w, https://substackcdn.com/image/fetch/$s_!fifX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 1272w, https://substackcdn.com/image/fetch/$s_!fifX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fifX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png" width="1003" height="223" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:223,&quot;width&quot;:1003,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32691,&quot;alt&quot;:&quot;Been working hard on POP (48 hours last week) and it&#8217;s really looking good.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Been working hard on POP (48 hours last week) and it&#8217;s really looking good." title="Been working hard on POP (48 hours last week) and it&#8217;s really looking good." srcset="https://substackcdn.com/image/fetch/$s_!fifX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 424w, https://substackcdn.com/image/fetch/$s_!fifX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 848w, https://substackcdn.com/image/fetch/$s_!fifX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 1272w, https://substackcdn.com/image/fetch/$s_!fifX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8f1262d-f545-49ef-a955-57611012d3cc_1003x223.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div><hr></div><h3>Shouldn&#8217;t be afraid of confrontation if you believe in something.</h3><p>There&#8217;s a few moments where Jordan has issues because something some other person had to do for the game wasn&#8217;t being done well. It&#8217;s never nice to have to confront people about these things, but to get a good result in the end, sometimes you have to. Also, it&#8217;s much better to signal that you care about the thing, because that makes other people realize that it&#8217;s a thing worth caring about.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B9HI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B9HI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 424w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 848w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 1272w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B9HI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png" width="1012" height="152" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:152,&quot;width&quot;:1012,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19659,&quot;alt&quot;:&quot;I&#8217;ve got to learn to get more pumped up for these things. I was so blas&#233;, I really brought the energy down in the room. I think they&#8217;d have been more excited if I hadn&#8217;t been there to demo it.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="I&#8217;ve got to learn to get more pumped up for these things. I was so blas&#233;, I really brought the energy down in the room. I think they&#8217;d have been more excited if I hadn&#8217;t been there to demo it." title="I&#8217;ve got to learn to get more pumped up for these things. I was so blas&#233;, I really brought the energy down in the room. I think they&#8217;d have been more excited if I hadn&#8217;t been there to demo it." srcset="https://substackcdn.com/image/fetch/$s_!B9HI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 424w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 848w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 1272w, https://substackcdn.com/image/fetch/$s_!B9HI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eedf79f-7bc4-4e5e-b4f1-0bbfea2af53c_1012x152.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PZHn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PZHn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 424w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 848w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 1272w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PZHn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png" width="999" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:999,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19553,&quot;alt&quot;:&quot;It&#8217;s not that I insist on doing everything my own way. I&#8217;m always hoping someone else will come up with something better than I would have done myself. But when they don&#8217;t&#8230;?&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="It&#8217;s not that I insist on doing everything my own way. I&#8217;m always hoping someone else will come up with something better than I would have done myself. But when they don&#8217;t&#8230;?" title="It&#8217;s not that I insist on doing everything my own way. I&#8217;m always hoping someone else will come up with something better than I would have done myself. But when they don&#8217;t&#8230;?" srcset="https://substackcdn.com/image/fetch/$s_!PZHn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 424w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 848w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 1272w, https://substackcdn.com/image/fetch/$s_!PZHn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87428bea-0b1f-4348-9cea-afc7c4baf7bd_999x153.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4cbB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4cbB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 424w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 848w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 1272w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4cbB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png" width="1006" height="274" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:274,&quot;width&quot;:1006,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44910,&quot;alt&quot;:&quot;It made me realize how much I usually avoid confrontation. Conflict always gives me the anxious feeling that I need to say something to defuse the situation and restore goodwill, even if it&#8217;s at my own expense. Today, I realized the formidable power of acting tough. Not only did I get my way, I actually gained goodwill points, because I made Brian feel bad for having upset me. There&#8217;s a lesson in that. I need to develop the ability to stand my ground.&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="It made me realize how much I usually avoid confrontation. Conflict always gives me the anxious feeling that I need to say something to defuse the situation and restore goodwill, even if it&#8217;s at my own expense. Today, I realized the formidable power of acting tough. Not only did I get my way, I actually gained goodwill points, because I made Brian feel bad for having upset me. There&#8217;s a lesson in that. I need to develop the ability to stand my ground." title="It made me realize how much I usually avoid confrontation. Conflict always gives me the anxious feeling that I need to say something to defuse the situation and restore goodwill, even if it&#8217;s at my own expense. Today, I realized the formidable power of acting tough. Not only did I get my way, I actually gained goodwill points, because I made Brian feel bad for having upset me. There&#8217;s a lesson in that. I need to develop the ability to stand my ground." srcset="https://substackcdn.com/image/fetch/$s_!4cbB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 424w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 848w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 1272w, https://substackcdn.com/image/fetch/$s_!4cbB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a6fec4c-b357-491c-8dd4-2c4792ff0705_1006x274.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>There were other parts of the book that I really enjoyed too. Mechner&#8217;s evolving thoughts on what would make Prince of Persia fun were really nice to read through.</p><p>If you liked these small parts of the book, give it a read and tell me what you thought of it on Twitter! (or leave a comment here, I read all of them.)</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/the-making-of-prince-of-persia/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/the-making-of-prince-of-persia/comments"><span>Leave a comment</span></a></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[The Contrasting Personalities of John Carmack and John Romero in Masters of Doom]]></title><description><![CDATA[(or how I became a John Carmack fanboy this week)]]></description><link>https://newsletter.param.codes/p/the-contrasting-personalities-of</link><guid isPermaLink="false">https://newsletter.param.codes/p/the-contrasting-personalities-of</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sat, 25 Mar 2023 18:31:01 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!RPVU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RPVU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RPVU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RPVU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1154928,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RPVU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!RPVU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F318969bb-cce2-4f3d-aca2-49194e031b1a_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I breezed through the book &#8220;<a href="https://en.wikipedia.org/wiki/Masters_of_Doom">Masters of Doom</a>&#8221; this week. It&#8217;s a book by David Kushner about id Software, the video game company behind Doom and Quake, focussing on John Carmack and John Romero. It is a great read. Reading a well-written, easy to consume story about the industry was very fun, even though I was a bit young for these games.</p><p>The main theme of the book was the contrast between both of the co-founders: John Carmack and John Romero, the two Johns. The book goes through their initial collaborations building absolute gold, and then later falling through after they&#8217;d achieved a lot of success. </p><p>Carmack is a technical genius, obsessed with programming and computer graphics. He was the lead programmer of all of these games (Wolfenstein 3D, Doom, Quake), the biggest games in the video game industry at that point. In comparison, Romero was focussed on the more creative aspects of the games (storyline, design, look and feel etc). This was a great combination in the beginning. They complemented each other, as Romero was able to use Carmack&#8217;s innovations to build things that were amazingly cool at the time.</p><p>However, once they became successful, the differences in their personalities started showing up. As more and more money rolled in, Carmack was still focussed on the work and the hard tech while Romero became more and more distracted. Carmack was more successful by the end, having shipped better games (specifically Quake II) while Romero floundered with <a href="https://en.wikipedia.org/wiki/Daikatana">Daikatana</a>. This seems to be another example of my &#8220;five beats a day for three summers&#8221; thing.</p><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:50244161,&quot;url&quot;:&quot;https://newsletter.param.codes/p/five-beats-a-day-for-three-summers&quot;,&quot;publication_id&quot;:310304,&quot;publication_name&quot;:&quot;newsletter.param.codes&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F573f6d73-56f8-49c9-9be2-f4afef76672b_500x500.png&quot;,&quot;title&quot;:&quot;Five beats a day for three summers&quot;,&quot;truncated_body_text&quot;:&quot;A common theme I&#8217;ve noticed among successful people is extremely impressive levels of consistency and obsession with the thing that they&#8217;re working on. By working consistently on a small set of skills, they become the best in the world on it and it&#8217;s not easy for others to catch up.&quot;,&quot;date&quot;:&quot;2022-04-30T16:25:26.814Z&quot;,&quot;like_count&quot;:5,&quot;comment_count&quot;:3,&quot;bylines&quot;:[{&quot;id&quot;:4935382,&quot;name&quot;:&quot;Param Singh&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/89c77709-473d-4b50-b885-6f1a0a312675_1024x1024.png&quot;,&quot;bio&quot;:&quot;&#127470;&#127475; &#127470;&#127466;&#128039;&#127911;&#127925;&#128187;&quot;,&quot;profile_set_up_at&quot;:&quot;2021-12-14T12:50:37.395Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:257204,&quot;user_id&quot;:4935382,&quot;publication_id&quot;:310304,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:310304,&quot;name&quot;:&quot;newsletter.param.codes&quot;,&quot;subdomain&quot;:&quot;paramcodes&quot;,&quot;custom_domain&quot;:&quot;newsletter.param.codes&quot;,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;Essays about engineering, security, books and anything else that catches my eye for a second.&quot;,&quot;logo_url&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/573f6d73-56f8-49c9-9be2-f4afef76672b_500x500.png&quot;,&quot;author_id&quot;:4935382,&quot;theme_var_background_pop&quot;:&quot;#99A2F1&quot;,&quot;created_at&quot;:&quot;2021-03-09T21:46:21.450Z&quot;,&quot;rss_website_url&quot;:null,&quot;email_from_name&quot;:&quot;Param Singh&quot;,&quot;copyright&quot;:&quot;Param Singh&quot;,&quot;founding_plan_name&quot;:null,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;disabled&quot;}}],&quot;twitter_screen_name&quot;:&quot;iliekcomputers&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null,&quot;inviteAccepted&quot;:true}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:false,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="https://newsletter.param.codes/p/five-beats-a-day-for-three-summers?utm_source=substack&amp;utm_campaign=post_embed&amp;utm_medium=web"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="https://substackcdn.com/image/fetch/$s_!9RKw!,w_56,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F573f6d73-56f8-49c9-9be2-f4afef76672b_500x500.png"><span class="embedded-post-publication-name">newsletter.param.codes</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Five beats a day for three summers</div></div><div class="embedded-post-body">A common theme I&#8217;ve noticed among successful people is extremely impressive levels of consistency and obsession with the thing that they&#8217;re working on. By working consistently on a small set of skills, they become the best in the world on it and it&#8217;s not easy for others to catch up&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">4 years ago &#183; 5 likes &#183; 3 comments &#183; Param Singh</div></a></div><p>The other interesting thing was the different ways in which Carmack and Romero ran their companies after splitting up. Carmack kept the team small, opting for a solid team that was laser focussed on releasing one game at a time. In contrast, Romero hired a large number of people, working on multiple things at the same time. By the end, Romero&#8217;s game, <a href="https://en.wikipedia.org/wiki/Daikatana">Daikatana</a>, was a few years behind schedule and not a critical success when it was actually released. This was an interesting parallel to tech companies hiring a large number of people in 2021, with little to show for productivity gains. </p><p>Carmack has since worked as CTO of Oculus VR, and now has started a company called Keen Technologies with the goal of building Artificial General Intelligence. He is one of the coolest programmers alive. I&#8217;m a fanboy now.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[AI generated text-based adventures]]></title><description><![CDATA[Running a crowd-sourced adventure generated by ChatGPT on Twitter]]></description><link>https://newsletter.param.codes/p/ai-generated-text-based-adventures</link><guid isPermaLink="false">https://newsletter.param.codes/p/ai-generated-text-based-adventures</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 19 Mar 2023 18:31:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!o_9w!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!o_9w!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o_9w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o_9w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1683303,&quot;alt&quot;:&quot;midjourney v5: a group of merchants talking in a marketplace in ancient india, varanasi, anime art &quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="midjourney v5: a group of merchants talking in a marketplace in ancient india, varanasi, anime art " title="midjourney v5: a group of merchants talking in a marketplace in ancient india, varanasi, anime art " srcset="https://substackcdn.com/image/fetch/$s_!o_9w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!o_9w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ae0c8c-2003-4e6f-917b-4118d2cee359_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This week, I was playing around with the idea of text-based adventure games created by ChatGPT (with little pushes here and there from me). To see if it could be interesting, I&#8217;ve been running a small adventure via Twitter, crowd-sourcing the main character&#8217;s choices. </p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/iliekcomputers/status/1636643406817501184&quot;,&quot;full_text&quot;:&quot;(experimenting) \n\nWelcome to a text-based adventure game set in ancient India (written by chatgpt)! You find yourself in the bustling city of Varanasi, a hub of spirituality and trade. You are a young adventurer seeking your fortune and fame. What would you like to do first?&quot;,&quot;username&quot;:&quot;iliekcomputers&quot;,&quot;name&quot;:&quot;iliekcomputers&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Fri Mar 17 08:19:30 +0000 2023&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:0,&quot;like_count&quot;:7,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:false}" data-component-name="Twitter2ToDOM"></div><p>The story is nearing its ending, and has been quite fun. Want to follow along? Vote for the next choice here: </p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/iliekcomputers/status/1637371572523618305&quot;,&quot;full_text&quot;:&quot;You try to reason with the thief, telling him that you are only trying to help recover the stolen gemstone and that there's no need for violence. The thief hesitates before finally lowering his sword.\n\&quot;Alright,\&quot; he says. \&quot;I'll give it to you. Just don't turn me in to the police.\&quot;&quot;,&quot;username&quot;:&quot;iliekcomputers&quot;,&quot;name&quot;:&quot;iliekcomputers&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Sun Mar 19 08:32:58 +0000 2023&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:0,&quot;like_count&quot;:0,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:false}" data-component-name="Twitter2ToDOM"></div><p>Given that a number of people were interested, I&#8217;ll consider automating this and making a separate Twitter account for it. </p><p>The thing that it really opens my eyes towards is collaboration between human and AI. I&#8217;ve never been one for creative writing. It&#8217;s hard for me to invent fictional scenarios and characters. But with ChatGPT, a lot of this becomes easier as I can just nudge it in different directions (&#8220;make things more action packed!&#8221;, &#8220;introduce a group of people for the protagonist to talk with&#8221;) and then use the best thing that ChatGPT comes up with. Things are easier when you can use a tool to come up with hundreds of ideas and then use the best one.</p><p>If you use any of these tools for creative purposes, I&#8217;d love to talk to you about your workflow. </p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/ai-generated-text-based-adventures/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/ai-generated-text-based-adventures/comments"><span>Leave a comment</span></a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Gradient descent]]></title><description><![CDATA[(or how the best algorithms are the simplest and most intuitive)]]></description><link>https://newsletter.param.codes/p/gradient-descent</link><guid isPermaLink="false">https://newsletter.param.codes/p/gradient-descent</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 12 Mar 2023 09:14:13 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Irn0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Irn0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Irn0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Irn0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1208422,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Irn0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!Irn0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F242f9582-85b6-4724-92a7-96f664d5d3d6_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s talk about gradient descent. This is the topic discussed in <a href="https://www.youtube.com/watch?v=hBBOjCiFcuo">Lecture 3</a> of the <a href="https://course.fast.ai">FastAI Deep Learning course</a>. </p><p>In short, gradient descent is a method to fit a function to data. The steps involved are pretty simple. The <a href="https://github.com/fastai/fastbook">fastai deep learning book</a> explains it succinctly and clearly in Chapter 4:</p><blockquote><ol><li><p> <em>Initialize</em> the weights. We can take random weights for now.</p></li><li><p> Predict the value of the function based on these weights.</p></li><li><p> Based on these predictions, calculate how good the model is (its <em>loss</em>).</p></li><li><p>Calculate the <em>gradient</em>, which measures for each weight, how changing that weight would change the loss.</p></li><li><p><em>Step</em> (that is, change) all the weights based on that calculation.</p></li><li><p>Go back to the step 2, and <em>repeat</em> the process.</p></li><li><p>Iterate until you decide to <em>stop</em> the training process (for instance, because the model is good enough or you don't want to wait any longer).</p></li></ol></blockquote><p>The most complicated part of this process is actually calculating the gradient. However, the good news is that libraries like pytorch handle the math for us. I was very surprised to see that the code for gradient descent is a very simple function.</p><pre><code>def apply_step(params):
    preds = f(params)
    loss = mse(preds, actual)
    loss.backward()
    params.data -= lr * params.grad.data
    params.grad = None
    return preds

weights = torch.randn(3).requires_grad_()
for epoch in range(10):
    weights = apply_step(weights)</code></pre><p>Here, the <code>loss.backward() </code>call calculates the gradient and puts it in the <code>params </code>variable for us. After that, everything is pretty easy.</p><p>The results of just this simple gradient descent aren&#8217;t the most impressive, even for stuff like Kaggle&#8217;s <a href="https://www.kaggle.com/competitions/titanic/overview">Titanic problem</a>, but it&#8217;s pretty cool to see how simple and intuitive basic machine learning algorithms can be.</p><p>I&#8217;m always amazed by the intuitiveness of a lot of these algorithms in computer science. The thing that really differentiates a good algorithm from a great algorithm is simplicity. A great algorithm gives you the feeling that you could easily have come up with it, given time. I felt the same about Dijkstra&#8217;s algorithm or Binary Search Trees the first time I came across them. </p><p>I hope this small note about gradient descent makes some sense. If you&#8217;ve done this stuff before, I&#8217;m looking for ideas about things to build as the deep learning course goes on. Right now, I&#8217;m not too deep in the course, so Kaggle problems are fun, but I&#8217;m hoping to put this knowledge to actual use somewhere. Let me know if you want to chat!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/p/gradient-descent/comments&quot;,&quot;text&quot;:&quot;Leave a comment&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/p/gradient-descent/comments"><span>Leave a comment</span></a></p><h2>Things of interest</h2><ul><li><p>People are now able to run GPT-3 level LLMs on consumer grade MacBooks. The future is going to be amazing, I can&#8217;t wait.</p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/lawrencecchen/status/1634507648824676353&quot;,&quot;full_text&quot;:&quot;<span class=\&quot;tweet-fake-link\&quot;>@ggerganov</span> 65B running on m1 max/64gb! &#129433;&#129433;&#129433;&#129433;&#129433;&#129433;&#129433; &quot;,&quot;username&quot;:&quot;lawrencecchen&quot;,&quot;name&quot;:&quot;Lawrence Chen&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Sat Mar 11 10:52:45 +0000 2023&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://substackcdn.com/image/upload/w_1028,c_limit,q_auto:best/l_twitter_play_button_rvaygk,w_88/ojc0cnfq1neoxvywuica&quot;,&quot;link_url&quot;:&quot;https://t.co/Dh2emCBmLY&quot;,&quot;alt_text&quot;:null}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:150,&quot;like_count&quot;:1039,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:&quot;https://video.twimg.com/ext_tw_video/1634507456666828801/pu/vid/452x270/1ZYgG8TIoRqbeNW_.mp4?tag=12&quot;,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div></li><li><p><a href="https://aiku.param.codes">Aiku</a> has generated ~200 poems since February 4. I just assumed that no-one used it, but that wasn&#8217;t the case. Most of the users seem to be coming from Google, so I tweaked the site a bit (adding sitemaps etc) to make it more user-friendly. The main thing that I wanted to share was that it&#8217;s easy to assume that your project is dead if you don&#8217;t have any metrics. Having metrics is a good thing. :)</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[AskYC ]]></title><description><![CDATA[GPT-based Q&A bot based on YCombinator's YouTube channel]]></description><link>https://newsletter.param.codes/p/askyc</link><guid isPermaLink="false">https://newsletter.param.codes/p/askyc</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 05 Mar 2023 15:58:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!vOS6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vOS6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vOS6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vOS6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:988141,&quot;alt&quot;:&quot;midjourney generated image, prompt: \&quot;a robot giving advice to a programmer, digital art\&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="midjourney generated image, prompt: &quot;a robot giving advice to a programmer, digital art&quot;" title="midjourney generated image, prompt: &quot;a robot giving advice to a programmer, digital art&quot;" srcset="https://substackcdn.com/image/fetch/$s_!vOS6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!vOS6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F81d17d18-7687-46e1-bcd9-4709ec5c526a_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>First off, here&#8217;s a link to AskYC: <a href="https://transcribe.param.codes/ask/yc">https://transcribe.param.codes/ask/yc</a></p><p>In short, AskYC is a GPT-based Q&amp;A bot that&#8217;s based on every video on the <a href="https://www.youtube.com/@ycombinator">YCombinator YouTube channel</a> (except for a few very new ones). I spent the weekend hacking together its final parts after I&#8217;d been working on it for the last 2 weeks with <a href="https://twitter.com/ferbncode">Suyash</a>. </p><p>Here are a few example questions you can ask:</p><ol><li><p>&#8220;How do I get a startup idea?&#8221;</p></li><li><p>&#8220;How do I validate my startup idea?&#8221;</p></li><li><p>&#8220;What is product market fit?&#8221;</p></li><li><p>&#8220;How did Stripe make its first hire?&#8221;</p></li></ol><p>The outputs are quite nice, mostly because the YouTube content is really good. For example, here&#8217;s a screenshot:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TPyv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TPyv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 424w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 848w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 1272w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TPyv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png" width="1456" height="863" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:863,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:505002,&quot;alt&quot;:&quot;Example screenshot&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Example screenshot" title="Example screenshot" srcset="https://substackcdn.com/image/fetch/$s_!TPyv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 424w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 848w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 1272w, https://substackcdn.com/image/fetch/$s_!TPyv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b6cced-87d8-41fc-8bbc-01c89be71e3a_2140x1268.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Example screenshot</figcaption></figure></div><p>I transcribed these videos using <a href="https://newsletter.param.codes/p/introducing-transcribe">Transcriber</a> and then generated the embeddings for these transcriptions using <a href="https://gpt-index.readthedocs.io/en/latest/index.html">llama-index</a>. I&#8217;ll jump into the technical details in a future post, but in the meanwhile, if you have any feedback or even any ideas for something similar, please let me know! Now that I&#8217;ve done it for one channel, theoretically, it should be possible to do for any youtube channel, the only constraint being money.</p><p>Thanks for reading!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Learning deep learning]]></title><description><![CDATA[Thoughts on lesson 1 of the fast.ai course (https://course.fast.ai)]]></description><link>https://newsletter.param.codes/p/learning-deep-learning</link><guid isPermaLink="false">https://newsletter.param.codes/p/learning-deep-learning</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 26 Feb 2023 17:29:44 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!SLFe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SLFe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SLFe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SLFe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1829915,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SLFe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!SLFe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbd270b-4b8e-4b89-a9f1-e69066c0ae13_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the interest of not becoming entirely redundant in the next one year, I&#8217;ve decided to pick up <a href="https://fast.ai">fast.ai&#8217;s</a> <a href="https://course.fast.ai">deep learning course</a>. The course is free on <a href="https://www.youtube.com/watch?v=8SF_h3xF3cE">YouTube</a>, and so is the <a href="https://github.com/fastai/fastbook">book</a> it&#8217;s based on.</p><p>I&#8217;ve only watched <a href="https://notes.param.codes/notes/aape7dhzwahxzd51op95nlt/">Lecture 1</a> so far. I thought I would write a few small takeaways for myself (and for readers who are interested). I still highly recommend going through the course, because it&#8217;s pretty cool.</p><p>So here we go:</p><ol><li><p>Creating applications using deep learning is easier than I thought. In essence, most state-of-the-art (or near state-of-the-art) stuff is available freely and easy to fine-tune for your application.</p></li><li><p>Hardware is available in ease that was not really possible even just a few years ago. Most of these models require some sort of GPU to actually work in reasonable amounts of time in practical applications. In the past, especially when I was in university, it was hard and expensive to get access to these things. These days, you can just spin up a <a href="https://www.kaggle.com/docs/notebooks">Kaggle notebook</a> or a <a href="https://colab.research.google.com/">Google Colab session</a> to experiment with. For production, you can use tools like <a href="https://replicate.com/">Replicate</a>. </p></li><li><p>Most of the <em>actual </em>work is data cleaning and that sort of labor. So far, from what I&#8217;ve experienced, 90% of the time, I&#8217;m working on getting the data in a format that&#8217;s actually useful for the model and then put the answers in a format that&#8217;s actually useful for me. The fine-tuning and predictions are much easier.</p></li><li><p>It feels amazing and a little weird to train (or fine-tune) a model. I solved the <a href="https://www.kaggle.com/competitions/digit-recognizer">digit recognizer</a> problem by <a href="https://www.kaggle.com/code/iliekpython/digit-recognizer-using-fastai/notebook">fine-tuning resnet34 over the training dataset</a>. On a high level, it&#8217;s similar to teaching a kid digits. You show them a few digits and tell them to remember it. This is essentially what you&#8217;re doing when you&#8217;re fine-tuning a model too. I wonder how the creators of things like ChatGPT feel, seeing a nearly general intelligence be born out of their code.</p></li></ol><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><h1>Other news</h1><ul><li><p>I&#8217;m working on a cool project to create a Q&amp;A bot over all of <a href="https://www.youtube.com/@ycombinator">YCombinator&#8217;s YouTube channel</a>, if you&#8217;re interested and want to chat, hit me up on <a href="https://twitter.com/iliekcomputers">Twitter</a>: </p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/iliekcomputers/status/1627734324983500800&quot;,&quot;full_text&quot;:&quot;guess who's transcribing literally the entirety of <span class=\&quot;tweet-fake-link\&quot;>@ycombinator</span>'s YouTube channel&quot;,&quot;username&quot;:&quot;iliekcomputers&quot;,&quot;name&quot;:&quot;iliekcomputers&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Mon Feb 20 18:17:59 +0000 2023&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:0,&quot;like_count&quot;:5,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div></li><li><p>Interesting post about Stripe this week:</p><div class="embedded-post-wrap" data-attrs="{&quot;id&quot;:104876617,&quot;url&quot;:&quot;https://www.netinterest.co/p/stripe&quot;,&quot;publication_id&quot;:43559,&quot;publication_name&quot;:&quot;Net Interest&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa79f0f4-bdac-45f5-bd0d-c22ec558eb16_500x500.png&quot;,&quot;title&quot;:&quot;Striped Down&quot;,&quot;truncated_body_text&quot;:&quot;Since switching on the paid tier of Net Interest eighteen months ago, I&#8217;ve processed a lot of payments. On average, I do around 12 a day and have administered around 7,000 in total. They originate from all over the world: 40 states in America, practically every country in Western Europe, and countries as diverse as Colombia, Kenya and Vietnam. Most subscribers pay by credit card, but some use debit and prepaid cards.&quot;,&quot;date&quot;:&quot;2023-02-24T17:20:13.462Z&quot;,&quot;like_count&quot;:34,&quot;comment_count&quot;:0,&quot;bylines&quot;:[{&quot;id&quot;:2295875,&quot;name&quot;:&quot;Marc Rubinstein&quot;,&quot;previous_name&quot;:null,&quot;photo_url&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/539aebaa-a17e-4fc2-8317-b73c145dc678_512x512.jpeg&quot;,&quot;bio&quot;:&quot;Former hedge fund manager, now probing the perimeter of my circle of competence.&quot;,&quot;profile_set_up_at&quot;:&quot;2021-04-24T08:06:13.267Z&quot;,&quot;publicationUsers&quot;:[{&quot;id&quot;:2887,&quot;user_id&quot;:2295875,&quot;publication_id&quot;:43559,&quot;role&quot;:&quot;admin&quot;,&quot;public&quot;:true,&quot;is_primary&quot;:false,&quot;publication&quot;:{&quot;id&quot;:43559,&quot;name&quot;:&quot;Net Interest&quot;,&quot;subdomain&quot;:&quot;netinterest&quot;,&quot;custom_domain&quot;:&quot;www.netinterest.co&quot;,&quot;custom_domain_optional&quot;:false,&quot;hero_text&quot;:&quot;Financial sector insights from a former hedge fund manager with 25+ years experience analysing and investing in financial stocks.&quot;,&quot;logo_url&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/fa79f0f4-bdac-45f5-bd0d-c22ec558eb16_500x500.png&quot;,&quot;author_id&quot;:2295875,&quot;theme_var_background_pop&quot;:&quot;#3E6BAE&quot;,&quot;created_at&quot;:&quot;2020-05-05T13:56:09.212Z&quot;,&quot;rss_website_url&quot;:null,&quot;email_from_name&quot;:null,&quot;copyright&quot;:&quot;Marc Rubinstein&quot;,&quot;founding_plan_name&quot;:&quot;Institutional member&quot;,&quot;community_enabled&quot;:true,&quot;invite_only&quot;:false,&quot;payments_state&quot;:&quot;enabled&quot;}}],&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:1000,&quot;inviteAccepted&quot;:true}],&quot;utm_campaign&quot;:null,&quot;belowTheFold&quot;:true,&quot;type&quot;:&quot;newsletter&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="EmbeddedPostToDOM"><a class="embedded-post" native="true" href="https://www.netinterest.co/p/stripe?utm_source=substack&amp;utm_campaign=post_embed&amp;utm_medium=web"><div class="embedded-post-header"><img class="embedded-post-publication-logo" src="https://substackcdn.com/image/fetch/$s_!FmSA!,w_56,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa79f0f4-bdac-45f5-bd0d-c22ec558eb16_500x500.png" loading="lazy"><span class="embedded-post-publication-name">Net Interest</span></div><div class="embedded-post-title-wrapper"><div class="embedded-post-title">Striped Down</div></div><div class="embedded-post-body">Since switching on the paid tier of Net Interest eighteen months ago, I&#8217;ve processed a lot of payments. On average, I do around 12 a day and have administered around 7,000 in total. They originate from all over the world: 40 states in America, practically every country in Western Europe, and countries as diverse as Colombia, Kenya and Vietnam. Most subscribers pay by credit card, but some use debit and prepaid cards&#8230;</div><div class="embedded-post-cta-wrapper"><span class="embedded-post-cta">Read more</span></div><div class="embedded-post-meta">3 years ago &#183; 34 likes &#183; Marc Rubinstein</div></a></div></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Doing more than one thing at a time.]]></title><description><![CDATA[It feels weird but I get more done if I have multiple projects running at the same time.]]></description><link>https://newsletter.param.codes/p/doing-more-than-one-thing-at-a-time</link><guid isPermaLink="false">https://newsletter.param.codes/p/doing-more-than-one-thing-at-a-time</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 19 Feb 2023 12:31:04 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/10118082-3b17-40c1-a823-1d0bcc270398_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!u_aR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!u_aR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!u_aR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1121798,&quot;alt&quot;:&quot;generated with midjourney, caption: a young man sitting with a laptop, multiple thought bubbles, digital art, anime&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="generated with midjourney, caption: a young man sitting with a laptop, multiple thought bubbles, digital art, anime" title="generated with midjourney, caption: a young man sitting with a laptop, multiple thought bubbles, digital art, anime" srcset="https://substackcdn.com/image/fetch/$s_!u_aR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!u_aR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09bd95c3-6626-438f-8b55-d0fbad075eac_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you&#8217;ve been reading my stuff for some time, you&#8217;ll know that one thing that I&#8217;ve historically struggled with is <a href="https://newsletter.param.codes/p/someone-help-me-be-consistent">consistency</a>. </p><p>Here&#8217;s the thing: for me, it&#8217;s easy to start something, but once I get the initial fun bits of the work done, I start losing interest. It&#8217;s hard to motivate myself to do the less glamorous parts of the work. For example, creating the first few pieces of <a href="https://transcribe.param.codes">Transcribe</a> was fun, using tools like Replicate and GPT-3. Now that it&#8217;s done, the tasks are less fun. There are lots of UX improvements I want to make, so that it&#8217;s more convenient for me to use. I also want to create a browser extension to make it easier to submit things. The list is long.</p><p>A similar thing happens to me when reading. It&#8217;s so much easier to start a new technical book. The first few chapters are relatively basic and do not require a lot of mental work. But as soon as things start getting complicated, it becomes harder for me to keep going. </p><p>I&#8217;ve been thinking about how to improve, and I wanted to share one thing that&#8217;s been helpful in the past few weeks. Instead of having just one thing to focus on for a long period of time, I&#8217;ve been trying to have multiple things. For example, instead of just spending all my free time on <a href="https://transcribe.param.codes">transcribe</a>, I worked on a small command line tool (called <a href="https://github.com/paramsingh/huh">huh</a>) that I thought I would find helpful. Similarly, instead of just focussing on the one technical book, I read multiple simultaneously. This way, if one thing becomes too onerous, I just shift focus to the other and come back when I feel better.</p><p>I was thinking about this, and I came to a small realisation that this is one of the reasons why universities don&#8217;t just make you deep dive into one or two subjects across a semester. Of course, there are other logistical reasons (credit requirements, faculty expertise etc.) as well, but I think it&#8217;s easier for students when they&#8217;re not just focussed 24/7 on the same subject.</p><p>This is just something I&#8217;ve been trying in the last 2-3 weeks, so I&#8217;m still not completely convinced that I&#8217;m right. General convention of <a href="https://www.medicalnewstoday.com/articles/flow-state#what-it-is">flow states</a> and <a href="https://www.amazon.com/Deep-Work-Focused-Success-Distracted/dp/1455586692">deep work</a> do not recommend having multiple things vying for your focus, so perhaps it&#8217;s not helpful in the long run. Still, I&#8217;ve found it helpful in the last few weeks, so I&#8217;ll keep doing it until it&#8217;s not productive.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/subscribe?"><span>Subscribe now</span></a></p><h3>Random news</h3><ul><li><p>I re-did my personal website last week, in case you&#8217;re interested: <a href="https://param.codes">param.codes</a></p></li></ul><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/iliekcomputers/status/1625852615606308867&quot;,&quot;full_text&quot;:&quot;personal site looking kinda good now, if i do say so myself.\n\n<a class=\&quot;tweet-url\&quot; href=\&quot;https://param.codes\&quot;>param.codes</a> &quot;,&quot;username&quot;:&quot;iliekcomputers&quot;,&quot;name&quot;:&quot;iliekcomputers&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Wed Feb 15 13:40:45 +0000 2023&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/FpAwEZYaAAINx5o.png&quot;,&quot;link_url&quot;:&quot;https://t.co/rZg1kHRShU&quot;,&quot;alt_text&quot;:null}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:1,&quot;like_count&quot;:9,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><ul><li><p>If you want to try out huh, feel free to install it! <a href="https://github.com/paramsingh/huh#how-to-install">Install intructions here</a>. Demo: </p></li></ul><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/iliekcomputers/status/1625842362848272385&quot;,&quot;full_text&quot;:&quot;the number of things you can do with llms in like an hour of programming is kinda mind-blowing.\n\nthis is just an 80 line python file &quot;,&quot;username&quot;:&quot;iliekcomputers&quot;,&quot;name&quot;:&quot;iliekcomputers&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Wed Feb 15 13:00:00 +0000 2023&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://substackcdn.com/image/upload/w_1028,c_limit,q_auto:best/l_twitter_play_button_rvaygk,w_88/judwfnsqt8lk1p00ledm&quot;,&quot;link_url&quot;:&quot;https://t.co/dVcuTeusYj&quot;,&quot;alt_text&quot;:null}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:0,&quot;like_count&quot;:13,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:&quot;https://video.twimg.com/ext_tw_video/1625809500581269504/pu/vid/460x270/03wq_pUT0vFOn3_n.mp4?tag=12&quot;,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p>That&#8217;s it for this week, thanks for reading! </p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share&quot;,&quot;text&quot;:&quot;Share newsletter.param.codes&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://newsletter.param.codes/?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share"><span>Share newsletter.param.codes</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Introducing Transcribe]]></title><description><![CDATA[Playing with fun AI models to create something useful]]></description><link>https://newsletter.param.codes/p/introducing-transcribe</link><guid isPermaLink="false">https://newsletter.param.codes/p/introducing-transcribe</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Sun, 12 Feb 2023 18:30:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!DHD7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I thought I would write a small thing this week talking about what I&#8217;ve been building with <a href="https://twitter.com/ferbncode">Suyash</a> in the last ~2 weeks or so. </p><h3>What is this?</h3><p><a href="https://transcribe.param.codes">Transcribe</a> (<a href="https://transcribe.param.codes">https://transcribe.param.codes</a>) uses OpenAI&#8217;s <a href="https://openai.com/blog/whisper/">Whisper</a> to create transcriptions of YouTube videos and then uses GPT-3 to improve those transcriptions (remove filler words, transcription errors etc.) </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DHD7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DHD7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DHD7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png" width="460" height="460" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:460,&quot;bytes&quot;:1064865,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DHD7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!DHD7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f7f8960-8e6a-4847-8bdf-3bbd5d31997c_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Still trying to get a good photo of scribe from MidJourney or Dall-E. Let me know which one you like better, this one or the one on the website.</figcaption></figure></div><h3>Why is it useful?</h3><p>I&#8217;ve always preferred reading to watching videos, especially for educational content. However, as the internet has grown, there is an increasing amount of valuable information that&#8217;s only available in video form. It&#8217;s hard for me to consume this information because I don&#8217;t have the attention span to watch a 1.5 hour video. So, I thought I would create a tool to encode this information in text easily. </p><p>The sad thing that this encoding is, in essence, lossy. People use videos because they get a visual component that is just not reproducible in text. However, a transcription is still useful in many cases, even if you prefer videos to text. </p><p>The most obvious case is recall. It&#8217;s hard to find a random part of a video where the person talked about X topic, weeks after you originally watched the video. It&#8217;s much easier to do Ctrl+F &#8220;X&#8221; and then read from there. Another case is when you want an LLM like GPT-3 to process the information for you. Currently, this isn&#8217;t possible for videos. But it is possible for a transcription. </p><h3>See it in action!</h3><p>Link: <a href="https://transcribe.param.codes/">https://transcribe.param.codes/</a></p><p>Example transcriptions:</p><ul><li><p><a href="https://transcribe.param.codes/result/tr-c1b8a1be-8276-4b17-a6fb-94d32928933e">Terraform explained in 15 minutes</a></p></li><li><p>Karpathy&#8217;s <a href="https://transcribe.param.codes/result/tr-744c88f9-34c2-45f4-a8ee-1ea03f4850d1">&#8220;The spelled out intro to neural networks and backpropagation&#8221;</a></p></li></ul><p>Here&#8217;s a quick 30 second demo:</p><div id="youtube2-0A005pSyKF0" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;0A005pSyKF0&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/0A005pSyKF0?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><h3>How it works</h3><p>It&#8217;s very easy to build AI apps these days. I used <a href="https://replicate.com/openai/whisper">Replicate</a> to run whisper on audio files. It&#8217;s very nice (at least in the beginning) to not have to worry about managing GPUs when trying to use these models. The code for this is very simple, it&#8217;s something like:</p><pre><code>import replicate
model = replicate.models.get("openai/whisper")
version = model.versions.get("VERSION_NUMBER_HERE")
transcription = version.predict(audio=open("/path/to/file", "wb"))</code></pre><p>After that, I send the transcription to GPT-3 which improves the transcription basically like <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;visakan veerasamy&quot;,&quot;id&quot;:1690541,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/2a18b710-4488-4dd3-a428-148e9acc0157_400x400.jpeg&quot;,&quot;uuid&quot;:&quot;1b6a3903-51a2-42f8-9fdf-6b7a654f5268&quot;}" data-component-name="MentionToDOM"></span> does in this tweet: </p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/visakanv/status/1623288885987123200&quot;,&quot;full_text&quot;:&quot;this has really improved my quality of life &quot;,&quot;username&quot;:&quot;visakanv&quot;,&quot;name&quot;:&quot;Visa &#9992;&#65039; NYC (Feb22&#8211;Mar13)&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Wed Feb 08 11:53:24 +0000 2023&quot;,&quot;photos&quot;:[{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/FocUiTKaIAALFW3.png&quot;,&quot;link_url&quot;:&quot;https://t.co/Nen2IqvINa&quot;,&quot;alt_text&quot;:null},{&quot;img_url&quot;:&quot;https://pbs.substack.com/media/FocUk7xaQAAsYyd.png&quot;,&quot;link_url&quot;:&quot;https://t.co/Nen2IqvINa&quot;,&quot;alt_text&quot;:null}],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:13,&quot;like_count&quot;:412,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p>That&#8217;s the app for now. It&#8217;s very simple, uses Flask, Next.js and SQLite (!)</p><h3>Last minute notes</h3><p>If you try it out, I would recommend signing in before transcribing something. That way, you can keep track of the things you&#8217;ve transcribed. The transcription process does take a reasonable amount of time and if you haven&#8217;t signed in, you have to keep track of your video&#8217;s transcription link yourself.</p><h3>What&#8217;s next?</h3><p>Our goal for this week is to group information from different videos together and then see if we can do some LLM magic with this data. We&#8217;re still experimenting here, trying to find what&#8217;s useful for us and for other people, so if you have ideas about things you&#8217;d want a tool like this to do (or even if you just want to chat), please reach out to me, either by replying to this post or via <a href="http://twitter.com/iliekcomputers">Twitter</a>. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! You can subscribe to get these posts in your inbox automagically.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><br></p><p></p>]]></content:encoded></item><item><title><![CDATA[Aiku is moving to a new home.]]></title><description><![CDATA[(because Elon Musk is being a pain in the butt).]]></description><link>https://newsletter.param.codes/p/aiku-is-moving-to-a-new-home-soon</link><guid isPermaLink="false">https://newsletter.param.codes/p/aiku-is-moving-to-a-new-home-soon</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 06 Feb 2023 00:00:10 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6c8eb2a3-2695-4a30-b2dc-afc689681735_811x811.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>tl;dr: <a href="https://aiku.param.codes">Aiku</a> is moving from <a href="https://twitter.com/aikuthepoet">Twitter</a> to <a href="https://social.param.codes/@aiku">Mastodon</a>. </p><div><hr></div><p>Nearly a year ago, I created a small bot called <a href="https://aiku.param.codes">Aiku</a>. Aiku could generate a haiku-like poem for you, given two words as input. It&#8217;s based on the now-wildly popular GPT-3 model. </p><p>Since I didn&#8217;t want to have to manually generate poems myself to see them, I also created a <a href="https://twitter.com/aikuthepoet">Twitter bot</a>. It&#8217;s a tiny Python script that takes two random words, generates a poem and tweets it. Every day, at 12 AM GMT, it posts one poem and goes back to sleep. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E1zV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E1zV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 424w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 848w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E1zV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg" width="322" height="481.068" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:747,&quot;width&quot;:500,&quot;resizeWidth&quot;:322,&quot;bytes&quot;:96719,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E1zV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 424w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 848w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!E1zV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2101b40a-d169-41e5-b331-ad941ac4ddcb_500x747.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Sadly, this week, Twitter has decided that <a href="https://twitter.com/TwitterDev/status/1621026986784337922">it&#8217;s not going to allow people to use its API AT ALL without getting paid themselves first</a>. This is weird, bad and funnily hypocritical coming from the guy who was talking about open-sourcing the recommendation algorithm a few months ago. The news made me sad. The bot doesn&#8217;t have many followers, but seeing it keep working on its weird poems was a nice moment of my day almost every day.</p><p>Coming to Twitter&#8217;s API, unsurprisingly, it&#8217;s a pain in the ass to use. As a developer, I expect an API to be actually usable without talking to hundreds of support people. There are 2 versions of the Twitter API, and there isn&#8217;t an easy way to determine which one you&#8217;re supposed to use. I assumed that posting a tweet would be basic enough functionality to be in both the versions, so I went with the version that my client library seemed to support. Sadly, I later found that the version I chose did not actually allow you to tweet. Then, when I moved to the <em>other</em> version, Twitter told me that they needed me to talk with them before they&#8217;d actually allow me to post tweets. </p><p>So, all in all, it wasn&#8217;t a fun experience, especially with me coming from a different API company, where developer experience is literally paramount. Now that they expect me to pay to post a tweet, I&#8217;ve moved Aiku off Twitter and into Mastodon. <strong>I&#8217;m hosting a <a href="https://social.param.codes">personal mastodon instance</a> where I will (and you can) follow <a href="https://social.param.codes/@aiku">Aiku</a> as it continues posting a poem every day. </strong></p><p>Now, the funniest thing I saw this week was this tweet: </p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/thingskatedid/status/1621329890879610880&quot;,&quot;full_text&quot;:&quot;it's an API, michael. what could it cost, $100/month? &quot;,&quot;username&quot;:&quot;thingskatedid&quot;,&quot;name&quot;:&quot;Kate&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Fri Feb 03 02:09:03 +0000 2023&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{&quot;full_text&quot;:&quot;@BillyM2k @ericnakagawa Yeah, free API is being abused badly right now by bot scammers &amp;amp; opinion manipulators. There&#8217;s no verification process or cost, so easy to spin up 100k bots to do bad things.\n\nJust ~$100/month for API access with ID verification will clean things up greatly.&quot;,&quot;username&quot;:&quot;elonmusk&quot;,&quot;name&quot;:&quot;Elon Musk&quot;},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:22,&quot;like_count&quot;:361,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p>I wonder if Elon Musk seriously thinks that people will pay a 100 USD per month for the Twitter API, which is below par on almost any axis you judge APIs on. I wish he&#8217;d go back to building his rockets and cars. Never meet your heroes, friends.</p><p>Side note: A lot of other bot owners are pissed and removing their bots from Twitter too. Here&#8217;s one of the most popular ones: <a href="https://twitter.com/year_progress">@year_progress</a></p><div class="twitter-embed" data-attrs="{&quot;url&quot;:&quot;https://twitter.com/year_progress/status/1621525592616361984&quot;,&quot;full_text&quot;:&quot;Twitter is closing its doors to hobby bots like this one. They tell us a week before this happens.\n\nThere's been a lot of measured, well-mannered commentary from other makers of Twitter bots. I thought I'd share my uncensored thoughts instead.\n\nFuck this.\n\n1/?&quot;,&quot;username&quot;:&quot;year_progress&quot;,&quot;name&quot;:&quot;Year Progress&quot;,&quot;profile_image_url&quot;:&quot;&quot;,&quot;date&quot;:&quot;Fri Feb 03 15:06:42 +0000 2023&quot;,&quot;photos&quot;:[],&quot;quoted_tweet&quot;:{},&quot;reply_count&quot;:0,&quot;retweet_count&quot;:5596,&quot;like_count&quot;:50233,&quot;impression_count&quot;:0,&quot;expanded_url&quot;:{},&quot;video_url&quot;:null,&quot;belowTheFold&quot;:true}" data-component-name="Twitter2ToDOM"></div><p>Either ways, I was thinking about hosting a personal mastodon for a while now, so thanks Elon, I guess, for finally making me do it. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Goodbye, Stripe!]]></title><description><![CDATA[A three year long journey ends.]]></description><link>https://newsletter.param.codes/p/goodbye-stripe</link><guid isPermaLink="false">https://newsletter.param.codes/p/goodbye-stripe</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 30 Jan 2023 00:01:14 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9a32452d-84e0-4068-a321-e6bb1e10212a_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I left Stripe last week. It was fun working security for the <a href="https://www.protocol.com/bulletins/bolt-y-combinator-mob-bosses">mafia</a> (just kidding) for three and a half years. I learned a lot and made some really good friends (thanks to any of you reading!)</p><p>I helped ship a lot of things. The easiest to see is the <a href="https://dashboard.stripe.com/login">Stripe Dashboard&#8217;s login page</a>. There were a number of interesting internal libraries that I helped develop, learning a lot about web security and cryptography on the way. </p><p>If I was to compare before-Stripe Param and after-Stripe Param, I think there&#8217;s a huge difference in engineering skills and general ability to get things done. Before Stripe, I didn&#8217;t realize how much of a software engineer&#8217;s job is simply making sure that your project doesn&#8217;t get derailed by external factors.  </p><p>A popular image of a software engineer is the hacker sitting in a basement, creating a miraculous thing overnight. There are moments when you feel like that, but for the majority of the time, it&#8217;s less glamorous. There is a lot of other work to do. You have to talk to users throughout the development cycle, making sure that the project does solve the problem it&#8217;s supposed to. You have to provide support, write documentation, figure out which metrics you&#8217;re tracking to measure the project&#8217;s success. </p><p>The other thing that I really cherish is the team that I worked with. In 2020, when COVID happened, we were essentially a pack going through it together. I feel grateful that I was able to work with such amazing people for such a long time. </p><p>In summary, it was a very fun experience where I grew quite a lot and made a lot of friends. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Sanitize your links. ]]></title><description><![CDATA[React isn't as safe as I thought it was.]]></description><link>https://newsletter.param.codes/p/sanitize-your-links</link><guid isPermaLink="false">https://newsletter.param.codes/p/sanitize-your-links</guid><dc:creator><![CDATA[Param Singh]]></dc:creator><pubDate>Mon, 23 Jan 2023 00:00:59 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e7249a08-b0a7-476a-8d37-f6900de67dd2_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I came across an cross-site scripting (XSS) exploit in some React components in our codebase. This was surprising because I used to think that the only way to do dangerous stuff in React was the obvious <code>&#8220;dangerouslySetInnerHTML</code>&#8221;. But, I was wrong. </p><p>React doesn&#8217;t escape or sanitize &#8220;href&#8221; props in URLs. If you allow a user to create custom URLs on your website somehow, there&#8217;s a high chance your website can be exploited like this. Let&#8217;s say you have a field on your website for your user&#8217;s blog. The user can enter a link to their blog and you show it on the user&#8217;s profile page on your site. The code could look like this:</p><pre><code>const UserBlogLink = (link) =&gt; {
  return (
    &lt;a href={link}&gt;Blog&lt;/a&gt;
  );
}</code></pre><p>This component is not safe from XSS. React doesn&#8217;t do any sanitization of the &#8220;href&#8221; prop here. A user could put in <code>&#8220;javascript:alert(0)&#8221;</code> or something worse as their blog and your website would execute it.</p><p>So how do we avoid these bugs? Well, the first thing you want is a good <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP">CSP policy</a>. Things like these pop up every once in a while. While you can try to avoid XSS bugs by trying to safely render and validate all data, it&#8217;s nice to have defense in depth in case something does get missed (which it will). Then, the only way to fix this specific bug is to validate that the url is an actual HTTPS or HTTP link, not Javascript. Vue and Angular do this for you out of the box.</p><p></p><p></p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://newsletter.param.codes/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading newsletter.param.codes! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>