<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by el guido on Medium]]></title>
        <description><![CDATA[Stories by el guido on Medium]]></description>
        <link>https://medium.com/@engineerguido?source=rss-6919914654d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XmQLKSZZGggHBK4WGKd9bQ.jpeg</url>
            <title>Stories by el guido on Medium</title>
            <link>https://medium.com/@engineerguido?source=rss-6919914654d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:16:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@engineerguido/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cómo se hizo nucleartweets.com]]></title>
            <link>https://engineerguido.medium.com/c%C3%B3mo-se-hizo-nucleartweets-com-64fbbe8decfc?source=rss-6919914654d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/64fbbe8decfc</guid>
            <category><![CDATA[twitter-api-v2]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[nuclear]]></category>
            <category><![CDATA[geiger]]></category>
            <dc:creator><![CDATA[el guido]]></dc:creator>
            <pubDate>Tue, 07 Feb 2023 01:49:43 GMT</pubDate>
            <atom:updated>2023-02-08T20:59:17.298Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Pantallazo de nucleartweets.com" src="https://cdn-images-1.medium.com/max/1024/1*7nWnqPqIbNxSDRPx8KEUkg.png" /><figcaption>nucleartweets.com</figcaption></figure><p>Hola, qué tal?</p><p>Vengo a darte la chapa sobre algunos detalles chulos de como montamos <a href="http://nucleartweets.com/">este proyecto</a> artístico que simula un contador Geiger. En nuestro contador, en lugar de medir “cuentas por minuto” de partículas ionizantes radioactivas, contamos el número de tuits que contienen la palabra “nuclear” por minuto.</p><h3>Los clicks</h3><p>Lo primero que hicimos fue ver si podíamos simular el sonido de un contador Geiger real disparando cada “click” individualmente. La verdad es que podríamos haber cogido el sonido de un contador real y ponerlo de fondo, pero nos hacía ilusión ver si podíamos recrear la cadencia tan característica de estos contadores.</p><p>En los contadores reales cada click corresponde con una partícula que impacta en el detector. Resulta que como con tantas cosas en la naturaleza, la cadencia entre clicks sigue una distribución de Poisson.</p><figure><img alt="Función de probabilidad de una distribución de Poisson" src="https://cdn-images-1.medium.com/max/1024/1*2xPQ01iaW7S0qNqDqKUC9g.png" /><figcaption>Función de probabilidad de una distribución de Poisson</figcaption></figure><p>Lambda representa la “tasa” de eventos, que en nuestro caso es el número de cuentas por minuto. Esto nos viene bastante bien. Podemos crear un programa que, a cada intervalo fijo, hace click (o no) con cierta probabilidad en base al número de cuentas por minuto. Por suerte, podemos calcular la probabilidad de que en un intervalo fijo de tiempo se produzca un “click” tomando la inversa de Poisson. Se conoce como “distribución exponencial”.</p><figure><img alt="Función de probabilidad exponencial" src="https://cdn-images-1.medium.com/max/1024/1*TuB2P_kAWzO4kWGpL6GYdQ.png" /><figcaption>Función de probabilidad exponencial</figcaption></figure><p>Armados con esta fórmula, podemos crear un programita sencillo que a cada centisegundo evalúa la probabilidad de que se oiga un click según la tasa de tuits del momento. Puedes copiar y pegar este código de ejemplo en la consola JavaScript de tu navegador y probar distintos valores para la variable “tasa”. Con una tasa de sesenta cuentas por minuto, deberías ver una media de un “Click!” impreso por segundo. Prueba a ver:</p><pre>setInterval(function () {<br>  var tasa = 60;<br>  var tasaNormalizada = tasa / 60 / 100;<br>  var probabilidad = tasaNormalizada * Math.exp(-tasaNormalizada);<br><br>  if (Math.random() &lt; probabilidad) {<br>    console.log(&quot;Click!&quot;);<br>  }<br>}, 10);</pre><blockquote>NOTA: Un centisegundo es lo mismo que decir “diez milisegundos”, pero sabía que ibas a pensar “este tío es tonto” y me ha hecho bastante gracia imaginármelo.</blockquote><p>Los lectores de código ávidos se habrán percatado de que hay mucho birlibirloque en esa línea que inicializa la variable “tasaNormalizada”. La razón por la que hay que “normalizar” la tasa es porque estamos evaluando esta función cada diez milisegundos, y queremos “reducir a escala” la tasa de la distribución exponencial para que de un resultado interesante. Al fin y al cabo, la función exponencial pierde su gracejo si la tasa es muy grande en comparación con el intervalo.</p><p>Esta solución trae algunas limitaciones:</p><ol><li>La tasa máxima es un “click” cada diez milisegundos o, lo que es lo mismo, seis mil cuentas por minuto. Ya es bastante, ya.</li><li>Esto de evaluar la función cada diez milisegundos se presta a que los retrasos de tu navegador a la hora de invocar la rutina se acumulen. Yo he notado carencias en la cadencia (jeje) de diez a veinte cuentas por minuto. Cuanto más viejo sea el trasto con el que visites la página, peor.</li></ol><h3>Los datos</h3><p>Hemos creado una ETL que extrae el número de tuits que contienen la palabra “nuclear” cada cinco minutos de la API V2 de Twitter. Y cuando digo ETL, me refiero a una Raspberry Pi 2 que cuelga precariamente de un cable Ethernet conectado al router detrás de la tele. El sistema se mantiene vivo por la gracia de la pestañita de plástico que impide que el conector se desprenda. Una guarrada.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRPlmUnXe7NECHHiR5WpSA.jpeg" /><figcaption>Nuestra heroica Raspberry Pi 🙏</figcaption></figure><p>La verdad es que lo podría mover todo a <a href="https://aws.amazon.com/lambda/">AWS Lambda</a> pero me da una pereza tremenda. Además, el señor Musk <a href="https://twitter.com/TwitterDev/status/1621026986784337922?s=20&amp;t=2r6pLrRJD1PsjLyq6sEEfg">ha dicho que se va a cargar la API</a> de Twitter de todas maneras. Ya me dirás tú cuál puede ser el retorno de esa inversión.</p><p>Los datos extraídos se meten en una instancia <a href="https://aws.amazon.com/dynamodb/?trk=94bf4df1-96e1-4046-a020-b07a2be0d712&amp;sc_channel=ps&amp;s_kwcid=AL!4422!3!610000101513!e!!g!!aws%20dynamodb&amp;ef_id=Cj0KCQiA54KfBhCKARIsAJzSrdqpZnXQC0CHkklGtpVBUKqfhmI3jIeYAnxKPkyLssYKUV1O7Db1v50aAnZvEALw_wcB:G:s&amp;s_kwcid=AL!4422!3!610000101513!e!!g!!aws%20dynamodb">Amazon DynamoDB</a>. Por qué Amazon DynamoDB me preguntas? Pues por que es lo más barato que hay. Hala, ya lo he dicho. Este es el esquema de la tabla por si tienes curiosidad:</p><pre>topic           | timestamp   | count<br>----------------+-------------+-------<br>nuclear-global  | 1669957380  | 31<br>nuclear-global  | 1669957440  | 33<br>nuclear-global  | 1669957500  | 42</pre><p>En DynamoDB, hay un concepto de clave de partición y otro de clave de órden (estoy pasándolo mal intentando evitar anglicismos; “partition key” y “sort key”). En este caso, la partición es por “topic” y se ordena por “timestamp”.</p><p>Como ves la idea era tener varios tópicos. Estos iban a tener dos usos:</p><ol><li>Probar mejoras en el filtrado de tuits usando la <a href="https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query#build">Twitter API V2 de queries</a>. Esto nos iba a permitir mejorar el criterio para contar un tuit como “nuclear”. Por ejemplo, excluyendo ciertos términos, tuits que contengan “nucleartweets.com”, RTs, etc.</li><li>Empezar a contar por país or región, cosa que <a href="https://twitter.com/chocotuits/status/1622304435140546568?s=20&amp;t=9YLY41NzLlMxwFTKrsKH4g">ya habíamos diseñado</a>.</li></ol><p>No creo que haya mucho más que contar de este tema pero si tienes preguntas píllame por tuiter y hablamos.</p><h3>Leer los datos</h3><p>Esto sí que está más guapo.</p><p>En la sección anterior vimos que los datos están en una base de datos DynamoDB en AWS. El problema es el siguiente: cómo puede la página consultar esos datos sin que queden las credenciales expuestas?</p><p>Pues con <a href="https://aws.amazon.com/cognito/">Amazon Cognito</a>. Resulta que este servicio de AWS se puede configurar para que genere credenciales anónimas. Es decir, sin que te autentiques, se te dan unas claves de una remesa al visitar la página. La remesa (“identity pool”) la configuramos para que solo se pudiera leer de la tabla en cuestión. También hicimos que las credenciales sólo duraran un tiempo y pudiesen consumir sólo cierta cuota.</p><p>Esto no va a evitar que alguien abuse de la cuota si quiere, pero por lo menos el daño está controlado y el esfuerzo de configurarlo es mínimo. Un mini-punto para Amazon.</p><h3>El frontend</h3><p>Está montado con un <a href="https://webpack.js.org/">Webpack </a>(<em>“tú si que eres un web paquete”</em>). Webpack, cosa que no sabía antes de este proyecto, es algo que te permite usar cualquier librería NPM en tu navegador. Hace otras cosas, pero esa es la razón por la que lo usamos nosotros: poder usar las librerías de AWS desde la página.</p><p>Para lograrlo, Webpack coge todo el código de todas las librerías que has usado y las inyecta como un mega-churro de texto minificado en tu página. Literal. No esperes algo más glamuroso que eso porque no lo hay.</p><p>También compila código LESS a CSS, minifica el resultado, gestiona tus assets, etc. Lo usaré de aquí en adelante.</p><h3>Conclusión</h3><p>Quiero agradecer a mi compa <a href="https://medium.com/u/f25ddef626df">Carlos Sánchez</a> por crear este proyecto conmigo y a todos los que habéis entrado a visitar la página. Ya lo mencionamos, pero la motivación para este proyecto vino del libro y película “On the beach”. Merece la pena leer el libro o <a href="https://www.youtube.com/watch?v=O9tweuR450A">ver la peli</a> (sale Ava Gardner ❤).</p><p>No veáis el remake del 2000 que no hay por donde cogerlo.</p><p>Hasta luego!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64fbbe8decfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Year-end thoughts: There is no “system.”]]></title>
            <link>https://engineerguido.medium.com/year-end-thoughts-there-is-no-system-a8fef9f13494?source=rss-6919914654d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8fef9f13494</guid>
            <dc:creator><![CDATA[el guido]]></dc:creator>
            <pubDate>Fri, 31 Dec 2021 16:15:57 GMT</pubDate>
            <atom:updated>2022-01-05T05:47:49.720Z</atom:updated>
            <content:encoded><![CDATA[<p>There was a time when mankind marveled at the very fact of rain. We could only imagine what order could explain the phenomenon of precipitation. Condensation? Never heard of it. As is typical for humans, when we don’t understand something, we imagine a central and complex solution to explain it. Water is falling from the sky? It can only be the work of God.</p><p><em>This is not an atheist rant, dear reader; please bear with me. I’m not even sure I’m an atheist.</em></p><p>Condensation and precipitation discovered, we moved God further out to the less mundane events of life that we still couldn’t explain. Seasons, droughts, floods, illness, etc. All surely at the mercy of providence.</p><p>In other instances, we refuse to push God away from parts of life that we do have a logical explanation for.</p><p>Death, rationally the mere cessation of all vital functions, is a widely unsatisfactory culmination to all experiences, problems, and thrills that is life. Many refuse to believe life would be so pointless as to simply end in this manner. Fair enough. That one is explained through psychology, which we humans have mainly to explain everything we don’t do rationally. Most of the world subscribes to ideas beyond rationality, and a tiny-but-influential group (sometimes in power) pretends they can’t understand any irrational motives (which itself is quite irrational if you think about it). But I digress.</p><p>You probably think that much of this doesn’t apply to you. You know <em>how and why</em> rain happens. Maybe you’re young and have managed to put off the thought of death. But think about <em>conspiracies.</em> “I can’t comprehend how the Americans were able to walk on the moon in the sixties, so I choose to believe in a central and complex explanation: It was all a tightly coordinated hoax in which not even the person who mopped the floors at Conspiracy HQ spilled the beans.” Sound familiar?</p><p>There’s another phenomenon at play that we can’t ignore: many have “killed” religion in their lives. And I say <em>kill — </em>not <em>abandon — </em>due to the Nietzsche-like violent rejection of values involved. I’ll admit it’s merely coincidental, but have you noticed that most conspiracy believers defend their theories with what can only be described as <em>religious</em> fervor?</p><p>If you’re snickering imagining a dumb right-winger with a tinfoil hat, stop. Despite everyone involved rather hilariously trying to deny it, there are plenty of Christian values in the left’s playbook. Oh, you believe the entire world needs to share political correctness standards along with your worldview? It’s almost like universal Christian justice. Oh, you think you’re personally liable for what your ancestors did, and you need to express your guilt at all times and especially in social settings? It’s almost like Christian guilt, repent, and flagellation. None of these traits exist in non-Christian societies.</p><p>Here’s something I consider liberating, but others seemingly can’t accept. Nothing really relates you to a 1900s inhabitant of your region. It’s why nationalism doesn’t really do it for me. Actually, you have far more in common with anyone in your generation <em>anywhere</em> than any person alive one hundred years ago. Why is that?</p><p>Well, here’s where it all ties back together. Remember those centrally and complex solutions that we dream up when we’re ignorant about something? I used to think that everything was ruled by a “system.” This “system” had “junior” and “senior” people in it, and I had to figure out how to enter the system that I wanted to be a part of and “climb the ranks.”</p><p>Of course, this worldview is absurd. How do you explain 23-year-old CEOs? How do you explain managers with people doubling their age in their teams? I’ll give you a hint: there is no system. Those “young promises” didn’t share your worldview. Through clairvoyance or privilege, they saw the world for what it is: a group of people interacting in simple ways. There are no “rules,” just “people.” People that change every generation. The future judges of the world were in the same classroom as you. Let that sink in for a moment. What a “mighty” system, eh?</p><p>Even the most trivial peer-to-peer interactions would require a complex system to be explained centrally. To think that things are centrally managed seems to be at the core of many conspiracies. I think it rather debunks them. How hard is it for two governments to work together on something? Do you realize the number of people of all ranks it takes to create even a mediocre diplomatic relationship? And you think COVID is a global hoax? Rest easy.</p><p>Everything can be explained through simple peer-to-peer interactions; every element has its own rules and reacts quite predictably to its environment. You just need to figure out each part’s motivations. After a life of struggling to understand “the system” as a central piece, it’s almost infuriating how simple it is to predict by just understanding “<em>individual</em> <em>aligned incentives.”</em></p><p>Take an ant colony (or Conway’s game of life). To write a single set of rules to control every ant centrally is impossible, especially as the number of ants grows. But with a straightforward set of rules that each individual ant must follow independently, the system as a whole appears to be extraordinarily complex. The colony finds food and tells each other about it! And ants don’t have brains!</p><p>I highly encourage you to watch this fantastic Youtube Video. A program is written to create such a distributed system. The result is organic-looking <a href="https://www.youtube.com/watch?v=X-iSQQgOd1A.">https://www.youtube.com/watch?v=X-iSQQgOd1A.</a> Even the human body’s most complex behaviors can be explained at least in part by distributed systems. The digestive system, for one, has “its own neurons.”</p><p>So, what’s the conclusion? What can we learn from all of this? Here’s a summary:</p><ol><li>When engaging with something new in life, don’t assume it’s complex. Try to dissect it into its moving pieces. It’s not “the Google.” It’s a company. How does it make money? Ads. How do they sell Ads? Advertisers go compete in an auction for keywords. How much money does that earn them? Seventy USD billion a year. Do they have other lines of profitable business? The cloud, but it’s a competitive space. So Google looks like a single point of failure desperate to diversify rather than an unkillable Goliath. Isn’t it weird how long they’ve had seventy billion dollars yearly without managing to diversify? Come up with a revenue-generating business that would fit in nicely at Google, and you might have a very decent chance at working at Google and cashing out big. This is regardless of your background, age, or how many times you read “Cracking the Coding Interview.” Nobody will care where you came from. I meet people who take themselves out of this possibility simply because of a “college degree” they’re missing. They still believe there’s a system.</li><li>Figure out what the elements of the problem are. Are you trying to sell to a business? That business will have sales goals set by management. What is the management’s definition of success for their salesforce? Don’t take the sales goals at face value. Remember: rules are just people. What incentives do the people “making the rules” at the company have? Don’t try to sell anything to the business until you can answer that question.</li><li>If you think you’re on a righteous cause that nobody seems to engage with, stop and think. How many centrally managed miracles does your idea need to be true? China created the virus in a lab? China’s putting micro-chips in your masks?</li><li>Stop trying to impose your worldview on others. This one is personal but for example: stop calling Latinos “Latinx.” For God’s sake! Do you not realize you’re a white person trying to tell others what to do and say? Maybe you do have something in common with your 1900s ancestors after all. Re-evaluate if your cause actually represents someone other than yourself.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8fef9f13494" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We’re still in the information era]]></title>
            <link>https://engineerguido.medium.com/were-still-in-the-information-era-1fdc524741ca?source=rss-6919914654d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fdc524741ca</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[information]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[functional-programming]]></category>
            <dc:creator><![CDATA[el guido]]></dc:creator>
            <pubDate>Mon, 27 Nov 2017 15:35:29 GMT</pubDate>
            <atom:updated>2017-11-27T16:39:18.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2A209YDBQ3OAUU7WFcgQ7g.jpeg" /><figcaption>Ancient Greeks using an abacus</figcaption></figure><p>Computers are everywhere. In your pocket, in your TV and even in your fridge. All these devices come with some sort of operating system, enabling developers to write apps for them. One would be inclined to think that this surely is the “Era of computers” or even the “Era of apps”, but I beg to differ. Let me explain.</p><p>The only reason we came up with computers is to deal with information. If we found something better, computers would go out of fashion instantly. It’s all about transforming data. So, rather than in the “Computer era”, we’re still in the “Information era”.</p><p>To some degree, I’d argue we’ve always been in it. At least every time a civilisation has realised that gathering information for further analysis is valuable. It really doesn’t matter what tools they used to perform that analysis. You probably never heard about the “Abacus era”, so why should we talk about the “Computer era”? Eras are not defined by tools, but by the resources those tools exploit.</p><p>Apps are the tools of our era. We’ve focused on making them easy to write and usable. That’s great, but it’s not enough. We often loose sight of what’s truly important. Yes, it’s nice to have objects so we can model problems easily, or interpreted languages that are programmer friendly and forgiving, but the truth is that these paradigms distract us from our real goal as programmers.</p><p>We’re tool builders –not strictly problem modellers– and we’re in the information business. We should always understand the information we handle and how to transform it in a useful way. Everything else is secondary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fdc524741ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>