Stavros' Stuff Latest Posts Latest posts on Stavros' Stuff. en-us Stavros Korokithakis Making an AI-generated sleep podcast https://www.stavros.io/posts/making-ai-podcast/ https://www.stavros.io/posts/making-ai-podcast/ <div class="pull-quote">Falling asleep is more fun with an AI in your ear</div><p>When I was a teenager, I had a CD player in my room, and I used to listen to fairy tales to fall asleep. The narrator&#8217;s voice would relax me and I&#8217;d fall asleep quickly. Fast forward to yesterday, I was playing with Google Text-To-Speech for an unrelated project, and had gotten one of their code samples to generate some speech for me. I had also played around with <a href="https://openai.com/api/">OpenAI&#8217;s GPT-3</a>, which I had found wonderfully surrealist, and it had stuck in my mind, so I thought I should combine the two and create a podcast of nonsensical stories that you could listen to to help you fall asleep more easily.</p> <p>Having already played with Google&#8217;s speech synthesis, I thought it would be pretty quick and easy to create this, as all I&#8217;d have to do is generate some text with <span data-expounder="gpt3">GPT-3</span> and have Google speak it. <span data-expounded="gpt3">GPT-3 is an AI model that can generate very convincing text from a sample. You basically give it a topic and a few sentences, and it continues in the same vein, writing very natural-sounding prose.</span> Half an hour later, I had an AI-generated logo, AI-generated soundscapy background music, an AI-generated fairytale, and an AI-narrated audio file. A day later, I have seven:</p> <h2><a href="https://deepdreams.stavros.io/">The Deep Dreams podcast.</a></h2> <p>Here&#8217;s how I did it:</p> Fri, 03 Dec 2021 18:41:44 +0000 How to write a modern Slack bot in Python https://www.stavros.io/posts/how-to-slack-bot/ https://www.stavros.io/posts/how-to-slack-bot/ <div class="pull-quote">It took me SO LONG to find this info</div><p>This post is going to be short, but hopefully will help you avoid the troubles that befell me. I wanted to make a Slack bot using Python. &#8220;How hard can it be?&#8221;, I thought. &#8220;I&#8217;ve done it many times before&#8221;, I thought.</p> <p>Think again.</p> <p>The problem is that Slack has changed the way their APIs work. The old way is now referred to as a &#8220;classic app&#8221; with a &#8220;bot scope&#8221;, and that way is deprecated and you can&#8217;t really create apps like that now, so you have to do a whole other thing.</p> <p>In this post, I will detail the steps necessary to create a simple bot that will listen for messages and reply to them. That&#8217;s all the scaffolding you&#8217;ll need (or that <em>I</em> needed) to create your apps, but I had to search for many hours to discover this information. Hopefully Google will be kinder to you and Thu, 25 Nov 2021 00:20:13 +0000 How to ask for help https://www.stavros.io/posts/how-to-ask-for-help/ https://www.stavros.io/posts/how-to-ask-for-help/ <div class="pull-quote">It's harder than it sounds</div><p>As you may be aware, I very much like building things. Almost by definition, this means that I&#8217;m very often in situations where I&#8217;m out of my depth, as I always try to do new things that I don&#8217;t quite know how to do yet. Luckily, I have a whole bunch of knowledgeable friends whom I can ask for help.</p> <p>However, I noticed a pervasive problem when asking for someone&#8217;s help: It takes way too long to describe the issue I&#8217;m having. To make matters worse, conversations are usually synchronous (either chat or phone calls), which means that I&#8217;m wasting a bunch of the limited time they&#8217;re gracious enough to give me on trying to get my thoughts in order and describe the problem well.</p> <p>This is very suboptimal, and I&#8217;d like to propose a better Tue, 14 Sep 2021 11:05:12 +0000 Keyyyyyyyys! https://www.stavros.io/posts/keyyyyyyyys/ https://www.stavros.io/posts/keyyyyyyyys/ <div class="pull-quote">The keyboard you never wanted</div><p>I have a friend, Josh. Josh is a literal superhero. He&#8217;s a boring, minivan-driving programmer by day, paramedic and firefighter by night. That&#8217;s already a much more plausible superhero premise than Batman (a billionaire who spends his time fighting street-level crime? Really, Bruce? Is that the best use of your time and billions?).</p> <p>Josh showed me some notes he had taken while he was paramedicking his paramedic things. I say &#8220;showed&#8221;, it was more &#8220;asked me if I could make out what the hell the notes said&#8221;.</p> <p>I could not.</p> <p>The conversation then went like this:</p> <ul class="dialog"> <li>Why don't you type on a computer?</li> <li>A computer is generally hard to set up in the field, and you need to keep eye contact with the patient, so handwriting is more convenient.</li> <li>Why not have a special keyboard?</li> <li>I don't think that's very con</li> <li>It can be wireless, and one-handed!</li> <li>Yeah but still, how am</li> <li>It can have five keys, one for each finger, and you can chord combinations to type!</li> <li>That sounds slow and</li> <li>JOSH THIS IS HAPPENING STOP FIGHTING IT</li> </ul><p>After his outpour of encouragement, I was motivated to create a solution, no matter how hard. I had a rough idea in my mind, but it was going to be tough oh who am I kidding, it&#8217;s five buttons connected to a microcontroller, it would take two minutes.</p> <p>It took four hours. Close enough.</p> Mon, 12 Apr 2021 12:37:58 +0000 The "do not be alarmed" clock https://www.stavros.io/posts/do-not-be-alarmed-clock/ https://www.stavros.io/posts/do-not-be-alarmed-clock/ <div class="pull-quote">An alarm clock for the rest of us</div><p>It&#8217;s a brand new year, which means I should really start writing a new post. I&#8217;ve been wanting to for a while, but we&#8217;ve been in lockdown for two months now and Google Analytics is the only indication that I&#8217;m not alone on the planet, and most of that is bots anyway. I&#8217;ve decided to take a page out of the book of my friend, <a href="https://incoherency.co.uk/blog/">James Stanley</a>, who both does cool things <em>and</em> actually writes about them, so I&#8217;m starting to document all my projects again.</p> <p>Given my non-frenetic, slow-paced lifestyle, I&#8217;ve long had a non-burning need. I don&#8217;t use an alarm to wake up, as I start work late, but I still want to know what time it is when I wake up, just to see if it&#8217;s way too early and I can go to sleep again. A few days a week I have tennis and need to get up early, but if it&#8217;s windy or rainy or very cold, the practice gets canceled and I want to know before I&#8217;m awake enough to not be able to go to sleep again.</p> <p>To accommodate this lifestyle, I&#8217;ve traditionally turned to my mobile phone, but that has some disadvantages. Namely, the screen is too bright and wakes me up when I check the time, and I&#8217;m too obsessive to not check all my messages instead of falling asleep when I see the notifications on the screen. I&#8217;ve long thought that a bedside alarm clock would be perfect for me, but I couldn&#8217;t find one that fulfilled all my requirements:</p> Sun, 24 Jan 2021 22:37:32 +0000